
$(document).ready(function(){$('input:checkbox, input:radio').css('border','none');$('input:radio').addClass('class_radio');$('input:checkbox').addClass('class_checkbox');});
var PHP2Ajax=new Object();PHP2Ajax.REQUEST_METHOD_POST='POST';PHP2Ajax.REQUEST_METHOD_GET='GET';PHP2Ajax.READY_STATE_UNINITIALIZED=0;PHP2Ajax.READY_STATE_LOADING=1;PHP2Ajax.READY_STATE_LOADED=2;PHP2Ajax.READY_STATE_INTERACTIVE=3;PHP2Ajax.READY_STATE_COMPLETE=4;PHP2Ajax.HTTP_STATUS_OK=200;PHP2Ajax.HTTP_STATUS_FOUND=302;PHP2Ajax.CALL_REQUEST_PARAMETER='__callHandler';PHP2Ajax.CALLBACK_HANDLER_PARAMETER='__callbackHandler';PHP2Ajax.add=function(name,value)
{this.parameters[this.parametersCount]=new PHP2Ajax.ParametersPair(name,value);this.parametersCount++;}
PHP2Ajax.clearRequest=function()
{this.parameters=new Object();this.parametersCount=0;}
PHP2Ajax.call=function(functionName)
{this.add(PHP2Ajax.CALL_REQUEST_PARAMETER,functionName);}
PHP2Ajax.execute=function()
{currentObject=this;try
{this.httpRequest=this.createXMLHttp();}
catch(eConnectionError)
{alert('Error creating the connection to the Server!');return false;}
try
{var requestData="1";for(var i in this.parameters)
{var tmpString=new String(this.parameters[i].value);if((tmpString.indexOf('&')!=-1)||(tmpString.indexOf('+')!=-1))
{this.parameters[i].value=encodeURIComponent(tmpString);}
requestData=requestData+'&'+this.parameters[i].name+'='+this.parameters[i].value;}
if(typeof(currentObject.onReadyStateChange)=='function')
{this.httpRequest.onreadystatechange=function()
{currentObject.onReadyStateChange();}}
if(this.requestMethod==PHP2Ajax.REQUEST_METHOD_GET)
{this.httpRequest.open(PHP2Ajax.REQUEST_METHOD_GET,this.server+"?"+requestData,true);this.httpRequest.setRequestHeader('content-type','text/xml');this.httpRequest.send('');}
else
{this.httpRequest.open(PHP2Ajax.REQUEST_METHOD_POST,this.server,true);this.httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.httpRequest.send(requestData);}}
catch(eAjaxRequestError)
{alert('An error has occured calling the external site: '+eAjaxRequestError);return false;}}
PHP2Ajax.setRequestMethod=function(methodName)
{if(methodName==PHP2Ajax.REQUEST_METHOD_GET)
{this.requestMethod=PHP2Ajax.REQUEST_METHOD_GET;}
else
{this.requestMethod=PHP2Ajax.REQUEST_METHOD_POST;}}
PHP2Ajax.setHandler=function(responseHandler)
{this.responseHandler=responseHandler;}
PHP2Ajax.createXMLHttp=function()
{try
{httpRequest=new ActiveXObject('Msxml2.XMLHTTP');}
catch(eClassNotExistsError)
{try
{httpRequest=new ActiveXObject('Microsoft.XMLHTTP');}
catch(eClassNotExistsError1)
{httpRequest=null;}}
if((!httpRequest)&&(typeof(XMLHttpRequest)!=undefined))
{httpRequest=new XMLHttpRequest();}
return httpRequest;}
PHP2Ajax.ParametersPair=function(name,value)
{this.name=name;this.value=value;}
PHP2Ajax.toStringSimple=function(sTracedObject,initTab)
{var tracedObject=((sTracedObject!=null)?sTracedObject:this);var currTab=((initTab!=null)?initTab+'    ':'    ');result="{\n";for(var propertyName in tracedObject)
{if(typeof(tracedObject[propertyName])=='string')
{result+=currTab+"\""+propertyName+"\": \""+tracedObject[propertyName]+"\",\n";}
else if((typeof(tracedObject[propertyName])!='function')&&(typeof(tracedObject[propertyName])=='object'))
{result+=currTab+"\""+propertyName+"\":\n"+currTab+this.toStringSimple(tracedObject[propertyName],currTab)+",\n";}}
result=new String(result);result=result.substr(0,result.length-2)+"\n";result+=((initTab!=null)?initTab:'')+"}";return result;}
PHP2Ajax.trace=function(clear)
{var traceDiv=document.getElementById('mainTraceDiv');if(traceDiv==null)
{document.body.insertAdjacentHTML("beforeEnd",'<center><div id="mainTraceDiv" style="width: 800px; background-color: #fff; text-align: left;"></div></center>');traceDiv=document.getElementById('mainTraceDiv');}
if(clear)
{traceDiv.innerHTML="<pre>"+PHP2Ajax.toStringSimple(this)+"</pre>";}
else
{traceDiv.innerHTML+="<pre>"+PHP2Ajax.toStringSimple(this)+"</pre>";}}
PHP2Ajax.XMLRequest=function(serverUrl,ID)
{this.id=ID;this.httpRequest=null;this.parameters=new Array();this.parametersCount=0;this.responseHandler=null;this.responseXML=null;this.server=serverUrl;this.setRequestMethod(PHP2Ajax.REQUEST_METHOD_POST);}
PHP2Ajax.XMLRequest.prototype.onReadyStateChange=function()
{if(this.httpRequest.readyState!=PHP2Ajax.READY_STATE_COMPLETE)return;if(this.httpRequest.status==PHP2Ajax.HTTP_STATUS_OK)
{if(typeof(this.httpRequest.responseXML.documentElement)!=undefined)
{this.responseXML=this.httpRequest.responseXML.documentElement;}
else
{XMLDocument=new ActiveXObject("Microsoft.XMLDOM");XMLDocument.loadXML(this.httpRequest.responseText);this.responseXML=XMLDocument.documentElement;}}
else
{alert('The server respond with a bad status code: '+this.httpRequest.status);return false;}
if(typeof(this.responseHandler)=='function')this.responseHandler();return this.responseXML;}
PHP2Ajax.XMLRequest.prototype.getXML=function()
{}
PHP2Ajax.XMLRequest.prototype.getNodes=function(nodeName,idAttribute)
{var nodeData=this.responseXML.getElementsByTagName(nodeName);var result=new PHP2Ajax.RResultArray();for(i=0;i<nodeData.length;i++)
{var currentItem=new PHP2Ajax.RResultObject();for(j=0;j<nodeData[i].attributes.length;j++)
{currentItem[nodeData[i].attributes[j].name]=nodeData[i].attributes[j].value;}
if((nodeData[i].firstChild!=null)&&(nodeData[i].firstChild.data!=null))
{currentItem.text=nodeData[i].firstChild.data;}
else
{currentItem.text=null;}
if((typeof(idAttribute)!=undefined)&&(idAttributeValue=nodeData[i].getAttribute(idAttribute)))
{result.add(idAttributeValue,currentItem);}
else
{result.add(i,currentItem);}}
return result;}
PHP2Ajax.XMLRequest.prototype.getUNodeText=function(nodeName,xmlDocElement)
{nodesArray=(xmlDocElement)?xmlDocElement:this.responseXML.getElementsByTagName(nodeName);if((nodesArray!=null)&&(nodesArray[0]!=null)&&(nodesArray[0].firstChild!=null)&&(nodesArray[0].firstChild.data!=null))
{return nodesArray[0].firstChild.data;}
else
{return null;}}
PHP2Ajax.XMLRequest.prototype.add=PHP2Ajax.add;PHP2Ajax.XMLRequest.prototype.call=PHP2Ajax.call;PHP2Ajax.XMLRequest.prototype.clear=PHP2Ajax.clearRequest;PHP2Ajax.XMLRequest.prototype.trace=PHP2Ajax.trace;PHP2Ajax.XMLRequest.prototype.createXMLHttp=PHP2Ajax.createXMLHttp;PHP2Ajax.XMLRequest.prototype.setRequestMethod=PHP2Ajax.setRequestMethod;PHP2Ajax.XMLRequest.prototype.setHandler=PHP2Ajax.setHandler;PHP2Ajax.XMLRequest.prototype.execute=PHP2Ajax.execute;PHP2Ajax.JSONRequest=function(serverUrl,ID)
{this.id=ID;this.httpRequest=null;this.parameters=new Array();this.parametersCount=0;this.responseHandler=null;this.response=null;this.reportAJAXErrors=true;this.server=serverUrl;this.setRequestMethod(PHP2Ajax.REQUEST_METHOD_POST);}
PHP2Ajax.JSONRequest.prototype.onReadyStateChange=function()
{if(this.httpRequest.readyState!=PHP2Ajax.READY_STATE_COMPLETE)return;if(this.httpRequest.status==PHP2Ajax.HTTP_STATUS_OK)
{try
{this.response=eval("("+this.httpRequest.responseText+")");}
catch(eEvalException)
{var errorEvalData=new String(this.httpRequest.responseText);this.response=new Object();this.response.Error=new Object({'Code':1501,'Message':''});this.response.Error.Message="Server returns Invalid Request! Please contact to the System Administrator. \n <br /> <br /> ";this.response.Error.Message+="Response trace: <div style=\"padding: 7px 3px; font-weight: normal;\">"+errorEvalData.substr(0,2047)+((errorEvalData.length>2048)?' ...':'')+"</div>";}
if(this.response.Error.Code>0)
{if(typeof(this.onResponseError)=='function')this.onResponseError();return false;}
this.response.toStringSimple=PHP2Ajax.toStringSimple;this.response.trace=PHP2Ajax.trace;}
else
{if(typeof(this.onHTTPError)=='function')this.onHTTPError();return false;}
if(typeof(this.responseHandler)=='function')this.responseHandler();return this.response;}
PHP2Ajax.JSONRequest.prototype.onResponseError=function()
{this.alert=new PHP2Controls.Alert("Error: "+this.response.Error.Code+". "+this.response.Error.Message);}
PHP2Ajax.JSONRequest.prototype.prepareJSONData=function(sJSONObject)
{var tmpJSONObject=sJSONObject;for(var propertyName in sJSONObject)
{if(typeof(sJSONObject[propertyName])=='string')
{tmpJSONObject[propertyName]=String(sJSONObject[propertyName]).replace(/\{\{rn\}\}/g,"\r\n");tmpJSONObject[propertyName]=String(tmpJSONObject[propertyName]).replace(/\{\{n\}\}/g,"\n");}
else if((typeof(sJSONObject[propertyName])!='function')&&(typeof(sJSONObject[propertyName])=='object'))
{tmpJSONObject[propertyName]=this.prepareJSONData(sJSONObject[propertyName]);}}
return tmpJSONObject;}
PHP2Ajax.JSONRequest.prototype.getResponse=function()
{return this.response;}
PHP2Ajax.JSONRequest.prototype.setPageCallBackHandler=function(callbackHandler)
{this.add(PHP2Ajax.CALLBACK_HANDLER_PARAMETER,callbackHandler);}
PHP2Ajax.JSONRequest.prototype.add=PHP2Ajax.add;PHP2Ajax.JSONRequest.prototype.call=PHP2Ajax.call;PHP2Ajax.JSONRequest.prototype.clear=PHP2Ajax.clearRequest;PHP2Ajax.JSONRequest.prototype.trace=PHP2Ajax.trace;PHP2Ajax.JSONRequest.prototype.createXMLHttp=PHP2Ajax.createXMLHttp;PHP2Ajax.JSONRequest.prototype.setRequestMethod=PHP2Ajax.setRequestMethod;PHP2Ajax.JSONRequest.prototype.setHandler=PHP2Ajax.setHandler;PHP2Ajax.JSONRequest.prototype.execute=PHP2Ajax.execute;PHP2Ajax.RResultArray=function()
{this.data=new Array();}
PHP2Ajax.RResultArray.prototype.add=function(key,value)
{this.data[key]=value;}
PHP2Ajax.RResultArray.prototype.getData=function()
{return this.data;}
PHP2Ajax.RResultArray.prototype.toStringSimple=PHP2Ajax.toStringSimple;PHP2Ajax.RResultObject=function()
{}
PHP2Ajax.RResultObject.prototype.toStringSimple=PHP2Ajax.toStringSimple;
PHP2Ajax.LOADER_TYPE_INLINE='inline';PHP2Ajax.LOADER_TYPE_OVERPAGE='overpage';PHP2Ajax.LoadManager=function(id,flatElementId,loaderType,sRootUrl)
{this.id=((id)?id:'ajaxLoadManager');if(flatElementId)this.flatElement=document.getElementById(flatElementId);this.setLoaderType(loaderType);this.sRootUrl=((sRootUrl)?sRootUrl:((skinUrl)?skinUrl:'/'));if(!document.getElementById(this.id)){preloaderHTML='<table id="'+this.id+'" class="ajaxLoader" style="padding-left: 10px; position: absolute; display: none;" border="0" cellpadding="0" cellspacing="0">';preloaderHTML+='<tr><td id="'+this.id+'_innerCell" valign="middle" align="center">';preloaderHTML+='<img src="'+this.sRootUrl+'images/ajax/ajax-loader.gif" height="20" width="20" /> <b><span id="'+this.id+'Caption">Loading ...</span></b>';preloaderHTML+='</td></tr>';preloaderHTML+='</table>';document.body.insertAdjacentHTML("afterbegin",preloaderHTML);}
this.loader=document.getElementById(this.id);this.captionElement=document.getElementById(this.id+'Caption');this.inlineWidth=100;this.inlineHeight=25;this.opacity=0.30;}
PHP2Ajax.LoadManager.prototype.setLoaderType=function(loaderType)
{if(loaderType&&(loaderType==PHP2Ajax.LOADER_TYPE_OVERPAGE))
{this.loaderType=PHP2Ajax.LOADER_TYPE_OVERPAGE;}
else
{this.loaderType=PHP2Ajax.LOADER_TYPE_INLINE;}}
PHP2Ajax.LoadManager.prototype.setCaption=function(caption)
{this.caption=caption;this.captionElement.innerHTML=this.caption;}
PHP2Ajax.LoadManager.prototype.setClassName=function(className)
{this.loader.className=className;}
PHP2Ajax.LoadManager.prototype.show=function()
{if(this.loaderType==PHP2Ajax.LOADER_TYPE_INLINE)
{var posX=HTMLElement.findPosX(this.flatElement)+this.flatElement.offsetWidth+10;var posY=HTMLElement.findPosY(this.flatElement);if(posX+this.inlineWidth>=HTMLElement.getBrowserWidth())
{posX=posX-this.flatElement.offsetWidth-20-this.inlineWidth;}
this.setLoaderSize(posX,posY,this.inlineWidth,this.inlineHeight);this.loader.style.opacity=null;this.loader.style.MozOpacity=null;if(this.loader.style.filter)this.loader.style.filter=null;}
else
{var posX=HTMLElement.findPosX(this.flatElement);var posY=HTMLElement.findPosY(this.flatElement);var width=this.flatElement.offsetWidth;var height=this.flatElement.offsetHeight;this.setLoaderSize(posX,posY,width,height);this.loader.style.opacity=this.opacity;this.loader.style.MozOpacity=this.opacity;if(this.loader.style.filter!=null)this.loader.style.filter="alpha(opacity="+(this.opacity*100)+")";}
this.loader.style.display='inline';}
PHP2Ajax.LoadManager.prototype.setLoaderSize=function(posX,posY,width,height)
{this.loader.style.left=posX+"px";this.loader.style.top=posY+"px";this.loader.style.padding=0;this.loader.style.width=width+"px";this.loader.style.height=height+"px";innerCell=document.getElementById(this.id+"_innerCell");if(innerCell!=null)
{innerCell.style.left=posX+"px";innerCell.style.top=posY+"px";innerCell.style.width=width+"px";innerCell.style.height=height+"px";}}
PHP2Ajax.LoadManager.prototype.hide=function()
{if(typeof(this.loader)!="undefined")this.loader.style.display='none';}
PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_DATA='DATA';PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_HTML='HTML';PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_BOTH='BOTH';PHP2Ajax.AJAXPAGE_PARENT_ONLOAD_EVENT_PARAMETER='__setParentOnLoadEvent';PHP2Ajax.AJAXPageBase=function(ajaxPageId,url,responseType,ajaxPageContainerId)
{this.id=ajaxPageId;this.setPageContainer(((ajaxPageContainerId!=null)?ajaxPageContainerId:this.id));this.all=new Object();this.setUrl(url);this.setResponseType(responseType);this.preLoader=new PHP2Ajax.LoadManager('ajaxPreLoader'+"_"+this.id,this.pageContainerId,PHP2Ajax.LOADER_TYPE_OVERPAGE);this.isParentPageOnLoad=false;this.__semaphoreOnCallStarted=false;}
PHP2Ajax.AJAXPageBase.prototype.setUrl=function(url)
{this.url=url;}
PHP2Ajax.AJAXPageBase.prototype.setResponseType=function(responseType)
{this.responseType=responseType;}
PHP2Ajax.AJAXPageBase.prototype.setPageContainer=function(ajaxPageContainerId)
{this.pageContainerId=ajaxPageContainerId;this.currentPage=document.getElementById(this.pageContainerId);}
PHP2Ajax.AJAXPageBase.prototype.load=function(postData,handler,callBackHandler)
{if(postData==null)var postData=new Object();postData=this.getPostData(postData);this.call(handler,postData,callBackHandler);this.preLoader.show();}
PHP2Ajax.AJAXPageBase.prototype.call=function(handler,postData,callBackHandler)
{if(this.serverResponse==null)this.serverResponse=new PHP2Ajax.JSONRequest(this.url);this.serverResponse.clear();if(handler)this.serverResponse.call(handler);for(postItemName in postData){this.serverResponse.add(postItemName,postData[postItemName]);}
if(this.isParentPageOnLoad)
{this.isParentPageOnLoad=false;this.serverResponse.add(PHP2Ajax.AJAXPAGE_PARENT_ONLOAD_EVENT_PARAMETER,'true');}
if(callBackHandler!=null)this.serverResponse.setPageCallBackHandler(callBackHandler);this.serverResponse.setHandler(this.onLoadCaller);this.serverResponse.onResponseError=this.onResponseErrorCaller;this.serverResponse.onHTTPError=this.onHTTPError;this.serverResponse.currentObject=this;this.serverResponse.execute();if(this.__semaphoreOnCallStarted&&(typeof(this.onConcurrentCallStarted)=="function"))this.onConcurrentCallStarted();this.__semaphoreOnCallStarted=true;}
PHP2Ajax.AJAXPageBase.prototype.onLoadCaller=function()
{this.currentObject.__semaphoreOnCallStarted=false;this.currentObject.onResponseLoad();if(typeof(this.currentObject.onLoad)=="function")this.currentObject.onLoad();}
PHP2Ajax.AJAXPageBase.prototype.onResponseErrorCaller=function()
{this.currentObject.onResponseError();}
PHP2Ajax.AJAXPageBase.prototype.onResponseLoad=function()
{var serverResponseData=this.serverResponse.getResponse();var response=serverResponseData.Response;var errorDebugInfo=(serverResponseData.PHPTMPDebug!=null)?serverResponseData.PHPTMPDebug:'';if(typeof(serverResponseData.PHPAJAXDebugInfo)!=undefined)this.loadDebugInfo(serverResponseData.PHPAJAXDebugInfo,errorDebugInfo);if(serverResponseData.ResponseType==null)serverResponseData.ResponseType=PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_HTML;if(((serverResponseData.ResponseType==PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_HTML)||(serverResponseData.ResponseType==PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_BOTH))&&(response.HTMLContent!=null))
{this.loadHTML(response.HTMLContent);}
if(((serverResponseData.ResponseType==PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_DATA)||(serverResponseData.ResponseType==PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_BOTH))&&(response.ControlsData!=null))
{this.loadControlsData(response.ControlsData);}
if((response.ClientHandler!=null)&&(typeof(this[response.ClientHandler])=="function"))this[response.ClientHandler]();if(serverResponseData.ClientMessages.Count>0)this.showClientMessages(serverResponseData.ClientMessages.Messages);this.loadJSObjectsList(response.JSObjectsList);this.preLoader.hide();}
PHP2Ajax.AJAXPageBase.prototype.loadJSObjectsList=function(jsObjectslist)
{try
{var currentObject=this;var notLoadedObjects=new Object();var notLoadedObjectsCount=0;if((jsObjectslist!=null)&&(typeof(jsObjectslist)=="object"))
{for(objectIndex in jsObjectslist)
{var jsObjectName=jsObjectslist[objectIndex];var evalResult=true;var evalString="if (typeof("+jsObjectName+") != 'undefined') { "+jsObjectName+".owner = currentObject; } else {evalResult = false;}";eval(evalString);if(!evalResult)
{notLoadedObjects[notLoadedObjectsCount++]=jsObjectName;}}
if(notLoadedObjectsCount>0)
{var iterativeLoader=function()
{currentObject.loadJSObjectsList(notLoadedObjects);}
var timerId=setTimeout(iterativeLoader,300);}}}
catch(eLoadException)
{alert(eLoadException);}}
PHP2Ajax.AJAXPageBase.prototype.showClientMessages=function(clientMessagesList)
{this.pageMessages=new PHP2Controls.MessageBox();for(messageNum in clientMessagesList)
{this.pageMessages.add(clientMessagesList[messageNum].Message);}
this.pageMessages.show();}
PHP2Ajax.AJAXPageBase.prototype.loadHTML=function(innerHTMLCode)
{this.currentPage.innerHTML='';this.currentPage.insertAdjacentHTML("afterbegin",innerHTMLCode);this.all=new Object();this.addControlsByTagName('input');this.addControlsByTagName('select');this.addControlsByTagName('textarea');if(document.all!=null)
{newJavaScripts=this.currentPage.getElementsByTagName('script');headElement=document.getElementsByTagName('head')[0];for(i=0;i<newJavaScripts.length;i++)
{currentScriptId=this.id+"_JS_"+i;var currentScript=document.getElementById(currentScriptId);if(currentScript!=null)headElement.removeChild(currentScript);var script=document.createElement('script');script.type='text/javascript';script.id=currentScriptId;script.defer=true;script.src=newJavaScripts[i].src;if(newJavaScripts[i].innerHTML)script.text=newJavaScripts[i].innerHTML;headElement.appendChild(script);}}}
PHP2Ajax.AJAXPageBase.prototype.loadControlsData=function(controlsData)
{for(controlId in controlsData)
{if(typeof(this.all[controlId])!="undefined")
{for(attributeName in controlsData[controlId])this.all[controlId][attributeName]=controlsData[controlId][attributeName];}}}
PHP2Ajax.AJAXPageBase.prototype.onLoad=function()
{}
PHP2Ajax.AJAXPageBase.prototype.setParentOnLoadEvent=function()
{this.isParentPageOnLoad=true;}
PHP2Ajax.AJAXPageBase.prototype.onResponseError=function()
{this.alert=new PHP2Controls.Alert("Error: "+this.serverResponse.response.Error.Code+". "+this.serverResponse.response.Error.Message);this.preLoader.hide();}
PHP2Ajax.AJAXPageBase.prototype.onHTTPError=function()
{this.currentObject.alert=new PHP2Controls.Alert("Error: 'The server respond with a bad status code: "+this.httpRequest.status);this.currentObject.preLoader.hide();}
PHP2Ajax.AJAXPageBase.prototype.onConcurrentCallStarted=function()
{}
PHP2Ajax.AJAXPageBase.prototype.addControl=function(controlObject)
{if(controlObject!=null)
{var controlId=(controlObject.id?controlObject.id:controlObject.name);this.all[controlId]=controlObject;this.all[controlId].owner=this;this.all[controlId].getActiveValue=function()
{if((this.tagName.toLowerCase()=='input')&&(this.type.toLowerCase()=='checkbox'))return(this.checked?'on':'');if(this.value!=null)return this.value;if(this.text!=null)return this.text;}}}
PHP2Ajax.AJAXPageBase.prototype.addControlsByTagName=function(tagName)
{var elementsList=this.currentPage.getElementsByTagName(tagName);for(i=0;i<elementsList.length;i++)
{this.addControl(elementsList[i]);if((tagName.toLowerCase()=='input')&&(elementsList[i].type.toLowerCase()=='button'))
{if(elementsList[i].onclick==null)elementsList[i].onclick=this.onAJAXButtonClick;}}}
PHP2Ajax.AJAXPageBase.prototype.getPostData=function(postData)
{if(postData==null)var postData=new Object();for(controlId in this.all)
{if((this.all[controlId].tagName.toLowerCase()=='input')&&(this.all[controlId].type.toLowerCase()=='button'))
{}
else if((this.all[controlId].tagName.toLowerCase()=='input')&&(this.all[controlId].type.toLowerCase()=='radio'))
{if((this.all[controlId].checked))this.addActiveValue(postData,controlId);}
else
{this.addActiveValue(postData,controlId);}}
return postData;}
PHP2Ajax.AJAXPageBase.prototype.addActiveValue=function(postData,controlId)
{if(typeof(this.all[controlId].name)!="undefined")
{postData[this.all[controlId].name]=this.all[controlId].getActiveValue();}
else
{postData[controlId]=this.all[controlId].getActiveValue();}}
PHP2Ajax.AJAXPageBase.prototype.getActiveValue=function()
{if(this.value!=null)
{return this.value;}
return'';}
PHP2Ajax.AJAXPageBase.prototype.onAJAXButtonClick=function()
{var postData=new Object();postData[this.name]=this.value;this.owner.load(postData);}
PHP2Ajax.AJAXPageBase.prototype.loadDebugInfo=function(debugInfo,errorsDebugInfo)
{var debugBlock=document.getElementById('_debugArea');if(debugBlock==null)debugBlock=document.getElementById('ajaxDebugInfoBlock');if(debugBlock==null)
{document.body.insertAdjacentHTML("beforeEnd",'<div id="ajaxDebugInfoBlock"></div>');debugBlock=document.getElementById('ajaxDebugInfoBlock');}
if(debugBlock!=null)debugBlock.innerHTML=debugInfo;if(errorsDebugInfo)
{var errorDebugBlock=document.getElementById('PHPTMPDebug');if(errorDebugBlock!=null)errorDebugBlock.innerHTML=errorsDebugInfo;}
else
{if(document.getElementById('PHPTMPDebugBlock')!=null)document.getElementById('PHPTMPDebugBlock').style.display='none';}}
function AjaxRequest(serverUrl,ID)
{this.parms=new Array();this.parmsIndex=0;this.server=serverUrl;this.requestMethod='GET';this.id=ID;this.handler=null;this.httpRequest=null;this.resultXML=null;var currentObject=this;this.execute=function()
{try
{this.httpRequest=this.createXMLHttp();var httpRequest=this.httpRequest;}
catch(e)
{alert('Error creating the connection!');return;}
try
{var txt="?1";for(var i in this.parms)
{txt=txt+'&'+this.parms[i].name+'='+this.parms[i].value;}
if(this.requestMethod=='GET')
{httpRequest.open("GET",this.server+txt,true);httpRequest.setRequestHeader('content-type','text/xml');httpRequest.onreadystatechange=this.AJAXRequest_onReadyStateChange;httpRequest.send('');}
else
{httpRequest.open("POST",this.server,true);httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");httpRequest.onreadystatechange=this.AJAXRequest_onReadyStateChange;httpRequest.send(txt);}}
catch(e)
{alert('An error has occured calling the external site: '+e);return false;}}
this.AJAXRequest_onReadyStateChange=function()
{if(httpRequest.readyState!=4)return;if(httpRequest.status==200)
{if(typeof(httpRequest.responseXML.documentElement)!='undefined')
{resultXML=httpRequest.responseXML.documentElement;}
else
{XMLDocument=new ActiveXObject("Msxml2.DOMDocument");XMLDocument.loadXML(httpRequest.responseText);resultXML=XMLDocument;}}
else
{alert('The server respond with a bad status code: '+httpRequest.status);return false;}
currentObject.resultXML=resultXML;if(typeof(handler)=='function')handler(currentObject);return resultXML;}
this.setHandler=function(handlerName)
{handler=handlerName;}
this.setRequestMethod=function(methodName)
{if(methodName=='POST')
{this.requestMethod='POST';}
else
{this.requestMethod='GET';}}
this.add=function(name,value)
{this.parms[this.parmsIndex]=new pair(name,value);this.parmsIndex++;}
this.createXMLHttp=function()
{try
{httpRequest=new ActiveXObject('Msxml2.XMLHTTP');}
catch(e)
{try
{httpRequest=new ActiveXObject('Microsoft.XMLHTTP');}
catch(ee)
{httpRequest=null;}}
if(!httpRequest&&typeof XMLHttpRequest!='undefined')
{httpRequest=new XMLHttpRequest();}
return httpRequest;}}
function pair(name,value)
{this.name=name;this.value=value;}
PHP2Ajax.AJAXTabManagerPageStruct=function(pageId,wsUrl,pageAJAXClassName,pageAJAXClassUrl)
{this.id=pageId;this.wsUrl=wsUrl;this.className=((pageAJAXClassName!=null)?pageAJAXClassName:'PHP2Ajax.AJAXPageBase');this.classUrl=((pageAJAXClassUrl!=null)?pageAJAXClassUrl:'/javascript/php2/ajaxpage.js');}
PHP2Ajax.AJAXTabManager=function(objectId,contentPanelId)
{this.id=objectId;this.contentPanelId=((contentPanelId!=null)?contentPanelId:this.id+"_managerContent");this.contentPanel=document.getElementById(this.contentPanelId);this._pagesList=new Object();this._pagesInfo=new Object();this._tabsList=new Array();this._tabObjects=new Object();this._loadedJSClassesList=new Object();this.currentPage=null;this.currentTab=null;this.preLoader=new PHP2Ajax.LoadManager(this.id+"_preLoader",this.controlsPrefix+"txtOutputHTMLPath",PHP2Ajax.LOADER_TYPE_INLINE);this.saveDataCaption="Saving data ...";this.loadDataCaption="Loading data ...";this.passiveTabClassName='tabCell';this.activeTabClassName='tabCellActive';}
PHP2Ajax.AJAXTabManager.prototype.setSite=function(siteId)
{this._siteId=siteId;}
PHP2Ajax.AJAXTabManager.prototype.addTab=function(tabId,apAjaxPageInfo)
{var currentObject=this;var tabId=tabId;this._tabsList.push(tabId);this._tabObjects[tabId]=document.getElementById(tabId);this._tabObjects[tabId].onclick=function(){currentObject.openTab(tabId);};this._pagesInfo[tabId]=apAjaxPageInfo;this._pagesList[tabId]=this.createAJAXPage(apAjaxPageInfo);this._pagesList[tabId].owner=this;}
PHP2Ajax.AJAXTabManager.prototype.loadAJAXPage=function(apAjaxPageInfo)
{if(typeof(this._loadedJSClassesList[apAjaxPageInfo.className])=="undefined")
{var script=document.createElement('script');script.type='text/javascript';script.id=apAjaxPageInfo.className;script.defer=true;script.src=apAjaxPageInfo.classUrl;document.getElementsByTagName('head')[0].appendChild(script);this._loadedJSClassesList[apAjaxPageInfo.className]=true;}
return true;}
PHP2Ajax.AJAXTabManager.prototype.createAJAXPage=function(apAjaxPageInfo)
{eval("var ajaxPageObject = new "+apAjaxPageInfo.className+"('"+apAjaxPageInfo.id+"', '"+apAjaxPageInfo.wsUrl+"', '"+PHP2Ajax.AJAXPAGE_RESPONSE_TYPE_BOTH+"', '"+this.contentPanelId+"');");return ajaxPageObject;}
PHP2Ajax.AJAXTabManager.prototype.openTab=function(tabId)
{var tabId=tabId;if(this.currentTab==tabId)
{return true;}
else if(this.currentTab!=null)
{var currentObject=this;this.onTabUnload(this.currentTab);var previousPage=this._pagesList[this.currentTab];previousPage.preLoader.setCaption(this.saveDataCaption);previousPage.preLoader.setClassName('ajaxSaveLoader');previousPage.onLoad=function()
{this.preLoader.hide();var serverResponseData=this.serverResponse.getResponse();if((typeof(serverResponseData.SaveStatus)=="undefined")||(serverResponseData.SaveStatus))
{currentObject.loadTab(tabId);}};previousPage.load((new Object({'id':this._siteId})),'saveSiteData');}
else
{this.loadTab(tabId);}}
PHP2Ajax.AJAXTabManager.prototype.loadTab=function(tabId)
{var currentObject=this;if(this.currentTab)this._tabObjects[this.currentTab].className=this.passiveTabClassName;this._tabObjects[tabId].className=this.activeTabClassName;this.currentTab=tabId;this.currentPage=this._pagesList[tabId];this.currentPage.preLoader.setClassName('ajaxLoader');this.currentPage.preLoader.setCaption(this.loadDataCaption);this.currentPage.onLoad=function(){currentObject.onTabLoad(tabId);currentObject.saveActiveTab(tabId);};this.currentPage.call(null,(new Object({'id':this._siteId,'__callReload':'true'})));this.currentPage.preLoader.show();}
PHP2Ajax.AJAXTabManager.prototype.loadDefaultTab=function()
{var tmpActiveTab=this.searchActiveTab();if(typeof(this._pagesInfo[tmpActiveTab])!="undefined")
{this.loadTab(tmpActiveTab);return true;}
else if(typeof(this._tabsList[0])!="undefined")
{this.loadTab(this._tabsList[0]);return true;}
return false;}
PHP2Ajax.AJAXTabManager.prototype.onTabUnload=function(tabId)
{}
PHP2Ajax.AJAXTabManager.prototype.onTabLoad=function(tabId)
{if(typeof(Newsfinity.HighLightMode)!="undefined")
{var newsfinityHighLighter=new Newsfinity.HighLightMode('tfHighLighted');newsfinityHighLighter.setHightLightMode();}}
PHP2Ajax.AJAXTabManager.prototype.saveActiveTab=function(tabId)
{this.setCookie(this.id+"_activetab",tabId);}
PHP2Ajax.AJAXTabManager.prototype.searchActiveTab=function()
{return this.getCookie(this.id+"_activetab");}
PHP2Ajax.AJAXTabManager.prototype.setCookie=function(name,value,expires,path,domain,secure)
{var curCookie=name+"="+escape(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=curCookie;}
PHP2Ajax.AJAXTabManager.prototype.getCookie=function(name)
{var prefix=name+"=";var cookieStartIndex=document.cookie.indexOf(prefix);if(cookieStartIndex==-1)return false;var cookieEndIndex=document.cookie.indexOf(";",cookieStartIndex+prefix.length);if(cookieEndIndex==-1)cookieEndIndex=document.cookie.length;return unescape(document.cookie.substring(cookieStartIndex+prefix.length,cookieEndIndex));}
if(typeof(PHP2Controls)=='undefined')PHP2Controls=new Object();PHP2Controls.hWindow=function(wHandle,wTitle,wCSSBaseClass,wContentElement,canClose)
{this.wHandle=((wHandle)?wHandle:'aWindow');this.wTitleCaption=((wTitle)?wTitle:'System Messages');this.wCSSBaseClass=((wCSSBaseClass)?wCSSBaseClass:'aWindow');this.wContentElement=((wContentElement)?wContentElement:null);this.canClose=((canClose)?canClose:true);}
PHP2Controls.AWindow=function(hWindow)
{this.id=hWindow.wHandle;this.wHandle=hWindow.wHandle;this.wTitleCaption=hWindow.wTitleCaption;this.wCSSBaseClass=hWindow.wCSSBaseClass;this.wContentElement=hWindow.wContentElement;this.canClose=hWindow.canClose;if(!document.getElementById(this.id))
{createWindowHtmlCode='<div id="'+this.id+'" class="aWindow"><div id="'+this.id+'_wHeader" class="wHeader"><span id="'+this.id+'_wTitle" class="wHText">Window Title</span><span class="rHButtons"><div id="'+this.id+'_wBtnHide" class="wBtnHide">&nbsp;</div><div id="'+this.id+'_wBtnClose" class="wBtnClose">&nbsp;</div></span></div><div id="'+this.id+'_wBody" class="wBody"></div></div>';if($.browser.safari)
{var range=document.createRange();range.setStartBefore(document.body.firstChild);var docFrag=range.createContextualFragment(createWindowHtmlCode);document.body.insertBefore(docFrag,document.body.firstChild);}
else
{document.body.insertAdjacentHTML("afterBegin",createWindowHtmlCode);}}
this.aWindow=document.getElementById(this.id);this.wHeader=document.getElementById(this.id+'_wHeader');this.wTitle=document.getElementById(this.id+'_wTitle');this.wBtnHide=document.getElementById(this.id+'_wBtnHide');this.wBtnClose=document.getElementById(this.id+'_wBtnClose');this.wBody=document.getElementById(this.id+'_wBody');this.aWindow.className=this.wCSSBaseClass;this.wBtnClose.currentWinObject=this;this.wBtnHide.currentWinObject=this;this.wHeader.currentWinObject=this;this.wBtnClose.onclick=function(){this.currentWinObject.close();};this.wBtnHide.onclick=function(){this.currentWinObject.hide();};this.wHeader.ondblclick=function(){this.currentWinObject.hide();};this.wTitle.innerHTML=this.wTitleCaption?this.wTitleCaption:'System Messages';if(this.wContentElement)this.attachContent(this.wContentElement);this.protectFrameId=null;}
PHP2Controls.AWindow.prototype.close=function()
{this.aWindow.style.display='none';if(this.protectFrameId&&(document.all.item(this.protectFrameId)!=null))document.all.item(this.protectFrameId).style.display='none';HTMLWindow.unsetDraggable(this.aWindow,this.wHeader);}
PHP2Controls.AWindow.prototype.display=function()
{this.aWindow.style.display='inline';this.protectFrameId=HTMLElement.protectIEDiv(this.id);}
PHP2Controls.AWindow.prototype.hide=function()
{if(typeof(this.wBody)==undefined)return true;headerHeight=this.wHeader.offsetHeight;this.wBody.style.display='none';this.aWindow.oldHeight=this.aWindow.height;this.wHeader.height=headerHeight+'px';this.aWindow.height=headerHeight+'px';this.wBtnHide.onclick=function(){this.currentWinObject.show()};this.wHeader.ondblclick=function(){this.currentWinObject.show();};this.protectFrameId=HTMLElement.protectIEDiv(this.id);}
PHP2Controls.AWindow.prototype.show=function()
{if(typeof(this.wBody)==undefined)return true;if(typeof(this.aWindow.oldHeight)!="undefined")this.aWindow.height=this.aWindow.oldHeight;this.wBody.style.display='';this.wBtnHide.onclick=function(){this.currentWinObject.hide()};this.wHeader.ondblclick=function(){this.currentWinObject.hide();};this.protectFrameId=HTMLElement.protectIEDiv(this.id);}
PHP2Controls.AWindow.prototype.initScreenPosition=function()
{var leftPos=(HTMLElement.getBrowserWidth()-HTMLElement.getWidth(this.id))/2;var topPos=(HTMLElement.getBrowserHeight()/2)-200;this.aWindow.style.left=((leftPos>0)?leftPos:'')+"px";this.aWindow.style.top=((topPos>0)?topPos:'')+"px";this.protectFrameId=HTMLElement.protectIEDiv(this.id);}
PHP2Controls.AWindow.prototype.attachContent=function(contentsNodeId)
{var contentsNode=document.getElementById(contentsNodeId);if(contentsNode.parentNode==this.wBody)return true;this.wBody.innerHTML='';this.wBody.style.width=contentsNode.offsetWidth+'px';this.wBody.style.height=contentsNode.offsetHeight+'px';this.aWindow.style.height=this.wBody.offsetHeight+this.wHeader.offsetHeight+'px';this.aWindow.style.width=this.wBody.offsetWidth+'px';this.aWindow.style.left=HTMLElement.findPosX(contentsNode)+'px';this.aWindow.style.top=HTMLElement.findPosY(contentsNode)+'px';contentsNode.style.padding=0;contentsNode.style.margin=0;if(typeof(document.importNode)=="function")
{var tmpNode=document.importNode(contentsNode,true);this.wBody.appendChild(tmpNode);}
else
{var nodeHTML=(contentsNode.xml||contentsNode.outerHTML);this.wBody.innerHTML=nodeHTML;}
contentsNode.parentNode.removeChild(contentsNode);}
PHP2Controls.AWindow.prototype.onMove=function()
{this.protectFrameId=HTMLElement.protectIEDiv(this.id);}
PHP2Controls.AWindow.prototype.initDragAndDrop=function()
{this.aWindow.onMove=this.onMove;HTMLWindow.setDraggable(this.aWindow,this.wHeader,null,false);}
PHP2Controls.Alert=function(alertMessage)
{this.id='pageSystemAlert';this.hWindow=new PHP2Controls.hWindow(this.id,'System Messages','aAlertWindow',null,true);this.aWindowObject=new PHP2Controls.AWindow(this.hWindow);var alertBody='<div id="'+this.id+'_wAlertBody" class="wAlertBody"><div id="'+this.id+'_wAlertMessageBody" class="wAlertMessageBody">'+alertMessage+'</div><div class="wAlertFooter"><center><input id="'+this.id+'_wBtnAClose" type="button" class="button" value="Ok" /></center></div></div>';this.aWindowObject.wBody.innerHTML=alertBody;this.aWindowObject.wHeader.style.cursor='move';this.aWindowObject.display();this.aWindowObject.show();this.wBtnAClose=document.getElementById(this.id+'_wBtnAClose');this.wBtnAClose.currentWinObject=this.aWindowObject;this.wBtnAClose.onclick=function(){this.currentWinObject.close()};this.aWindowObject.initScreenPosition();this.aWindowObject.initDragAndDrop();}
PHP2Controls.MessageBox=function()
{this.id='pageSystemMessageBox';this.hWindow=new PHP2Controls.hWindow(this.id,'System Messages','aMessageBoxWindow',null,true);this.aWindowObject=new PHP2Controls.AWindow(this.hWindow);this.aWindowObject.wHeader.style.cursor='move';this.messages=new Array();}
PHP2Controls.MessageBox.prototype.add=function(message)
{this.messages[this.messages.length]=message;}
PHP2Controls.MessageBox.prototype.clear=function(message)
{this.messages=new Array();}
PHP2Controls.MessageBox.prototype.show=function(message)
{messagesCount=this.messages.length;if(messagesCount)
{var messageboxBody='<div id="'+this.id+'_wMessageBoxBody" class="wMessageBoxBody"><div id="'+this.id+'_wMessageBoxMessageBody" class="wMessageBoxMessageBody">';for(i=0;i<messagesCount;i++)
{messageboxBody+='<div class="wMessageBoxMessage"><span class="messageNumber">'+(i+1)+'.</span><span class="messageBody">'+this.messages[i]+'</span></div>';}
messageboxBody+='</div><div class="wMessageBoxFooter"><center><input id="'+this.id+'_wBtnAClose" type="button" class="button" value="Ok" /></center></div></div>';this.aWindowObject.wBody.innerHTML=messageboxBody;this.aWindowObject.display();this.aWindowObject.show();this.wBtnAClose=document.getElementById(this.id+'_wBtnAClose');this.wBtnAClose.currentWinObject=this.aWindowObject;this.wBtnAClose.onclick=function(){this.currentWinObject.close()};this.aWindowObject.initScreenPosition();this.aWindowObject.initDragAndDrop();}}
if(typeof(HTMLElement)=='undefined')var HTMLElement=new Object();HTMLElement.findPosX=function(htmlObject)
{var result=0;if(htmlObject.offsetParent)
{while(htmlObject.offsetParent)
{result+=htmlObject.offsetLeft
htmlObject=htmlObject.offsetParent;}}
else if(htmlObject.x)
{result+=htmlObject.x;}
return result;}
HTMLElement.findPosY=function(htmlObject)
{var result=0;if(htmlObject.offsetParent)
{while(htmlObject.offsetParent)
{result+=htmlObject.offsetTop
htmlObject=htmlObject.offsetParent;}}
else if(htmlObject.y)
{result+=htmlObject.y;}
return result;}
HTMLElement.findPosXById=function(htmlElementId)
{if(htmlObject=document.getElementById(htmlElementId))
{return HTMLElement.findPosX(htmlObject);}
return null;}
HTMLElement.findPosYById=function(htmlElementId)
{if(htmlObject=document.getElementById(htmlElementId))
{return HTMLElement.findPosY(htmlObject);}
return null;}
HTMLElement.getWidth=function(htmlElementId)
{if(htmlObject=document.getElementById(htmlElementId))
{return htmlObject.offsetWidth;}
return null;}
HTMLElement.getHeight=function(htmlElementId)
{if(htmlObject=document.getElementById(htmlElementId))
{return htmlObject.offsetHeight;}
return null;}
HTMLElement.getBrowserWidth=function()
{if(window.innerWidth)
{return window.innerWidth;}
else if(document.documentElement&&document.documentElement.clientWidth!=0)
{return document.documentElement.clientWidth;}
else if(document.body)
{return document.body.clientWidth;}
return 0;}
HTMLElement.getBrowserHeight=function()
{if(window.innerHeight)
{return window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight!=0)
{return document.documentElement.clientHeight;}
else if(document.body)
{return document.body.clientHeight;}
return 0;}
HTMLElement.isSelectsOnThePage=-1;HTMLElement.protectIEDiv=function(objectId)
{var appVer=navigator.appVersion.toLowerCase();var iePos=appVer.indexOf('msie');if(iePos!=-1)
{protectedObject=document.getElementById(objectId);protectedObject.style.zIndex=5;var protectFrameId=objectId+'_ProtectFrame';if(!document.all.item(protectFrameId))
{document.body.insertAdjacentHTML("afterBegin",'<iframe id="'+protectFrameId+'"  style="display: none; left: 0px; position: absolute; top: 0px;" src="javascript:false;" frameBorder="0" scrolling="no"></iframe>');}
if(protectedObject.style.display=="none")
{var frmHover=document.all.item(protectFrameId);frmHover.style.display="none";protectedObject.style.display="none";}
else
{var frmHover=document.all.item(protectFrameId);frmHover.style.left=HTMLElement.findPosX(protectedObject)+"px";frmHover.style.top=HTMLElement.findPosY(protectedObject)+"px";frmHover.style.width=protectedObject.offsetWidth;frmHover.style.height=protectedObject.offsetHeight;frmHover.style.zIndex=protectedObject.style.zIndex-1;frmHover.style.display='';}
return protectFrameId;}
return false;}
if(typeof(HTMLElement.prototype)!='undefined')
{HTMLElement.prototype.insertAdjacentHTML=function(sWhere,sHTML)
{var documentFragment;var documentRange=this.ownerDocument.createRange();switch(String(sWhere).toLowerCase())
{case"beforebegin":documentRange.setStartBefore(this);documentFragment=documentRange.createContextualFragment(sHTML);this.parentNode.insertBefore(documentFragment,this);break;case"afterbegin":documentRange.selectNodeContents(this);documentRange.collapse(true);documentFragment=documentRange.createContextualFragment(sHTML);this.insertBefore(documentFragment,this.firstChild);break;case"beforeend":documentRange.selectNodeContents(this);documentRange.collapse(false);documentFragment=documentRange.createContextualFragment(sHTML);this.appendChild(documentFragment);break;case"afterend":documentRange.setStartAfter(this);documentFragment=documentRange.createContextualFragment(sHTML);this.parentNode.insertBefore(documentFragment,this.nextSibling);break;}};}
var HTMLWindow=new Object();HTMLWindow.draggedObject=null;HTMLWindow.draggedAreaObject=null;HTMLWindow.startDPositionX=0;HTMLWindow.startDPositionY=0;HTMLWindow.maxDocZIndex=50;HTMLWindow.blinkingObject=null;HTMLWindow.setDraggable=function(draggedObject,draggedAreaObject,dragMode,blinkMode,objectOpacity)
{var dragMode=((dragMode==undefined)?true:dragMode);var blinkMode=((blinkMode==undefined)?true:blinkMode);var objectOpacity=((objectOpacity==undefined)?'0.85':objectOpacity);if(String(this.dragMode).toLowerCase()=='switch')
{draggedObject.isDraggable=(((draggedObject.isDraggable==undefined)||(!draggedObject.isDraggable))?true:false);}
else
{draggedObject.isDraggable=dragMode;}
if(HTMLWindow.isDraggable(draggedObject))
{if(draggedObject.style.position!="absolute")
{posX=HTMLElement.findPosX(draggedObject);posY=HTMLElement.findPosY(draggedObject);draggedObject.style.top=posY+'px';draggedObject.style.left=posX+'px';draggedObject.style.filter="alpha(opasity="+(objectOpacity*100)+")";draggedObject.style.MozOpacity=objectOpacity;draggedObject.style.opasity=objectOpacity;draggedObject.style.position="absolute";}
draggedObject.style.zIndex=++HTMLWindow.maxDocZIndex;HTMLWindow.setDragAndDropFunctions(draggedObject,draggedAreaObject);draggedObject.title="To start drag Click on Window header";}
else
{HTMLWindow.unsetDraggable(draggedObject,draggedAreaObject);}
if(blinkMode)
{HTMLWindow.blinkingObject=draggedObject;HTMLWindow.blinkBorder(7,'#ffffff','#000000',draggedObject.style.border);}}
HTMLWindow.blinkBorder=function(blinkTimes,color1,color2,actualBorder)
{if(HTMLWindow.blinkingObject==null)return;if(!blinkTimes)
{HTMLWindow.blinkingObject.style.border=actualBorder;return;}
if(blinkTimes%2)
{HTMLWindow.blinkingObject.style.border="1px solid "+color1;}
else
{HTMLWindow.blinkingObject.style.border="1px solid "+color2;}
setTimeout('HTMLWindow.blinkBorder ('+(blinkTimes-1)+', "'+color1+'", "'+color2+'", "'+actualBorder+'")',100);}
HTMLWindow.unsetDraggable=function(draggedObject,draggedAreaObject)
{HTMLWindow.unsetDragAndDropFunctions(draggedObject,draggedAreaObject);}
HTMLWindow.isDraggable=function(draggedObject)
{return((draggedObject.isDraggable!=undefined)&&(draggedObject.isDraggable));}
HTMLWindow.startDragToObject=function(draggedObject)
{if(HTMLWindow.isDraggable(draggedObject))
{HTMLWindow.draggedObject=draggedObject;}
else if(draggedObject.parentNode!=undefined)
{HTMLWindow.startDragToObject(draggedObject.parentNode);}}
HTMLWindow.startDrag=function(onDragEvent)
{currentEvent=onDragEvent?onDragEvent:event;src=currentEvent.srcElement?currentEvent.srcElement:currentEvent.target;HTMLWindow.startDragToObject(src);if(HTMLWindow.draggedObject!=null)
{HTMLWindow.startDPositionX=(currentEvent.clientX-HTMLWindow.draggedObject.style.left.replace('px',''));HTMLWindow.startDPositionY=(currentEvent.clientY-HTMLWindow.draggedObject.style.top.replace('px',''));HTMLWindow.draggedObject.style.zIndex=++HTMLWindow.maxDocZIndex;}
HTMLWindow.fixMouseSelect();}
HTMLWindow.stopDrag=function(onDragEvent)
{HTMLWindow.draggedObject=null;HTMLWindow.startDPositionX=0;HTMLWindow.startDPositionY=0;}
HTMLWindow.doMove=function(onDragEvent)
{currentEvent=onDragEvent?onDragEvent:event;src=currentEvent.srcElement?currentEvent.srcElement:currentEvent.target;if(HTMLWindow.draggedObject!=null)
{HTMLWindow.draggedObject.style.position="absolute";HTMLWindow.draggedObject.style.top=(currentEvent.clientY-HTMLWindow.startDPositionY)+"px";HTMLWindow.draggedObject.style.left=(currentEvent.clientX-HTMLWindow.startDPositionX)+"px";if(typeof(HTMLWindow.draggedObject.onMove)=='function')HTMLWindow.draggedObject.onMove();HTMLWindow.fixMouseSelect();}}
HTMLWindow.stopDragOnEsc=function(onDragEvent)
{currentEvent=onDragEvent?onDragEvent:event;key=(currentEvent.which==undefined)?currentEvent.keyCode:currentEvent.which;if(key==27)
{HTMLWindow.stopDrag(currentEvent);}}
HTMLWindow.setDragAndDropFunctions=function(draggedObject,draggedAreaObject)
{currentDraggedAreaObject=((draggedAreaObject)?draggedAreaObject:draggedObject);if(document.all!=undefined)
{currentDraggedAreaObject.attachEvent('onmouseup',HTMLWindow.stopDrag);currentDraggedAreaObject.attachEvent('onmousedown',HTMLWindow.startDrag);}
else
{currentDraggedAreaObject.addEventListener('mouseup',HTMLWindow.stopDrag,false);currentDraggedAreaObject.addEventListener('mousedown',HTMLWindow.startDrag,false);}}
HTMLWindow.unsetDragAndDropFunctions=function(draggedObject,draggedAreaObject)
{currentDraggedAreaObject=((draggedAreaObject)?draggedAreaObject:draggedObject);if(document.all!=undefined)
{currentDraggedAreaObject.detachEvent('onmouseup',HTMLWindow.stopDrag);currentDraggedAreaObject.detachEvent('onmousedown',HTMLWindow.startDrag);}
else
{currentDraggedAreaObject.removeEventListener('mouseup',HTMLWindow.stopDrag,false);currentDraggedAreaObject.removeEventListener('mousedown',HTMLWindow.startDrag,false);}}
HTMLWindow.attachDragAndDropEventsToBrowser=function()
{if(document.all!=undefined)
{document.attachEvent('onmousemove',HTMLWindow.doMove);document.attachEvent('onkeypress',HTMLWindow.stopDragOnEsc);}
else
{document.addEventListener('mousemove',HTMLWindow.doMove,false);document.addEventListener('keypress',HTMLWindow.stopDragOnEsc,false);}}
HTMLWindow.mouseSelectProtector=null;HTMLWindow.fixMouseSelect=function()
{if(!HTMLWindow.mouseSelectProtector)
{var createString='<input type="text" id="mouseSelectInputFixx" border="0" style="width: 0px; height: 0px; padding: 0px; margin: 0px; font-size: 0px; border: 0px; display: inline; position: absolute;" />';if(HTMLWindow.draggedObject!=null)
{HTMLWindow.draggedObject.insertAdjacentHTML("afterBegin",createString);}
else
{document.body.insertAdjacentHTML("afterEnd",createString);}
HTMLWindow.mouseSelectProtector=document.getElementById('mouseSelectInputFixx');HTMLWindow.mouseSelectProtector.disabled=true;}
try
{HTMLWindow.mouseSelectProtector.focus();}
catch(e)
{HTMLWindow.mouseSelectProtector.disabled=false;HTMLWindow.mouseSelectProtector.focus();HTMLWindow.mouseSelectProtector.disabled=true}}
HTMLWindow.attachDragAndDropEventsToBrowser();
if(typeof(PHP2Controls)=='undefined')PHP2Controls=new Object();PHP2Controls.LoginManager=function(wsUrl,txtLoginControlId,txtPasswordControlId,btnLoginControlId,ckbRememberMeControlId)
{this.wsUrl=(wsUrl!=null)?wsUrl:'/wsdl/main.ajax.php';this.sRootUrl=((skinUrl)?skinUrl:'/');var loginControlId=((txtLoginControlId!=null)?txtLoginControlId:'txtLogin');var passwordControlId=((txtPasswordControlId!=null)?txtPasswordControlId:'txtPassword');var bloginControlId=((btnLoginControlId!=null)?btnLoginControlId:'btnLogin');var ckbRememberMeControlId=((ckbRememberMeControlId!=null)?ckbRememberMeControlId:'ckbRememberMe');var currentObject=this;this.txtLoginControl=document.getElementById(loginControlId);this.txtPasswordControl=document.getElementById(passwordControlId);this.btnLoginControl=document.getElementById(bloginControlId);this.ckbRememberMeControl=document.getElementById(ckbRememberMeControlId);this.setOnEnterHandler(this.txtLoginControl);this.setOnEnterHandler(this.txtPasswordControl);this.setOnEnterHandler(this.btnLoginControl);this.setOnEnterHandler(this.ckbRememberMeControl);this.btnLoginControl.onclick=function(){currentObject.doLogin();};}
PHP2Controls.LoginManager.prototype.setSRootUrl=function(sRootUrl)
{this.sRootUrl=sRootUrl;}
PHP2Controls.LoginManager.prototype.doLogin=function()
{this.serverResponse=new PHP2Ajax.JSONRequest(this.wsUrl);this.serverResponse.call('doLogin');this.serverResponse.add("txtLogin",this.txtLoginControl.value);this.serverResponse.add("txtPassword",this.txtPasswordControl.value);this.serverResponse.add("ckbRememberMe",this.ckbRememberMeControl.checked?1:0);this.serverResponse.setHandler(this.onLoginChecked);this.serverResponse.onResponseError=this.onResponseError;this.serverResponse.currentObject=this;this.serverResponse.execute();this.showLoading();}
PHP2Controls.LoginManager.prototype.onLoginChecked=function()
{var loginMessage;this.currentObject.hideLoading();if(this.response.Response.LoginError.Code>0)
{loginMessage=document.getElementById('loginMessage');loginMessage.innerHTML=this.response.Response.LoginError.Message;}
else
{if(this.currentObject.ckbRememberMeControl.checked)
{var today=new Date();var expire=new Date();var expDate=3600*24*365;if(parseInt(this.response.Response.CookieExp)>0)expDate=this.response.Response.CookieExp;expire.setTime(today.getTime()+expDate*1000);document.cookie=this.response.Response.CookieName+'='+this.response.Response.CookieValue+';expires='+expire.toGMTString()+';path=/';}
document.location.href=this.response.Response.EnterPoint;}
return true;}
PHP2Controls.LoginManager.prototype.onResponseError=function()
{this.currentObject.alert=new PHP2Controls.Alert("Error: "+this.response.Error.Code+". "+this.response.Error.Message);this.currentObject.hideLoading();}
PHP2Controls.LoginManager.prototype.showLoading=function()
{if(!document.getElementById('loginManagerLoading')){document.body.insertAdjacentHTML("beforeend",'<p id="loginManagerLoading" style="padding-left: 10px; position: absolute; display: none;"><img src="'+this.sRootUrl+'images/ajax/ajax-loader.gif" height="20" width="20" alr="Loading..." /> <b>Login In ...</b></p>');}
this.loginManagerLoadingPanel=document.getElementById('loginManagerLoading');this.loginManagerLoadingPanel.style.left=HTMLElement.findPosX(this.btnLoginControl)+this.btnLoginControl.offsetWidth+10+"px";this.loginManagerLoadingPanel.style.top=HTMLElement.findPosY(this.btnLoginControl)+"px";this.loginManagerLoadingPanel.style.display='inline';}
PHP2Controls.LoginManager.prototype.hideLoading=function()
{if(this.loginManagerLoadingPanel!=null)this.loginManagerLoadingPanel.style.display='none';}
PHP2Controls.LoginManager.prototype.alert=function(errorMessage,errorCode)
{this.currentAlert=new PHP2Controls.Alert(errorMessage);}
PHP2Controls.LoginManager.prototype.setOnEnterHandler=function(htmlObject)
{var currentObject=this;var eventChangedObject=htmlObject;eventChangedObject.defaultOnKeyDownEventHandler=htmlObject.onkeydown;var myEventHandler=function(currentEvent)
{mbEvent=((currentEvent)?currentEvent:event);if(mbEvent.keyCode==13)
{if(currentObject.txtPasswordControl.value&&currentObject.txtLoginControl.value)currentObject.doLogin();}
else
{if(typeof(eventChangedObject.defaultOnKeyDownEventHandler)=='function')eventChangedObject.defaultOnKeyDownEventHandler(event);}}
htmlObject.onkeydown=myEventHandler;}