// JavaScript Document
var xmlHttp;
var temp = 0;

//function to change the subcast acoordingly religion
function getCaste(r){ 
			
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="getcaste_ajax.php"
 	url=url+"?rlgid="+r
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=caste
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function caste(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("caste").innerHTML=xmlHttp.responseText
	} 	
}
function getState(r)
{ 
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="getstate_ajax.php"
 	url=url+"?stateid="+r
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=state
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function state(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("state").innerHTML=xmlHttp.responseText
	} 	
}
function getCity(r)
{ 
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="getcity_ajax.php"
 	url=url+"?cityid="+r
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=city
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function city(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("city").innerHTML=xmlHttp.responseText
	} 	
}
var xmlHttp1;
function check_password(a)
{ 
	
	xmlHttp1=GetXmlHttpObject()
	if (xmlHttp1==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="send_password.php"
	url=url+"?q="+a
	url=url+"&sid="+Math.random()
	xmlHttp1.onreadystatechange=check_forgot_password
	xmlHttp1.open("GET",url,true)
	xmlHttp1.send(null)
}
function check_forgot_password() 
{ 
	if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
	{ 
		document.getElementById("check_for_pass").innerHTML=xmlHttp1.responseText
	} 
}

/*//function for checking rather the profileid is already used
function checkprofileid(pid){
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="checkprofileidexist_ajax.php"
	url=url+"?pid="+pid
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=getprofileid
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function getprofileid(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("checkprofileid").innerHTML=xmlHttp.responseText
	} 	
}

//fucntion for checking rather the email is already taken
function checkmail(email){
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="checkemailexist_ajax.php"
	url=url+"?email="+email
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=getmail
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function getmail(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("checkmail").innerHTML=xmlHttp.responseText
	} 	
}

//function for changing the title for the given photo
function changephototitle(photoid){
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="changephototitle_ajax.php"
	url=url+"?photoid="+photoid
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=changephoto
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function changephoto(){
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("changephoto").innerHTML=xmlHttp.responseText
	} 	
}

//function for changing the tags for the given photo
function changephototags(photoid){
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return	
	}
	var url
	url="changephototags_ajax.php"
	url=url+"?photoid="+photoid
	url=url+"&rnd="+Math.random()
	xmlHttp.onreadystatechange=changephoto
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


//
function confdel(x){
	if(confirm("Are you sure to delete "+x+" ???")==true){
		return true;
	}
	else{
		return false;	
	}
}

//
function viewfullphoto(photoid){
	//alert(photoid);
	//window.open("viewfullphoto.php?photoid="+photoid);
	window.open("viewfullphoto.php?photoid="+photoid, 'smilies7', 'HEIGHT=450,resizable=no,menubar=no,scrollbars=yes,WIDTH=530');
}
function photoalbum(uid){
	//alert(uid);
	//window.open("viewphotoalbum.php?uid="+uid);
	window.open("viewphotoalbum.php?uid="+uid, 'smilies7', 'HEIGHT=460,resizable=no,menubar=no,scrollbars=yes,WIDTH=530');
}
*/

/*  Default use ======== USE Ajax File ====== Ok=  Compulsary */
var xmlHttp_profile="";
var userid="";
function profile_count(uid)
{ 
	userid=uid;
	xmlHttp_profile=GetXmlHttpObject()
	
	if (xmlHttp_profile==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="prifile_view_count.php"
	url=url+"?uid="+uid;
	url=url+"&sid="+Math.random();
	xmlHttp_profile.onreadystatechange=addcout
	
	xmlHttp_profile.open("GET",url,true)
	
	xmlHttp_profile.send(null)
}
function addcout() 
{ 

	if (xmlHttp_profile.readyState==4 || xmlHttp_profile.readyState=="complete")
	{ 
		window.location="profile.php?uid="+userid;
	} 
}
function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
	objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

