function Validation(theForm,data)
{
	 var search_text =  theForm.keyword.value;
	// alert(search_text);
	  if(search_text == ' ' || search_text == '')
	  {
		   document.getElementById('searchtext').innerHTML = data;
		   theForm.keyword.focus();
		   return false;
	  }
	  //var searchtext = theForm.search_keyword.value;
	var len = search_text.length;
	if(len < 2)
	{
		document.getElementById('searchtext').innerHTML = data;
		theForm.keyword.focus();
		return false;
	}
	document.getElementById('searchtext').innerHTML = '';
	  return true; 
}
function phoneValidation(theForm,data)
{
 var getValue = data.split('_');
theForm.keyword.value = theForm.keyword.value.replace(/^\s+/, '').replace(/\s+$/, '');
var search_text =  theForm.keyword.value;
// alert(search_text);
if(search_text == ' ' || search_text == '' || search_text.indexOf(' ') == 0)
{
document.getElementById('searchtext').innerHTML = getValue[0];
theForm.keyword.focus();
return false;
}
if(theForm.keyword.value && isNaN(theForm.keyword.value))
{
document.getElementById('searchtext').innerHTML = getValue[1];
theForm.keyword.focus();
return false;
}
theForm.area_code.value = theForm.area_code.value.replace(/^\s+/, '').replace(/\s+$/, '');
if(theForm.area_code.value && isNaN(theForm.area_code.value))
{
document.getElementById('searchtext').innerHTML = getValue[2];
theForm.area_code.focus();
return false;
}
document.getElementById('searchtext').innerHTML = '';
return true;
}
function getHTTPObject()
{
	var xmlhttp = '';
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try 
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	
		}
		catch (E)
		{
			xmlhttp = false;
		}
	
	}
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	 
	return xmlhttp;
}
function getArea(cityid)
{
if(cityid > 0 && cityid != '')
{
var url = '/includes/getarea.php?city_id='+cityid;
areaHttp = new getHTTPObject();
areaHttp.onreadystatechange = function(){
if(areaHttp.readyState == 4)
{
document.getElementById('getArea').style.display = 'block';	
document.getElementById('getArea').innerHTML = areaHttp.responseText;
}
};
areaHttp.open("GET",url);
areaHttp.send(null);
}
else
  document.getElementById('getArea').style.display = 'none';
}
function getAddtoContact(comid,code,num,type,comname)
{
	 window.location.href = 'wtai://wp/mc;'+num;
	 
  /*var url = '/includes/addtocontact.php?comid='+comid+'&code='+code+'&num='+num;
   http = new getHTTPObject();
   http.onreadystatechange = function(){
   if(http.readyState == 4)
   {
     var res = http.responseText;
	 //alert(res);
	// alert(type);
	//  if(res != '' && type == 'dail')
	//    window.location.href = 'wtai://wp/mc;'+num;
	//  else if(res != '' && type == 'addtocontact')
	   // window.location.href = 'wtai://wp/ap;'+num+';'+comname; 
   }
   }*/
   http.open("GET",url);
   http.send(null);
}
function getBannerClick(bannervars)
{
  var url = '/includes/bannerclicks.php?bannervar='+bannervars;
   http2 = new getHTTPObject();
   http2.onreadystatechange = function(){
   if(http2.readyState == 4)
   {
     var res1 = http2.responseText;
	 if(res1 != '')
	   window.location.href = 'wtai://wp/mc;'+res1;
   }
   }
   http2.open("GET",url);
   http2.send(null);
}


