/* The following function creates an XMLHttpRequest object... */
function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

var http = createRequestObject();

function getRequest2(url,id){

	elementId=id;
	//loadingMesg=msg;
	http.open('get', url);

	http.onreadystatechange = ManipulateRequest2; 
	/* Send the data. We use something other than null when we are sending using the GET
		method. */
	http.send(null);
}

function ManipulateRequest2(){
	/* Make sure that the transaction has finished. The XMLHttpRequest object 
		has a property called readyState with several states:
		0: Uninitialized
		1: Loading
		2: Loaded
		3: Interactive
		4: Finished */

//	var msg="Please wait ... loading";

	if(http.readyState == 1)
	{  
	msg = "Processing, please wait....";
	document.getElementById('errormsg').innerHTML='<center><font color="blue">'+msg+'</FONT></center>';
	
	}
	else if(http.readyState == 4){ //Finished loading the response
		/* We have got the response from the server-side script,
			let's see just what it was. using the responseText property of 
			the XMLHttpRequest object. */
		var response = http.responseText;
		/* And now we want to change the product_categories <div> content.
			we do this using an ability to get/change the content of a page element 
			that we can find: innerHTML. */
		if(response=='yes')
		{
		document.getElementById('errormsg').innerHTML='';
		document.getElementById('check').innerHTML="<input type='hidden' name='validationss' value='No'>";
		return false;
		}
		else
		{
		msg = "The email already exists, please choose another.";
		document.getElementById('errormsg').innerHTML='<center><font color="red">'+msg+'</FONT></center>';
		document.getElementById('check').innerHTML="<input type='hidden' name='validationss' value='Yes'>";
		return false;
		}
	}
}
