function Sw(url,data) {
PostXMLDoc(url,data);
return;
}

function GetUrl(url,obj_id) {
var xmlhttp=false;
var tmpAnsw=0;

// connecting
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}

 xmlhttp.open("GET", url,true);
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
	  var resp=xmlhttp.responseText
	  if (document.getElementById(obj_id)) {
		  document.getElementById(obj_id).innerHTML=resp;
		  var tmplen=document.getElementById(obj_id).innerHTML.length;
	  }
	
	  if (tmplen==0) {tmpAnsw=0;} else {tmpAnsw=1;}
  }
 }
 xmlhttp.send(null);
 return tmpAnsw;


}


var xmlhttp;
function loadXMLDoc(url) {
xmlhttp=null
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  }
else
  {
  alert ("Your browser does not support XMLHTTP.")
  }
}

function state_Change() {
if (xmlhttp.readyState==4)
  {
  if (xmlhttp.status==200)
    {
	var respTxt = xmlhttp.responseText;
	if (respTxt) { alert (xmlhttp.responseText); }
    }
  else
    {
    alert ("Problem retrieving XML data");
    }
  }
}

function PostXMLDoc(url,data) {
xmlhttp=null
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("POST",url,true)
  xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  xmlhttp.setRequestHeader('Content-length',data.length);
  xmlhttp.setRequestHeader('Connection','close');
  xmlhttp.send(data);
  }
else
  {
  alert ("Your browser does not support XMLHTTP.")
  }
  return;
}

function UrlEncode(data) {
	data=data.replace(/\+/i, "%2B");
	return data;
}

function Rar() {
url='/site/sw/accept_sent_info.php';
GetUrl(url,'cfgofferdiv');
}

function Udaacc(v,d,c) {
url='/site/sw/acceptoffer.php';
b=document.getElementById(v).value; b=UrlEncode(b);
data='v='+d+'&d='+b+'&pid='+c;
PostXMLDoc(url,data);
}

function LoadComments(pid,id) {
GetUrl("/site/sw/comments.php?pid="+pid,id);
}

function ClearAndRefresh() {
document.getElementsByName(idtoclear)[0].value='';
LoadComments(lastpid,lastid);
}

var idtoclear;
var lastpid;
var lastid;

function SendComment(i,p,i2) {
var v=document.getElementsByName(i)[0].value;
d="p="+p+"&v="+v;
Sw("/site/sw/addcomment.php",d);
idtoclear=i;
lastpid=p;
lastid=i2;
setTimeout("ClearAndRefresh()",500);
}

function SendMsg(p,v) {
d="p="+p+"&v="+v;
Sw("/site/sw/addmsg.php",d);
}

function SendNewAd(p,v) {
d="p="+p+"&v="+v;
Sw("/site/sw/addnewad.php",d);
}

function SendFavCom(p,v) {
d="p="+p+"&v="+v;
Sw("/site/sw/addfavcom.php",d);
}

function ShowThisMsg(h,i,v) {
url='/site/sw/showmsg.php?h='+h+'&v='+v;
GetUrl(url,i);
}

function DelCfgMsg(h,hc) {
url='/site/sw/delmsg.php?hc='+hc;
data='h='+h;
Sw(url,data);
setTimeout("RefreshCurrentPage()",500);
}

function blinkeye(p) {
d="p="+p;
Sw("/site/sw/blinkeye.php",d);
}

function updateAttProfData(p,id) {
var url='/site/sw/updateattprofdata.php';
t=document.getElementsByName(id)[0].value;
data="v="+t+"&pid="+p+"&id="+id;
Sw(url,data);
DataSaved();
}

function updateMyWishes(p,id,c) {
var url='/site/sw/updatewishdata.php';
if (document.getElementsByName(id)[0].checked==true) {t=2;} else {t=1;}
data="v="+t+"&pid="+p+"&c="+c;
Sw(url,data);
DataSaved();
}

function updateToMail(id) {
var url='/site/sw/updatenotificationdata.php';
if (document.getElementsByName(id)[0].checked==true) {t=2;} else {t=1;}
data="v="+t;
Sw(url,data);
DataSaved();
}

function FolkPolice() {
ShowAct('policeshow0',0);
ShowAct('policeshow1',1);
return;
}

function SendFolkPoliceComment(i,p) {
var v=document.getElementsByName(i)[0].value;
d="p="+p+"&v="+v;
Sw("/site/sw/addfolkpolice.php",d);
ShowAct('folkpoliceform',0);
}


function GetUrlResult(url) {
var xmlhttp=false;
var tmpAnsw=0;

// connecting
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}

xmlhttp.open("GET", url,true);
xmlhttp.onreadystatechange=function() {
  resp = '';
  if (xmlhttp.readyState==4) {
	  var resp=xmlhttp.responseText;
	  ParseAnswer(resp);
  }
 }
xmlhttp.send(null);
return xmlhttp;

}