// JavaScript Document

var xmlhttp;
function createXMLHttpRequest()
{
	try
	{
		xmlhttp = new XMLHttpRequest();
	}
	catch(trymicrosoft)
	{
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(othermicrosoft)
		{
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(failed)
			{
				xmlhttp = false;
			}
		}
	}
	if(!xmlhttp)
		alert("Error initializing XMLHttpRequest!");
}
function startRequest()
{
	var mobile = document.getElementById("mobile").value;
	var url = "gainMobile.php?mobile="+escape(mobile);
	createXMLHttpRequest();
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange = handleStateChange;
	xmlhttp.send(null);
}
function handleStateChange()
{
	if(xmlhttp.readyState == 1)
	{
		document.getElementById("m_result").innerHTML = "Loading...";
	}
	if(xmlhttp.readyState == 4)
	{
		if(xmlhttp.status == 200)
		{
			var newP = document.getElementById("m_result");
			newP.innerHTML = xmlhttp.responseText;
		}
	}
}
function onSubmit() {     
var buttons=document.getElementById("callForm").elements["button1"]; 
buttons.click();
}