function wr2s(obj){return callajax(obj,false);}
function cng(obj){return callajax(obj,true);}
function fav(n){return callajax("fav="+n,true);}
function mnu(n,p){return callajax("mnu="+n+'&amp;'+p,true);}
function call(c){return callajax("obj="+c,true);}
function callajax(obj,l){n=0;cFull='';xVal='';lock=false;req=false;objLayer=false;lObj=l;if(window.XMLHttpRequest){try{req=new XMLHttpRequest();}
catch(e){req=false;}}
else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){req=false;}}}
if(!req){return isok(false);}
if(l){document.getElementById('loadinginf').style.left='45%';document.getElementById('loadinginf').style.top='30%';document.getElementById('loadinginf').style.display='block';}
req.onreadystatechange=new Function('f','get_http_response()');if(typeof(obj)=='object'){if(obj.type=="checkbox"){if(obj.checked){xVal='on';}else{xVal=0;}}else{if(typeof(obj.value)=='string'){xVal=obj.value;}}
xVal=xVal+getsid();if(l){if(typeof(obj.id)=='string'&&obj.id.length>0){x=obj.id;}else{x=obj.name;}
req.open("GET",'./ajax.php?eid='+x+'&val='+xVal+'&'+new Date().getTime(),true);}else{req.open("GET",'./ajax.php?name='+obj.name+'&val='+xVal+'&'+new Date().getTime(),true);}}else{req.open("GET",'./ajax.php?'+obj+getsid()+'&'+new Date().getTime(),true);}
req.send((document.all&&!window.opera)?null:true);return isok(true);}
function getsid(){if(typeof(document.forms[0].SID)=='object'){return'&SID='+document.forms[0].SID.defaultValue;}
get=document.location.search;if(get.indexOf('SID=')<0){return'';}
get=get.substring(get.indexOf('SID='))+'&';get=get.substring(0,get.indexOf('&'));return'&'+get;}
function sendpost(cData){n=0;cFull="";lock=false;req=false;lObj=true;objLayer=false;if(window.XMLHttpRequest){try{req=new XMLHttpRequest();}
catch(e){req=false;}}
else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){req=false;}}}
if(!req){return isok(false);}
document.getElementById('loadinginf').style.left='45%';document.getElementById('loadinginf').style.top='30%';document.getElementById('loadinginf').style.display='block';req.onreadystatechange=new Function('f','get_http_response()');cData=cData+'&'+new Date().getTime();req.open("POST",'./ajax.php',true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.setRequestHeader("Content-length",cData.length);req.setRequestHeader("Connection","close");req.send(cData);return isok(true);}
function get_http_response(){if(req.readyState==4){if(req.status==200){if(!lObj){document.getElementById('loadinginf').style.display='none';return;}
cFull=req.responseText;cBg=String.fromCharCode(60)+'!--x ';cEnd='--'+String.fromCharCode(62);while(cFull.indexOf(cBg)>=0&&n<=6){cId=cFull.substring(cFull.indexOf(cBg)+6,cFull.indexOf(cEnd));cId.replace(/^\s+/,'').replace(/\s+$/,'');cData=cFull.substring(cFull.indexOf(cEnd)+3);if(cData.indexOf(cBg)>0){cData=cData.substring(0,cData.indexOf(cBg));cFull=cFull.substring(cFull.indexOf(cBg)+4);cFull=cFull.substring(cFull.indexOf(cBg));}else{cFull="";}
setbox(document.getElementById(cId),cData);n++;}
lock=false;document.getElementById('loadinginf').style.display='none';}else{if(document.URL.substring(7,16)=='127.0.0.1'){alert(req.statusText);}}
if(document.all&&!window.opera){req.abort();}
lock=false;document.getElementById('loadinginf').style.display='none';}}
function setbox(objBox,cData){objLayer=false;if(objBox.parentNode.nodeName=='SPAN'){objLayer=objBox.parentNode;for(i=objLayer.childNodes.length-1;i>=0;--i){objLayer.removeChild(objLayer.childNodes[i]);}}else{lRemove=true;objLayer=objBox.parentNode;for(i=objLayer.childNodes.length-1;i>=0;--i){if(lRemove){if(objLayer.childNodes[i].id==objBox.id){lRemove=false;}
objLayer.removeChild(objLayer.childNodes[i]);}}}
var newspan=document.createElement("span");newspan.innerHTML=cData;objLayer.appendChild(newspan);return;}
function isok(isok){if(isok==false){return true;}
return false;}
function post(obj,oFrm){var poststr="button="+obj.name;if(typeof(obj.value)=='string'){poststr=poststr+'&'+obj.name+'='+encodeURI(obj.value);}
if(typeof(obj)=='object'&&typeof(oFrm)=='undefined')
{var x=obj;while(typeof(x)=='object'){if(x.nodeName=='FORM'){oFrm=x;break;}else{x=x.parentNode;}}}
if(typeof(oFrm)=='object'){poststr=poststr+frmElements(oFrm);}else{poststr=poststr+'&modul='+obj.id+oFrm;}
return sendpost(poststr+getsid());}
function frmElements(oFrm){if(typeof(oFrm.elements)=='undefined'){return'';}
var poststr='';for(i=oFrm.elements.length-1;i>=0;--i){x=oFrm.elements[i];cAdd='';switch(x.type){case"checkbox":if(x.checked){xVal='on';}else{xVal='';}
cAdd='&'+x.name+'='+encodeURI(xVal);break;case"select-one":case"hidden":case"text":cAdd='&'+x.name+'='+encodeURI(x.value);break;}
poststr=poststr+cAdd;}
return poststr;}
