// gateway to php
function PostVars(vars,element_id,preloader)
{
	var xmlHttp = GetXmlHttpObject();
	var url=vars+"&sid="+Math.random();
	xmlHttp.onreadystatechange=function ()
	{
		if ((xmlHttp.readyState==4)&&(element_id!=""))
		{ document.getElementById(element_id).innerHTML = xmlHttp.responseText;	delete xmlHttp;}
		else if(preloader!="") { document.getElementById(element_id).innerHTML = preloader; }
	}
	xmlHttp.open("GET",url,true);	 xmlHttp.send(null);
}


function GetVars(vars,element_id,preloader)
{
	var xmlHttp = GetXmlHttpObject();
	xmlHttp.onreadystatechange=function ()
	{
		if ((xmlHttp.readyState==4)&&(element_id!=""))
		{ document.getElementById(element_id).innerHTML = xmlHttp.responseText;	delete xmlHttp;}
		else if(preloader!="") { document.getElementById(element_id).innerHTML = preloader; }
	}
	xmlHttp.open("GET",vars,true);	 xmlHttp.send(null);
}


// internal AJAX function
function GetXmlHttpObject()
{
var xmlHttp=null;
try { xmlHttp=new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
catch (e)  {  // Internet Explorer
try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } }
return xmlHttp;
}

// replaces characters
function ReplaceChars(entry,out,add) {
temp = "" + entry;

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
return(temp);
}



// hides object
function HideObject(id)
{
	var curElement = document.getElementById(id);
	if (curElement) {
		curElement.style.visibility = "hidden";
		curElement.style.display = "none";
		return true;
	}
	return false;
}

// unhides object as a block
function ShowObject(id)
{	var curElement = document.getElementById(id);
	if (curElement) {		curElement.style.visibility = "visible";
		curElement.style.display = "block";
		return true;
	}
	return false;
}

// unhides object as inline
function InlineObject(id)
{ document.getElementById(id).style.display = "inline"; }

function RevealObject(id)
{ document.getElementById(id).style.display = ""; }

function ToogleObject(id)
{
	var style2 = document.getElementById(id).style;
	if (style2.display == "none") { style2.display = "block"; }
	else { style2.display = "none"; }
}

function SwapObject(id)
{
	var style2 = document.getElementById(id).style;
	if (style2.display == "none") { style2.display = "inline"; }
	else { style2.display = "none"; }
}