function CallBackObject(method){var m=String(method).toLowerCase();this.XmlHttp=this.GetHttpObject();if(m=="post")this.Method=false;else this.Method=true;return this;}
CallBackObject.prototype.GetHttpObject1=function()
{var xmlhttp;if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}
return xmlhttp;}
CallBackObject.prototype.GetHttpObject=function()
{if(window.XMLHttpRequest){try{return new XMLHttpRequest();}catch(e){}}else if(window.ActiveXObject){try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e){}
try{return new ActiveXObject('Microsoft.XMLHTTP');}catch(e){}}
return null;}
CallBackObject.prototype.DoCallBack=function(URL,Query,Cache)
{var theData=Query;var theform=document.forms[0];var thePage=URL;var eName='';if(Cache==null){var curDate=new Date();theData+='&time='+curDate.getTime().toString();}
if(this.XmlHttp)
{if(this.XmlHttp.readyState==4||this.XmlHttp.readyState==0)
{var oThis=this;if(this.Method){this.XmlHttp.open('GET',thePage+'?'+theData,true);this.XmlHttp.onreadystatechange=function(){oThis.ReadyStateChange();};this.XmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.XmlHttp.setRequestHeader('Accept-Language','ru, en');this.XmlHttp.setRequestHeader('Accept-Charset','Windows-1251');this.XmlHttp.send(null);}
else{this.XmlHttp.open("POST",thePage,true);this.XmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");this.XmlHttp.setRequestHeader("Content-length",theData.length);this.XmlHttp.setRequestHeader("Connection","close");this.XmlHttp.onreadystatechange=function(){oThis.ReadyStateChange();};this.XmlHttp.send(theData);}}}}
CallBackObject.prototype.DoCallSync=function(URL,Query,Cache)
{try{var curDate=new Date();var theData=Query+'&time='+curDate.getTime().toString();this.XmlHttp.open('GET',URL+'?'+theData,false);this.XmlHttp.send(null);var res=this.XmlHttp.responseXML;if(((this.XmlHttp.status==200)||(this.XmlHttp.status==0))&&res!=undefined)
{this.OnComplete(this.XmlHttp.responseText,this.XmlHttp.responseXML);return true;}
else
{return false;}}
catch(e)
{return false;}}
CallBackObject.prototype.AbortCallBack=function()
{if(this.XmlHttp)
this.XmlHttp.abort();}
CallBackObject.prototype.OnLoading=function()
{}
CallBackObject.prototype.OnLoaded=function()
{}
CallBackObject.prototype.OnInteractive=function()
{}
CallBackObject.prototype.OnComplete=function(responseText,responseXml)
{}
CallBackObject.prototype.OnAbort=function()
{}
CallBackObject.prototype.OnError=function(status,statusText)
{}
CallBackObject.prototype.ReadyStateChange=function()
{if(this.XmlHttp.readyState==1)
{this.OnLoading();}
else if(this.XmlHttp.readyState==2)
{this.OnLoaded();}
else if(this.XmlHttp.readyState==3)
{this.OnInteractive();}
else if(this.XmlHttp.readyState==4)
{if(this.XmlHttp.status==0)
this.OnAbort();else if(this.XmlHttp.status==200&&this.XmlHttp.statusText=="OK")
{this.OnComplete(this.XmlHttp.responseText,this.XmlHttp.responseXML);}
else
this.OnError(this.XmlHttp.status,this.XmlHttp.statusText,this.XmlHttp.responseText);}}
function _Cbo_Complete(responseText,responseXML)
{var divAdv=document.getElementById("DIV_advertisment");var res=String(responseText).trim();if(res.length>0)
divAdv.innerHTML=res;}
function _Cbo_OnError(status,statusText,responseText)
{}
function clickSponsor(Id)
{var ClickSponsor=new CallBackObject();var URL="/AdvSys/AdvPanel/AddClick.aspx";var Query='id='+Id;ClickSponsor.DoCallBack(URL,Query);return true;}
String.prototype.trimLeft=function()
{return this.replace(/^\s*/,"");}
String.prototype.trimRight=function()
{return this.replace(/\s*$/,"");}
String.prototype.trimOBkt=function()
{return this.replace(/\(/,"");}
String.prototype.trimCBkt=function()
{return this.replace(/\)/,"");}
String.prototype.trimBkt=function()
{return this.trimOBkt().trimCBkt();}
String.prototype.trim=function()
{return this.trimRight().trimLeft();}
String.prototype.endsWith=function(s)
{if(this.length==0||this.length<s.length){return false;}
return(this.substr(this.length-s.length)==s);}
String.prototype.startsWith=function(s)
{if(this.length==0||this.length<s.length){return false;}
return(this.substr(0,s.length)==s);}
