	/********************************************************************************
	 * This is for Ajax functions ONLY
	 ********************************************************************************/

	// ---- Added on 20 Dec 2007 -----
	function getValue(el, i, tagName) {
		var t = el[i].getElementsByTagName(tagName);
		if (t[0].firstChild != null) {
			tmp = t[0].firstChild.data				
		  	return tmp;
		}
		else return "";
	}
	// ---- End of Added on 20 Dec 2007 -----
	
	/********************************************************************************/

	function replaceIEiIllegalChars(txtStr) {
		var tmpStr = txtStr.replace("&","&amp;");
		return tmpStr;
	}
	
	/********************************************************************************/
	var textReturn = 100;
	var xmlReturn = 101;
	var xmlDoc;
	var xmlText;
	var debug=false;
	var AJAX_ERROR = "Error: This browser does not support AJAX.";
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
		
	function setDebug(flag) { debug = flag; }

	function loadXMLDoc(url, fType, retType) {

		var req;

		// debug = true;
		if (debug) alert(url);

		if (! is_ie) {

	   		// branch for native XMLHttpRequest object
   			if(window.XMLHttpRequest) {
   				try {
					req = new XMLHttpRequest();
					req.open("GET", url, true);
					req.send(null);
					req.onreadystatechange = function () {
						if (req.readyState == 4 &&  req.status == 200) {
				    	    		if (document.implementation && document.implementation.createDocument){
								if (debug)	{
									resp = req.responseText;
									alert("Ajax XML Return = " + resp);		
								}
								if (retType == xmlReturn) {
									xmlDoc = req.responseXML.documentElement;
									xmlText = req.responseText;
								}
								else	{
									xmlDoc = req.responseText;
									xmlText = req.responseText;
								}
								callbackFunctions(fType);
							}
						} 
				  	}		
    	    			} catch(e) {
					alert(AJAX_ERROR);
					return;
    		   		}
			}
		} else {  // ONLY FOR IE
	   		// branch for native XMLHttpRequest object
   			if(window.XMLHttpRequest) {
   				try {
					req = new XMLHttpRequest();
				} catch(e) {
  					req = false;					
				}
				
			// branch for IE/Windows ActiveX version
			} else if(window.ActiveXObject) {
   				try {
       				req = new ActiveXObject("Msxml2.XMLHTTP");
	      		} catch(e) {
   			   		try {
   						req = new ActiveXObject("Microsoft.XMLHTTP");
	       			} catch(e) {
   						req = false;
	   				}
				}
			}
			if (req) {
				req.open("GET", url, true);
				req.onreadystatechange = function () {
					if (req.readyState == 4 &&  req.status == 200) {
						try {
							xmlDoc = new ActiveXObject("MSXML2.DomDocument.2.0") ;
						} catch(e) {
							xmlDoc = new ActiveXObject("Microsoft.XMLDOM") ;
						}
						xmlText = replaceIEiIllegalChars(req.responseText);
						if (debug)	alert("Ajax XML Return = " + xmlText);		
						if (retType == xmlReturn) xmlDoc.loadXML(xmlText);	
						else xmlDoc = xmlText;
						callbackFunctions(fType);
					}
				}
				req.send(null);  // Note that the send call needs to be here as IE doesn't always trigger a state change if the call is before the onreadystatechange definition
			} else {
				alert(AJAX_ERROR);
				return;
			}
		}
	}

	/********************************************************************************
	 * END OF Ajax functions ONLY
	 ********************************************************************************/