 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 check_user(uname){
	   //http.open('get', 'http://www.classifiedone.com/ajax.php?action=check_pass&pass='+pass+'&id='+id);
	   http.open('get', 'http://www.indiaspiders.com/ajax.php?action=check_uname&uname='+uname);
	   http.onreadystatechange = handleuname;
	   http.send(null);
}

function handleuname(){
		if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		eval(response);		
	}
}


function check_oldpass(id,pass){
	   //http.open('get', 'http://www.classifiedone.com/ajax.php?action=check_pass&pass='+pass+'&id='+id);
	   http.open('get', 'http://www.indiaspiders.com/ajax.php?action=check_pass&pass='+pass+'&id='+id);
	   http.onreadystatechange = handlepass;
	   http.send(null);
}

function checkadmin_oldpass(id,pass){
	    //http.open('get', 'http://www.classifiedone.com/ajax.php?action=check_pass&pass='+pass+'&id='+id);
	  http.open('get', 'http://www.indiaspiders.com/ajax.php?action=check_adminpass&pass='+pass+'&id='+id);
	   http.onreadystatechange = handleadminpass;
	   http.send(null);
}
function handlepass(){
		if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		eval(response);		
	}
}

function handleadminpass(){
		if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		eval(response);		
	}
}
	
function check_email(email_id){
	if (email_id && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email_id)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.\n\n Example: xyz@domainname.com");
		document.getElementById("lblmsg").innerHTML ='';	
		return false;
	}
	    //http.open('get', 'http://www.classifiedone.com/ajax.php?action=check_email&email_id='+email_id);
	  http.open('get', 'http://www.indiaspiders.com/ajax.php?action=check_email&email_id='+email_id);
	   http.onreadystatechange = handleEmail;
	   http.send(null);


}

function del_img(id, main)
{
//	var s=http.open('get', 'http://www.classifiedone.com/ajax.php?action=del_img&id='+id+'&main='+main);
		var s=http.open('get', 'http://www.indiaspiders.com/ajax.php?action=del_img&id='+id+'&main='+main);

	http.onreadystatechange = handleProducts3;

	http.send(null);
}
function getcity(stateid){
//	var s=http.open('get', 'http://www.classifiedone.com/ajax.php?action=get_city&state_id='+stateid);
	var s=http.open('get', 'http://www.indiaspiders.com/ajax.php?action=get_city&state_id='+stateid);

	http.onreadystatechange = handleProducts1;

	http.send(null);
}

function getcat(catid, level){
	//alert('cat====='+catid+'========'+level);
//        http.open('get', 'http://www.classifiedone.com/ajax.php?action=get_subcat&cat_id='+catid);
	if (catid > 0)
	{	
		//http.open('get', 'http://www.classifiedone.com/ajax.php?action=get_subcat&cat_id='+catid+'&level='+level);
		http.open('get', 'http://www.indiaspiders.com/ajax.php?action=get_subcat&cat_id='+catid+'&level='+level);
		if (level == 1)
		http.onreadystatechange = handleProducts2;
		else
		http.onreadystatechange = handleProducts4;
		http.send(null);
	}
}
/* Function called to handle the list that was returned from the internal_request.php file.. */

function handleProducts1(){
	/* 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 */
	if(http.readyState == 4){ //Finished loading the response

		var response = http.responseText;
		/* And now we want to change the id1 <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
		document.getElementById('city').innerHTML = response;
	}
}

function handleProducts2(){
	/* 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 */
	if(http.readyState == 4){ //Finished loading the response

		var response = http.responseText;
		/* And now we want to change the id1 <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
		document.getElementById('subcat').innerHTML = response;
	}
}

function handleProducts4(){
	/* 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 */
	if(http.readyState == 4){ //Finished loading the response

		var response = http.responseText;
		/* And now we want to change the id1 <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
		document.getElementById('subcat2').innerHTML = response;
	}
}

function handleProducts3(){
	/* 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 */
	if(http.readyState == 4){ //Finished loading the response

		var response = http.responseText;
		/* And now we want to change the id1 <div> content.
			we do this using an ability to get/change the content of a page element
			that we can find: innerHTML. */
		eval(response);
		//document.getElementById('subcat').innerHTML = response;
	}
}
function handleEmail(){
		if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		eval(response);		
	}
}
