function getXMLHTTP() 
{ //fuction to return the xml http object
	var xmlhttp=false;	
	try
	{
		xmlhttp=new XMLHttpRequest();
	}
	catch(e)	
	{		
		try
		{			
			xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e1)
			{
				xmlhttp=false;
			}
		}
	}
 	
	return xmlhttp;
}

function getComment() 
{		
	jQuery("#loading").addClass("loadingImg");

	var userid = document.getElementById("userid").value;
	var comment = document.getElementById("comment").value;
	
	
	var strURL="findComment.php?userid="+userid+"&comm="+comment;
	var req = getXMLHTTP();

	if (req) 
	{
	
		req.onreadystatechange = function() 
		{
			if (req.readyState == 4) 
			{
				// only if "OK"
				if (req.status == 200) 
				{						
					document.getElementById('statediv').innerHTML=req.responseText;	
					jQuery("#loading").removeClass("loadingImg");
									
				} else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", strURL, true);
		req.send(null);
	}		
}




function getRating(rate, userid, comid, status) 
{		
	
	
	var strURL="saveRating.php?rate="+rate+"&userid="+userid+"&comid="+comid+"&status="+status;
	var req = getXMLHTTP();
	
	if (req) 
	{
		req.onreadystatechange = function() 
		{
			if (req.readyState == 4) 
			{
				// only if "OK"
				if (req.status == 200) 
				{						
					//document.getElementById('rate').innerHTML=req.responseText;	
					//alert(req.responseText);
					location.reload();
									
				} else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", strURL, true);
		req.send(null);
	}		
}

function getLikeRating(rate, hh_id, status) 
{		
	
	
	var strURL="saveLikeRating.php?rate="+rate+"&hh_id="+hh_id+"&status="+status;
	if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  req=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  req=new ActiveXObject("Microsoft.XMLHTTP");
  }

	//var req = getXMLHTTP();
	
	if (req) 
	{
		req.onreadystatechange = function() 
		{
			if (req.readyState == 4) 
			{
				// only if "OK"
				if (req.status == 200) 
				{						
						
					//alert(req.responseText);
					location.reload();
									
				} else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", strURL, true);
		req.send(null);
	}		
}


function showNeighbourhood(str)
{
	if (str=="") {
		document.getElementById("txtHint").innerHTML="";
		return;
	}
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	} else {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","../ajax/neighbourhood.php?q="+str,true);
	xmlhttp.send();
}
function showNeighbourhoodFront(str)
{
	
	if (str=="") {
		document.getElementById("txtHint").innerHTML="";
		return;
	}
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	} else {
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200) {
			document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
		}
	}

	//alert (document.location.hostname);
	if(document.location.hostname=='www.happyhourcard.com')
	{
		xmlhttp.open("GET","http://www.happyhourcard.com/ajax/neighbourhood.php?q="+str,true);
	}
	else
	{
		xmlhttp.open("GET","http://happyhourcard.com/ajax/neighbourhood.php?q="+str,true);
	}

	xmlhttp.send();
}
//function moreRest(bid,cid,type)
//{
//if (window.XMLHttpRequest)
//  {// code for IE7+, Firefox, Chrome, Opera, Safari
//  xmlhttp=new XMLHttpRequest();
//  }
//else
//  {// code for IE6, IE5
//  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//  }
//xmlhttp.onreadystatechange=function()
//  {
//  if (xmlhttp.readyState==4 && xmlhttp.status==200)
//    {
//    document.getElementById("dyker_list").innerHTML=xmlhttp.responseText;
//    }
//  }
//xmlhttp.open("GET","left_show.php?bid="+bid+"&cid="+cid+"&type="+type,true);
//xmlhttp.send();
//}
