var xmlhttp

function accept_decline_contact_profiles(maleprofile,femaleprofile,response)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
	  alert ("Your browser does not support XMLHTTP!");
	  return;
  }
var url="ajax_accept_decline_profile.php";
url=url+"?m="+maleprofile+"&f="+femaleprofile+"&r="+response;
xmlhttp.onreadystatechange=accept_decline_Changed;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function show_profile_photos(profile_id){


	window.open ("profile_album.php?profile_id="+profile_id,"mywindow","menubar=0,resizable=0,width=380,height=450"); 
	
	
}

function show_painting(profile_id){


	window.open ("paintings_album.php?image="+profile_id,"paintingwindow","menubar=0,resizable=0,width=500,height=570"); 
	
	
}

function accept_decline_Changed()
{
	 if(xmlhttp.readyState==4)
	  {
		if(xmlhttp.responseText == 'accept')
		  {
			document.getElementById("acceptance").innerHTML='<font color="#0F36BD" size="2"><b>Accepted Successfully.</b></font>';
		  }else if(xmlhttp.responseText == 'decline'){
			document.getElementById("declinece").innerHTML='<font color="#0F36BD" size="2"><b>Declined Successfully.</b></font>';
		  }
	  }
}


function add_to_favorites(myprofile_id,profile_id)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url="ajax_add_to_favorites.php";
url=url+"?m="+myprofile_id+"&f="+profile_id;
xmlhttp.onreadystatechange=favoritesChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function favoritesChanged()
{
	 if(xmlhttp.readyState==4)
	  {
		if(xmlhttp.responseText == 'success')
		  {
			document.getElementById("favoritesint").innerHTML='<font color="#0F36BD" size="2"><b>Added to your favorites.</b></font>';
		  }
	  }else{
			document.getElementById("favoritesint").innerHTML='<img src="/images/loading3.gif">';
	  }
}

function contact_profiles(maleprofile,femaleprofile)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url="ajax_contact_profile.php";
url=url+"?m="+maleprofile+"&f="+femaleprofile;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function login_to_account(emailid,password)
{
	if(emailid == ""){
		alert ("Email ID Should Not be Blank");
		return false;
	}
	if(password == ""){
		alert ("Password Should Not be Blank");
		return false;
	}

	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	  {
		alert ("Your browser does not support XMLHTTP!");
		return;
	  }
var url="ajax_login.php";
url=url+"?e="+emailid+"&p="+password;
xmlhttp.onreadystatechange=loginChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function loginChanged()
{
if (xmlhttp.readyState==4)
  {
	if(xmlhttp.responseText == 'invalid')
	  {
		document.getElementById("errorbox").innerHTML='<font color="#CC0033">Incorrect Email / Password.</font>';
		document.getElementById("errorbox").style.display='';
	  }else{
		document.getElementById("loginbox").innerHTML=xmlhttp.responseText;
	  }
  }
}

function stateChanged()
{
	 if(xmlhttp.readyState==4)
	  {
		if(xmlhttp.responseText == 'success')
		  {
			document.getElementById("exprint").innerHTML='<font color="#0F36BD" size="2"><b>Interest Sent.</b></font>';
		  }
	  }else{
			document.getElementById("exprint").innerHTML='<img src="/images/loading3.gif">';
	  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}