window.flAjaxLoader01=true;function ajaxLoader(pUrl, pDestid, pWaitid, pWaitText, pMethod, pExecuteWhenDone, pPostData){	if (!pUrl || pUrl==""){		alert("Missing url");		return false;		}		if  (!pDestid || pDestid==""){		alert("Missing destination div id");		return false;		}					this.url=pUrl;	this.destid=pDestid;	this.waitid=(!pWaitid || pWaitid=="") ? pDestid: pWaitid ;	//waitid=(!waitid || waitid=="") ? destid: waitid ;	this.waitel=document.getElementById(this.waitid);	//alert("'" + pWaitText + "'");	this.waitText=(!pWaitText) ? "Wait please, connecting..." : pWaitText ;	this.method = (pMethod && pMethod!="") ? pMethod : "GET";		this.startRequest=startRequest;	this.ajaxRequest=ajaxRequest;	this.onChangeState=onChangeState;	this.extractAndDo=extractAndDo;		this.executeWhenDone=(pExecuteWhenDone)?pExecuteWhenDone:"";		function startRequest(){		with (this){			try {							if (waitid!=destid)					waitel.style.display="block";				if (waitText && waitText!="")					waitel.innerHTML=waitText;									if (url.indexOf("destboxid=")<0)					url += ((url.indexOf("?")>0) ? "&" : "?") + "destboxid=" + this.destid;									url += ((url.indexOf("?")>0) ? "&" : "?") + 'rnd=' + Math.floor(Math.random() * 100);								ajaxRequest(url, method);				}			catch(tError) {				alert( tError.name + ": " + tError.message + "(startRequest)");				}			 }		}				function ajaxRequest(theUrl, theMode) {		try{			// branch for native XMLHttpRequest object			var tMode= theMode ? theMode : 'GET';			var tParams="";						if (tMode=="POST"){				//old code					//var tArray=theUrl.split("?")					//if (tArray.length>1)						//tParams=tArray[1];								tParams=(pPostData)?pPostData:"";				}							if (window.XMLHttpRequest) {				this.req = new XMLHttpRequest();				this.req.open(tMode, theUrl, true);				this.req.setRequestHeader('If-Modified-Since', 'Wed, 15 Nov 1995 00:00:00 GMT');				if (tMode=="POST")					this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');				var tThis=this;				this.req.onreadystatechange = function(){tThis.onChangeState()};				//this.req.onreadystatechange = onChangeState;				if (tParams=="")					this.req.send(null);				else					this.req.send(tParams);				// branch for IE/Windows ActiveX version				} 			else if (window.ActiveXObject) {				this.req = new ActiveXObject("Microsoft.XMLHTTP");				//alert(req);				if (this.req) {					this.req.open(tMode, theUrl, true);					if (tMode=="POST")						this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');					var tThis=this;					this.req.onreadystatechange = function(){tThis.onChangeState()};					//this.req.onreadystatechange = onChangeState;					if (tParams=="")						this.req.send();					else						this.req.send(tParams);					}				}			}		catch(tError) {			alert( tError.name + ": " + tError.message + "(ajaxRequest)");			}		}		function onChangeState() {		// only if req shows "loaded"		//alert(this.req.readyState);		try{			switch (this.req.readyState)				{				case 1:				case 2:				case 3:					{						break;						}				case 4:					{						try							{								// only if "OK"								if (this.req.status == 200) {									var tInnerText=this.req.responseText									//alert(this.destid);									try{										tInnerText=extractAndDo(tInnerText);										}									catch(tEvalErr){										tInnerText=tInnerText+"<!--" + tEvalErr.name + ": " + tEvalErr.message + "-->"										}									if (this.executeWhenDone != ""){										try{											tInnerText=this.executeWhenDone(tInnerText, this);											}										catch(tEvalErr){											alert(tEvalErr.name + ": " + tEvalErr.message);											tInnerText=tInnerText+"<!--" + tEvalErr.name + ": " + tEvalErr.message + "-->"											}										}									document.getElementById(this.destid).innerHTML=tInnerText;									//buildTopicList();									} 								else {									document.getElementById(this.destid).innerHTML = "There was a problem retrieving the XML data:\n" + this.req.statusText ;									}								if (this.destid != this.waitid)									document.getElementById(this.waitid).style.display="none";																}						catch(tError)							{								alert(tError.name + ": " + tError.message);								document.getElementById(this.destid).innerHTML="<b>" + tError.name + "</b>: " + tError.message;								}						break;												}				}			}		catch(tError) {			alert( tError.name + ": " + tError.message + " (onChangeState)");			}		}				function extractAndDo(theText) {		try{			var reg = /<!--#(.|\n)+?#-->/gi;			var corr = theText.search(reg);			//alert(corr);			if(corr != -1) {				var exprf = theText.match(reg);				for(var i = 0; i < exprf.length; i++) {					var com = exprf[i].substring(5, exprf[i].length - 4);					//alert(com);					eval(com);					}				}			var tResText=theText.replace(reg, '');			tResText=tResText.replace("<!--##-->", '');			return tResText;			}		catch(tError) {			alert( tError.name + ": " + tError.message + "[extractAndDo: " + theText + "]");			}		}	}	function ajaxLoadXslOld(siteUrl, data, struct, num, destid, waitid, waitText){	var tUrl=siteUrl + "public/ajax/responder?action=getxsl&data=" + data + "&struct=" + struct + "&num=" + num;	var tLoader=new ajaxLoader(tUrl, destid, waitid, waitText);	tLoader.startRequest(); 	}	function ajaxLoadXsl(siteUrl, data, struct, num, destid, waitid, waitText, args){	var tUrl=siteUrl + "public/ajax/responder?action=getxsl&data=" + data + "&struct=" + struct + "&num=" + num + "&args=" + ((args)?args:"");	var tLoader=new ajaxLoader(tUrl, destid, waitid, waitText);	tLoader.startRequest(); 	}	function ajaxPostForm(theForm, theDestUrl, theDestId, theWaitId, theWaitText, theProcessFunction, theMode, flDebug){	var tData = "";	for (var i = 0; i < theForm.elements.length; i++) {		tData +=(tData=="") ? "" : "&";		switch (theForm.elements[i].type) {			case "select":			case "select-one":				tData += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].options[theForm.elements[i].selectedIndex].value);				break;			case "radio":			case "checkbox":				tData += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].value);				break;			default:				tData += theForm.elements[i].name + "=" + encodeURIComponent(theForm.elements[i].value);			}		}	if (flDebug){		var tAlertText="";		for (var n = 0; n < arguments.length; n++){			try{				tAlertText += arguments[n] + "\n";				}			catch(tEvalErr){								}			}		alert(tAlertText + tData);		}	var tDoNothing=function doNothing(theResult){return theResult;}	var tLoader=new ajaxLoader(theDestUrl, theDestId, theWaitId, theWaitText, (theMode)?theMode : "GET", (theProcessFunction) ? theProcessFunction: tDoNothing, tData);	tLoader.startRequest(); 	}function parseXmlChunkToObject(theXmlChunk){	try{		var xmlString = '<wrapper>'+theXmlChunk+'</wrapper>';				// code for IE		if (window.ActiveXObject){			var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");			xmlDoc.async="false";			xmlDoc.loadXML(xmlString);			}		// code for Mozilla, Firefox, Opera, etc.		else{			var parser=new DOMParser();			var xmlDoc=parser.parseFromString(xmlString,"text/xml");			}		alert(xmlDoc);		return xmlDoc;		}	catch (tErr){		alert(tErr);		}	}
