var xmlHttp

function checkForm(str, id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="ajax.php?q="+str+"&id="+id
	xmlHttp.onreadystatechange = function()
    {
    	if(xmlHttp.readyState==4)
		{
			text = xmlHttp.responseText
 			document.getElementById(id).style.borderColor = text.substring(0,7);
 			document.getElementById(id).style.borderStyle = "solid #FFF0F0";
 			document.getElementById(id).style.borderWidth = "1px";
			document.getElementById(id).style.backgroundColor = "#FFF0F0";
			document.getElementById(id+"v").innerHTML = text.substring(8)
			if(id == "pass1" & document.getElementById("rpass").value != "")
			{
				checkForm(document.getElementById("rpass").value, "rpass");
			}
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{ 
		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		try
  		{
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e)
  		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
	 }
	return xmlHttp;
}

function ClearBox()
{
	document.getElementById("user").value = ""
	document.getElementById("mail").value = ""
	document.getElementById("fdate").value = "m - d - Y"
	SetTimer();
}

function SetTimer()
{
	timers=GetXmlHttpObject()
	if (timers==null)
	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="ajax.php?act=time"
	timers.onreadystatechange = function()
    {
    	if(timers.readyState==4)
		{
			document.getElementById("timer").innerHTML = timers.responseText
		}
	}
	timers.open("GET",url,true)
	timers.send(null)
	setTimeout("SetTimer()", 1000);
}

function SetDate(format)
{
	dates=GetXmlHttpObject()
	if (timers==null)
	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="ajax.php?act=date&f="+format
	dates.onreadystatechange = function()
    {
    	if(dates.readyState==4)
		{
			document.getElementById("date").innerHTML = dates.responseText
		}
	}
	dates.open("GET",url,true)
	dates.send(null)
}