//Browser Support Code
function runajax()
{
    //Create a boolean variable to check for a valid Internet Explorer instance.
	var xmlhttp = false;

	//Check if we are using IE.
	try {
		//If the javascript version is greater than 5.
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		//If not, then use the older active x object.
		try {
			//If we are using Internet Explorer.
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			//Else we must be using a non-IE browser.
			xmlhttp = false;
		}
	}
	//If we are using a non-IE browser, create a javascript instance of the object.
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}

    return xmlhttp;
}

var http = runajax();
var nocache = 0;

var refreshrate = 2000;
//var queryrate   = 180000;
var queryrate   = 1000;

function refreshview(page)
{
    setTimeout('runajax("contentdiv",  "'+ page +'")', refreshrate);
    
}

function refreshMe(page)
{
    setTimeout('runajax("contentdiv",  "'+ page +'")', queryrate);
}

function check_username()
{
    hidediv('username_msg');
    var string = document.getElementById('email').value;
    var queryString = "?cmd=user_check&s=" + string;

    var obj = document.getElementById('loadEmpData');

    http.open ("GET","http://www.findgoodhelp.com/form.php" + queryString + "");

    http.onreadystatechange = reply;
    http.send(null);
} 

function reply()
{
    if(http.readyState == 4 && http.status == 200)
    {
        var response = http.responseText;
        showdiv('username_msg');
        document.getElementById('username_msg').innerHTML = response;
    }
}

//Function to show a loading message.
function showload (objDiv){
	document.getElementById(objDiv).innerHTML = '<div class="center"><img src="http://customer.murfsystems.net/images/loading_aqua.gif" width="315" height="200"></div>';
}

function showdiv(id) {
	document.getElementById(id).style.display = 'block';
}

function hidediv(id) {
	document.getElementById(id).style.display = 'none';
}
