function ajaxConnect()
{
var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    return xmlHttp;
}
function takeSignup()
{
	var email=document.form4.email.value;
	var password=document.form4.password.value;
	
	var h1=document.form4.checkbox1.checked;
	var h2=document.form4.checkbox2.checked;
	
	var tosell;
	if(h1==false && h2==false)
	{
		alert("Do you have a home to sell? We are required to ask this question.");
	}
	if(h1==true && h2==false)
	{
		tosell=true
	}
	if(h2==true && h1==false)
	{
		tosell=false
	}
	else
	{
		var xmlHttp=ajaxConnect();
	    //ajax connection is made send and recieve
    	  xmlHttp.onreadystatechange=function()
    	  {
    	  	if(xmlHttp.readyState==4)
    	  	{
    	  		response=xmlHttp.responseText;
    	  		if(response!="true")
    	  		{
   	     			alert(response);
    	  		}
    	  		else
    	  		{
					alert("Thanks for signing up. Please sign in.");
   	     			var sURL = unescape(window.location.pathname);
   		     		window.location.replace(sURL);
    	  		}
       		}
    	  }
    
    	var url="http://clickonlinehomes.com/ajax.php?pass="+password+"&email="+email+"&tosell="+tosell+"&action=signup";
    	xmlHttp.open("GET",url,true);
    	xmlHttp.send(null);
	}
}
function takeLogin()
{
	var email=document.logintop.email.value;
	var password=document.logintop.password.value;

	
		var xmlHttp=ajaxConnect();
	    //ajax connection is made send and recieve
    	  xmlHttp.onreadystatechange=function()
    	  {
    	  	if(xmlHttp.readyState==4)
    	  	{
    	  		response=xmlHttp.responseText;
				if(response=="true")
    	  		{
					var sURL = unescape(window.location.pathname);
   		     		window.location.replace(sURL);
    	  		}
    	  		else
    	  		{
					alert(response);
    	  		}
       		}
    	  }
    
    	var url="http://clickonlinehomes.com/ajax.php?pass="+password+"&email="+email+"&action=login";
    	xmlHttp.open("GET",url,true);
    	xmlHttp.send(null);
}
function changeColor(s,c)
{
	s.color=c;
	var e = document.getElementById('searcherr');
	e.style.display='none';
}
function show(s)
{
	hide();	
	var e = document.getElementById(s);
	e.style.display='block';
}
function hide()
{
	var e = document.getElementById('signup');
	if(e)
		e.style.display='none';
	
	e = document.getElementById('signin');
	if(e)
		e.style.display='none';
		
	e = document.getElementById('setupshowing');
	if(e)
		e.style.display='none';
	
	e = document.getElementById('askquestions');
	if(e)
		e.style.display='none';
	
	e = document.getElementById('getyourhomesold');
	if(e)
		e.style.display='none';
	
	e = document.getElementById('getfreshlistings');
	if(e)
		e.style.display='none';
}