var form;
var http;
var isWorking;

function checkServerVerification(frm)
{	
	var PostParam = "";
	form = frm;
	var server = document.getElementById('DB_SERVER').value;
	var uname = document.getElementById('DB_SERVER_USERNAME').value;
	var pwd = document.getElementById('DB_SERVER_PASSWORD').value;
	var db = document.getElementById('DB_DATABASE').value;

	var url = "server_verification.php?";
	PostParam = "server="+server+"&uname="+uname+"&pwd="+pwd+"&db="+db;
	var params = PostParam;
  	url = url+PostParam;
	//alert(url);
	isWorking = false;
	if (!isWorking)
	{
		document.getElementById('mBox').style.visibility = 'visible';
		http = getHTTPObject();
		isWorking = true;
		http.onreadystatechange=handleHttpResponse_usernameCheck;
  		http.open("POST",url, true);
		http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset= UTF-8");
	  	http.send(params);
  	}
	return false;
}
function handleHttpResponse_usernameCheck() 
{
	if (http.readyState == 4) 
	{
		//alert(http.responseXML);
		isWorking = false;
		
    	if(http.responseText.indexOf('invalid') == -1) 
		{
    		var xmlDocument = http.responseXML; 
			var objIdvar = xmlDocument.getElementsByTagName('errorFlag').item(0).firstChild.data;
			var msg = xmlDocument.getElementsByTagName('msg').item(0).firstChild.data;
			document.getElementById("showProcess").style.display="none";
			if(objIdvar != 0)
			{
				document.getElementById("showProcess").style.display="none";
				document.getElementById('span_errormsg').style.display="";
				document.getElementById('span_errormsg_text').innerHTML = msg;
				document.getElementById('span_success_msg1').style.display="none";
				document.getElementById('span_success_msg2').style.display="none";
				return false;
			}
			else
			{
				document.getElementById("showProcess").style.display="none";
				document.getElementById('span_errormsg').style.display="none";
				document.getElementById('span_success_msg1').style.display="";
				document.getElementById('span_success_msg2').style.display="";
				setTimeout("this", 2000);
				//window.location='index.php?page=step2_action';
				document.install.submit();
				return false;
			}
		}
	}
}