	function getXMLHttp()
	{
  		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 save_email()
	{
		var str=document.getElementById("email").value;
		var xmlHttp = getXMLHttp();
  		xmlHttp.onreadystatechange = function()
  		{
    		if(xmlHttp.readyState == 4)
   	 		{
     		 HandleResponse(xmlHttp.responseText);
    		}
  		}
  		//xmlHttp.abort();	
		

  		xmlHttp.open("GET", "save_email.php?email="+str, true);
  		xmlHttp.send(null);
	}
	
	function HandleResponse(response)
	{
	    eval(response);
		document.getElementById("email").value='Subscribe to us';
	}





	function set_lang(lang)

	{ 
  		var xmlHttp = getXMLHttp();
  		//xmlHttp.abort();	
  		xmlHttp.open("GET", "set_lang.php?lang="+lang, true);
		setTimeout("location.reload()",300);
  		xmlHttp.send(null);
	}



	function update_date(i,id){
		var day1=document.getElementById('daystart'+i).value;
		var month1=document.getElementById('monthstart'+i).value;
		var day2=document.getElementById('dayend'+i).value;
		var month2=document.getElementById('monthend'+i).value;
		
		var xmlHttp = getXMLHttp();
  		xmlHttp.onreadystatechange = function()
  		{
    		if(xmlHttp.readyState == 4)
   	 		{
     		 HandleResponse2(xmlHttp.responseText);
    		}
  		}
  		//xmlHttp.abort();	
		

  		xmlHttp.open("GET", "update_date.php?id="+id+"&day1="+day1+"&month1="+month1+"&day2="+day2+"&month2="+month2, true);
  		xmlHttp.send(null);
	}
	
	function HandleResponse2(response)
	{
	    eval(response);
	}


	function check_featured(){
		
		var xmlHttp = getXMLHttp();
  		xmlHttp.onreadystatechange = function()
  		{
    		if(xmlHttp.readyState == 4)
   	 		{
     		 HandleResponse3(xmlHttp.responseText);
    		}
  		}
  		//xmlHttp.abort();	
		

  		xmlHttp.open("GET", "count_featured.php", true);
  		xmlHttp.send(null);
	}
	
	function HandleResponse3(response){
		if(response>=9){
			alert("maximum 9 featured tenant allowed.");
			document.getElementById('featured').checked=0;
		}
	}

