function AjaxRun(showID,urlpath) {		ajax1 = new sack();	ajax1.requestFile 	= urlpath;	// Specifying which file to get	ajax1.showNowID		= showID;		ajax1.URLString 		= "";	ajax1.runAJAX("");		// Execute AJAX function			}function AjaxRunWithLoad(showID,urlpath) {	contentObje = document.getElementById(showID);	if (contentObje != null) contentObje.innerHTML = '<center class=txt_body_sm><img src=/e/images/loading.gif><br>Loading - Please Wait</center>'+contentObje.innerHTML;	AjaxRun(showID,urlpath);}function AjaxRunPost(showID,urlpath,form) {		ajax1 = new sack();	ajax1.requestFile 	= urlpath + FormPostToGet(form) + "&AJAX_MODE=true";	// Specifying which form	ajax1.showNowID		= showID;		ajax1.URLString 		= "";		ajax1.runAJAX("");		// Execute AJAX function			}// Same as above but with waitingfunction AjaxRunPostWaiting(showID,urlpath,form) {		contentObje = document.getElementById(showID);	if (contentObje != null) contentObje.innerHTML = '<center class=txt_body_sm><img src=/e/images/loading.gif><br>Loading - Please Wait</center>'+contentObje.innerHTML;	AjaxRunPost(showID,urlpath,form);		}// If not using this.id for the formfunction AjaxRunPostByName(showID,urlpath,formname) {		var frm_element = document.getElementById(formname);		AjaxRunPost(showID,urlpath,frm_element); }function AjaxRunPostWaitingByName(showID,urlpath,formname) {		var frm_element = document.getElementById(formname);		AjaxRunPostWaiting(showID,urlpath,frm_element); }function FormPostToGet(fobj) {  var str = "";    var ft = "";    var fv = "";    var fn = "";   var fty = "";  var els = ""; 		for(var i = 0;i < fobj.elements.length;i++) {				 els = fobj.elements[i];  		 ft = els.title;           fv = els.value;  		 fn = els.name;			 fty = els.type;				 if (fty == "checkbox" && els.checked==true) {			 str += "&"+fn+"="+Base64.encode(fv);			 		 		 } 		 else if (fty == "radio" && els.checked==true) {			 str += "&"+fn+"="+Base64.encode(fv);			 		 		 } 		 else if (fty != "button" && fty != "checkbox" && fty != "radio") {			 str += "&"+fn+"="+Base64.encode(fv);		 }	}	return str;}function TableColorRow(divID,newColor) {		contentObje = document.getElementById(divID); 	if (contentObje != null) {						contentObje.style.backgroundColor = newColor;		}}/* Simple AJAX Code-Kit (SACK) *//* ©2005 Gregory Wild-Smith *//* www.twilightuniverse.com *//* Software licenced under a modified X11 licence, see documentation or authors website for more details */function sack(file){	this.AjaxFailedAlert = "Your browser does not support the enhanced functionality of this website, and therefore you will have an experience that differs from the intended one.\n";	this.requestFile = file;	this.method = "GET";	this.URLString = "";	this.encodeURIString = true;	this.execute = false;	this.onLoading = function() { };	this.onLoaded = function() { };	this.onInteractive = function() { };	this.onCompletion = function() {  };	this.createAJAX = function() {		try {			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e) {			try {				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");			} catch (err) {				this.xmlhttp = null;			}		}		if(!this.xmlhttp && typeof XMLHttpRequest != "undefined")			this.xmlhttp = new XMLHttpRequest();		if (!this.xmlhttp){			this.failed = true; 		}	};		this.setVar = function(name, value){		if (this.URLString.length < 3){			this.URLString = name + "=" + value;		} else {			this.URLString += "&" + name + "=" + value;		}	}		this.encVar = function(name, value){		var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);	return varString;	}		this.encodeURLString = function(string){		varArray = string.split('&');		for (i = 0; i < varArray.length; i++){			urlVars = varArray[i].split('=');			if (urlVars[0].indexOf('amp;') != -1){				urlVars[0] = urlVars[0].substring(4);			}			varArray[i] = this.encVar(urlVars[0],urlVars[1]);		}	return varArray.join('&');	}		this.runResponse = function(){		eval(this.response);	}		this.runAJAX = function(urlstring){		this.responseStatus = new Array(2);		if(this.failed && this.AjaxFailedAlert){ 			alert(this.AjaxFailedAlert); 		} else {			if (urlstring){ 				if (this.URLString.length){					this.URLString = this.URLString + "&" + urlstring; 				} else {					this.URLString = urlstring; 				}			}			if (this.encodeURIString){				var timeval = new Date().getTime(); 				this.URLString = this.encodeURLString(this.URLString);				this.setVar("rndval", timeval);			}			if (this.element) { this.elementObj = document.getElementById(this.element); }			if (this.xmlhttp) {				var self = this;				if (this.method == "GET") {					var totalurlstring = this.requestFile + "?" + this.URLString;					this.xmlhttp.open(this.method, totalurlstring, true);				} else {					this.xmlhttp.open(this.method, this.requestFile, true);				}				if (this.method == "POST"){  					try {						this.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded')  					} catch (e) {}				}				this.xmlhttp.send(this.URLString);				this.xmlhttp.onreadystatechange = function() {					switch (self.xmlhttp.readyState){						case 1:							contentObje = document.getElementById(self.showNowID);							if (contentObje != null) contentObje.innerHTML = '<center><img src=/e/images/loading.gif>Loading...Please wait</center>';						break;						case 2:							self.onLoaded();						break;						case 3:							self.onInteractive();						break;						case 4:							self.response = self.xmlhttp.responseText;							self.responseXML = self.xmlhttp.responseXML;							self.responseStatus[0] = self.xmlhttp.status;							self.responseStatus[1] = self.xmlhttp.statusText;							self.onCompletion();							contentObj = document.getElementById(self.showNowID);							contentObj.innerHTML = self.response;																					if(self.execute){ self.runResponse(); }							if (self.elementObj) {								var elemNodeName = self.elementObj.nodeName;								elemNodeName.toLowerCase();								if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea"){									self.elementObj.value = self.response;								} else {									self.elementObj.innerHTML = self.response;								}							}							self.URLString = "";						break;					}				};			}		}	};	this.createAJAX();}/****  Base64 encode / decode*  http://www.webtoolkit.info/***/ var Base64 = { 	// private property	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 	// public method for encoding	encode : function (input) {		var output = "";		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;		var i = 0; 		input = Base64._utf8_encode(input); 		while (i < input.length) { 			chr1 = input.charCodeAt(i++);			chr2 = input.charCodeAt(i++);			chr3 = input.charCodeAt(i++); 			enc1 = chr1 >> 2;			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);			enc4 = chr3 & 63; 			if (isNaN(chr2)) {				enc3 = enc4 = 64;			} else if (isNaN(chr3)) {				enc4 = 64;			} 			output = output +			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); 		} 		return output;	}, 	// public method for decoding	decode : function (input) {		var output = "";		var chr1, chr2, chr3;		var enc1, enc2, enc3, enc4;		var i = 0; 		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 		while (i < input.length) { 			enc1 = this._keyStr.indexOf(input.charAt(i++));			enc2 = this._keyStr.indexOf(input.charAt(i++));			enc3 = this._keyStr.indexOf(input.charAt(i++));			enc4 = this._keyStr.indexOf(input.charAt(i++)); 			chr1 = (enc1 << 2) | (enc2 >> 4);			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);			chr3 = ((enc3 & 3) << 6) | enc4; 			output = output + String.fromCharCode(chr1); 			if (enc3 != 64) {				output = output + String.fromCharCode(chr2);			}			if (enc4 != 64) {				output = output + String.fromCharCode(chr3);			} 		} 		output = Base64._utf8_decode(output); 		return output; 	}, 	// private method for UTF-8 encoding	_utf8_encode : function (string) {		string = string.replace(/\r\n/g,"\n");		var utftext = ""; 		for (var n = 0; n < string.length; n++) { 			var c = string.charCodeAt(n); 			if (c < 128) {				utftext += String.fromCharCode(c);			}			else if((c > 127) && (c < 2048)) {				utftext += String.fromCharCode((c >> 6) | 192);				utftext += String.fromCharCode((c & 63) | 128);			}			else {				utftext += String.fromCharCode((c >> 12) | 224);				utftext += String.fromCharCode(((c >> 6) & 63) | 128);				utftext += String.fromCharCode((c & 63) | 128);			} 		} 		return utftext;	}, 	// private method for UTF-8 decoding	_utf8_decode : function (utftext) {		var string = "";		var i = 0;		var c = c1 = c2 = 0; 		while ( i < utftext.length ) { 			c = utftext.charCodeAt(i); 			if (c < 128) {				string += String.fromCharCode(c);				i++;			}			else if((c > 191) && (c < 224)) {				c2 = utftext.charCodeAt(i+1);				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));				i += 2;			}			else {				c2 = utftext.charCodeAt(i+1);				c3 = utftext.charCodeAt(i+2);				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));				i += 3;			} 		} 		return string;	} }
