function sendValue(myObj){
mapProgress();
  var d = document.propertySearch;
  var pTypeOpt = d.pTypeOpt.value;

new Ajax.Request('http://www.worldwideproperty.in/mapInfo.php',
    {
      method:'post',
      parameters: 'countryId=' + myObj + '&pTypeOpt=' + pTypeOpt, 
      onSuccess: function(transport){
        var response = transport.responseText || "Error: 10005...";
		
		initialize();
		var spliRes = response.split("###");
		//alert(spliRes.length);
		var len = spliRes.length
		for(i=0; i< (len-1); i++){
			var args = spliRes[i].split("@@@");
			showAddressList(args[0], args[1], args[2], args[3], args[4], 6, args[5], args[6]);
		}

      },
      onFailure: function(){ alert('Please refresh...') }
    });
}

var regID = 0;
function sendValueCity(myObj, regID){
//mapProgress();
var myObj1 = document.propertySearch.searchCountry.value;
if( regID == 0 || regID == undefined)
var myObj2 = document.propertySearch.county.value;
else
var myObj2 = regID;
var d = document.propertySearch;
var pTypeOpt = d.pTypeOpt.value;

 new Ajax.Request('http://www.worldwideproperty.in/mapInfo.php',
    {
      method:'post',
      parameters: 'countryId=' + myObj1 + '&regionId=' + myObj2 + '&cityId=' +myObj + '&pTypeOpt=' + pTypeOpt,  
      onSuccess: function(transport){
        var response = transport.responseText || "Error: 10005...";
		initialize();
		var spliRes = response.split("###");
		var len = spliRes.length
		//alert(response);
		for(i=0; i< (len-1); i++){
			var args = spliRes[i].split("@@@");
			showAddress(args[0], args[1], args[2], args[3], args[4], 11);
		}
      },
      onFailure: function(){ alert('Please refresh...') }
    });

}

function showDetailMap(myObj){
mapProgress();
new Ajax.Request('http://www.worldwideproperty.in/mapInfo1.php',
{
method:'post',
parameters: 'pId=' + myObj,
onSuccess: function(transport){
var response = transport.responseText || "Error: 10005...";
initialize();
var spliRes = response.split("###");
var len = spliRes.length
//alert(response);
for(i=0; i< (len-1); i++){
var args = spliRes[i].split("@@@");
showAddressDetail(args[0], args[1], args[2], args[3], args[4], parseInt(args[5]));
}
},
onFailure: function(){ alert('Please refresh...') }
});
}

function getPropertyCount1(pTypeOpt, countryID)
  {
	var d = document.propertySearch;
	var pTypeOpt = d.pTypeOpt.value;
	//alert(countryID);
	//var countryID= d.searchCountry.value;
	
  loadProgressajax();

	new Ajax.Request('http://www.worldwideproperty.in/propertyCount.php',
    {
	  method:'post',
      parameters: 'pTypeOpt=' + pTypeOpt + '&countryID=' + countryID,
      onSuccess: function(transport){
	    var response = transport.responseText || "Please Try Again...";

        $('ajaxNnumProperty').innerHTML = "";
        $('ajaxNnumProperty').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }

function getPropertyCount2(pTypeOpt, regionID)
  {
  
  loadProgressajax();
	var d = document.propertySearch;
	var pTypeOpt = d.pTypeOpt.value;
	var countryID= d.searchCountry.value;
	new Ajax.Request('http://www.worldwideproperty.in/propertyCount.php',
    {
	  method:'post',
      parameters: 'pTypeOpt=' + pTypeOpt + '&countryID=' + countryID + '&regionID=' + regionID,
      onSuccess: function(transport){
	    var response = transport.responseText || "Error: 10005...";

        $('ajaxNnumProperty').innerHTML = "";
        $('ajaxNnumProperty').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }


function getPropertyCount(pTypeOpt,regionID,cityID)
  {
  loadProgressajax();
  var d = document.propertySearch;

  var pTypeOpt = d.pTypeOpt.value;
  var countryID= d.searchCountry.value;
  var myLocVal = d.location.value;
  var myLocVal1 = myLocVal.split(",");
  if(myLocVal1[0] == "0"){
	  var regionID = myLocVal1[1];
	  var cityID = myLocVal1[2];
  }else if(myLocVal1[0] == "1"){
	var regionID = myLocVal1[1];
	var cityID = '';	
  }else{
	var regionID = '';
	var cityID = '';	
  }

  
	new Ajax.Request('http://www.worldwideproperty.in/propertyCount.php',
    {
	  method:'post',
      parameters: 'pTypeOpt=' + pTypeOpt + '&countryID=' + countryID + '&regionID=' + regionID + '&cityID=' + cityID,
      onSuccess: function(transport){
	    var response = transport.responseText || "Error: 10005...";

        $('ajaxNnumProperty').innerHTML = "";
        $('ajaxNnumProperty').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }


var response = '';


function getRegions(countryIds, pTypeOptLoad)
  {
  stateProgress();
  var d = document.propertySearch;
  var pTypeOptLoad = d.pTypeOpt.value;
  if(countryIds != ''){
  document.getElementById('map_canvas').style.height = "430px";
  document.getElementById('text_content').disabled = false;
  document.getElementById('letterButton').disabled = false;
  }else{
  document.getElementById('text_content').disabled = true;
  document.getElementById('letterButton').disabled = true;
  document.getElementById('map_canvas').style.height = "283px";
  document.getElementById('map-info-container').style.display = "none";
  }
	
   new Ajax.Request('http://www.worldwideproperty.in/frameregion.php',
   //new Ajax.Request('http://vv2/first/worldwideproperty/frameregion.php',
    {
	  method:'post',
      parameters: 'countryIds=' + countryIds + '&pTypeOptLoad=' + pTypeOptLoad,
      onSuccess: function(transport){
	    var response = transport.responseText || "Error: 10005...";
		
        $('regionTableAjax1').innerHTML = "";
        $('regionTableAjax1').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }

function getPropertyTypes(countryIds)
  {

  var d = document.propertySearch;
  if(countryIds != ''){
  document.getElementById('hideGo').disabled = false;
  document.getElementById('getAjaxType').disabled = false;
  //document.getElementById('location').disabled = false;
  }else{
  document.getElementById('hideGo').disabled = true;
  document.getElementById('getAjaxType').disabled = true;
  //document.getElementById('location').disabled = true;
  }

   new Ajax.Request('http://www.worldwideproperty.in/frametype.php',
    {
	  method:'post',
      parameters: 'countryIds=' + countryIds,
      onSuccess: function(transport){
	    var response = transport.responseText || "Error: 10005...";

        $('getAjaxType').innerHTML = "";
        $('getAjaxType').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
}

function sendValueReg1(myObj){
mapProgress();
var myObj1 = document.propertySearch.searchCountry.value;
var d = document.propertySearch;
var pTypeOpt = d.pTypeOpt.value;

 new Ajax.Request('mapInfo.php',
    {
      method:'post',
      parameters: 'countryId=' + myObj1 + '&regionId=' + myObj + '&pTypeOpt=' + pTypeOpt, 
      onSuccess: function(transport){
        var response = transport.responseText || "Error: 10005...";
		initialize();
		var spliRes = response.split("###");
		var len = spliRes.length
		for(i=0; i< (len-1); i++){
			var args = spliRes[i].split("@@@");
			showAddressListForRegion(args[0], args[1], args[2], args[3], args[4], 9, args[5], args[6], args[7]);
		}
      },
      onFailure: function(){ alert('Please refresh...') }
    });

}

function sendValueReg(myObj){
mapProgress();
var myObj1 = document.propertySearch.searchCountry.value;
var d = document.propertySearch;
var pTypeOpt = d.pTypeOpt.value;

 new Ajax.Request('mapInfo.php',
    {
      method:'post',
      parameters: 'countryId=' + myObj1 + '&regionId=' + myObj + '&pTypeOpt=' + pTypeOpt, 
      onSuccess: function(transport){
        var response = transport.responseText || "Error: 10005...";
		initialize();
		var spliRes = response.split("###");
		var len = spliRes.length
		for(i=0; i< (len-1); i++){
			var args = spliRes[i].split("@@@");
			showAddressListForRegion(args[0], args[1], args[2], args[3], args[4], 9, args[5], args[6], args[7]);
		}
      },
      onFailure: function(){ alert('Please refresh...') }
    });

}


function getPopularLocation(myObj){
var d = document.propertySearch;
var pTypeOpt = d.pTypeOpt.value;

if(myObj == ""){
$('ajaxPopularLocation').style.display = "none";
}else{
$('ajaxPopularLocation').style.display = "inline";
}

 new Ajax.Request('get-popular-location.php',
    {
      method:'post',
      parameters: 'countryId=' + myObj + '&pTypeOpt=' + pTypeOpt, 
      onSuccess: function(transport){
        var response = transport.responseText || "Please refresh...";
		$('ajaxPopularLocation').innerHTML = "";
        $('ajaxPopularLocation').innerHTML = response;
      },
      onFailure: function(){ alert('Please refresh...') }
    });

}



function loadProgressajaxCountry(){
$('ajaxCountryBox').innerHTML = "Country loading...";
}

function getAjaxCountry()
 {
	new Ajax.Request('http://www.worldwideproperty.in/ajaxcountrylist.php',
	//new Ajax.Request('http://vv2/first/worldwideproperty/ajaxcountrylist.php',
    {
	  method:'post',
      parameters: '',
      onSuccess: function(transport){
	    var response = transport.responseText || "Sorry please refresh...";
		
        $('ajaxCountryBox').innerHTML = "";
        $('ajaxCountryBox').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
}

function popup(strFile, intWidth, intHeight) {
  var desktop;
  if (desktop && desktop.location) desktop.close();
  desktop = window.open(strFile, "_blank","toolbar=0,location=0,position=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=1, left=100,top=200,width=" + intWidth + ",height=" + intHeight);
}
function previewopen(url)
{
	var wi = 480;
	var hi = 450;
	newWindow = window.open(url,'daughter','menubar=no,toolbar=no,location=no,scrollbars=yes,resizable=no,width='+wi+',height='+hi+',screenX=100,screenY=10,top=10,left=10');
	if (newWindow.opener == null) newWindow.opener = self;
	newWindow.focus();
}

function sendLocation(locationvalues)
{
	explocation = locationvalues.split(",");
	loctype = explocation[0];
	locreg = explocation[1];
	loccity = explocation[2];
	loccount = explocation[3];
	if(loctype == "1")
	{
		sendValueReg1(locreg);	
		getPropertyCount2(loccity,locreg)
	}
	if(loctype == "0")
	{
		sendValueCity(loccity,locreg);
		getPropertyCount(loccount,locreg,loccity);
	}
	
}

function stateProgress()
{
	document.getElementById("regionTableAjax1").innerHTML = "<img src='http://www.worldwideproperty.in/images/loading.gif' border='0' >";	
}

function stateProgressBar()
{
	document.getElementById("ajaxLoadProperty").innerHTML = "<img src='http://www.worldwideproperty.in/images/loading.gif' border='0' >";	
}
function mapProgress(){
	document.getElementById("map_canvas").innerHTML = "<div align=center><img src='http://www.worldwideproperty.in/images/loading_m.gif' border='0' ></div>";	
}

function toggleContents1(act)
{
	if(act == 1){
	document.getElementById('content_div1').style.display = "block";
	document.getElementById('frame1').style.height = '150';
	return;
	}else{
	document.getElementById('content_div1').style.display = "none";
	document.getElementById('frame1').style.height = '0';
	}
}
function validKeySearch()
{
	
	if(document.propertysearch.location.value == "Enter Location Region City Town")	{
		alert("Please enter your key_word");
		return false;
	}
return true;
}

function validpropSearch()
{
	if(document.propertysearch.propertyTy.value == "")	{
		alert("Please Select Property Type");
		document.propertysearch.propertyTy.focus();
		return false;
	}
return true;
}

function validLocSearch()
{
	if(document.propertysearch.locationarea.value == "0")	{
		alert("Please select location");
		return false;
	}
return true;
}

function validRefSearch()
{
	if(document.qSear.ref_no.value == "")	{
		alert("Please enter your Property no");
		document.qSear.ref_no.focus();
		return false;
	}
return true;
}	

function rescheckform(){
	frm = document.propertySearch;
	return true;
}
function holcheckform(){
	frm = document.propertySearch;

	if(frm.searchCountry.value=='' && frm.county.value=='' && frm.city.value=='' && frm.bedroom.value==''  && frm.priceFrom.value=='' && frm.priceTo.value==''){
		alert('Please enter atleast anyone !!!');
		return false;
	}
	if(frm.priceTo.value!='' && frm.priceFrom.value==''){
		alert('Please Enter Price From !!!');
		frm.priceFrom.focus();
		return false;
	}
	return true;
}	
function comcheckform(){
	frm = document.propertySearch;

	if(frm.searchCountry.value=='' && frm.county.value=='' && frm.city.value=='' &&  frm.priceFrom.value=='' && frm.priceTo.value==''){
		alert('Please enter atleast anyone !!!');
		return false;
	}
	if(frm.priceTo.value!='' && frm.priceFrom.value==''){
		alert('Please Enter Price From !!!');
		frm.priceFrom.focus();
		return false;
	}
	return true;
}
function newcheckform(){
	frm = document.propertySearch;
	if(frm.searchCountry.value=='' && frm.county.value=='' && frm.city.value=='' && frm.mSqu.value=='' && frm.priceFrom.value=='' && frm.priceTo.value==''){
		alert('Please enter atleast anyone !!!');
		return false;
	}
	if(frm.priceTo.value!='' && frm.priceFrom.value==''){
		alert('Please Enter Price From !!!');
		frm.priceFrom.focus();
		return false;
	}
	return true;
}
function lancheckform(){
	frm = document.propertySearch;

	if(frm.searchCountry.value=='' && frm.county.value=='' && frm.city.value=='' && frm.mSqu.value=='' && frm.priceFrom.value=='' && frm.priceTo.value==''){
		alert('Please enter atleast anyone !!!');
		return false;
	}
	if(frm.priceTo.value!='' && frm.priceFrom.value==''){
		alert('Please Enter Price From !!!');
		frm.priceFrom.focus();
		return false;
	}
	return true;
}

function ss1(){
	if(document.frm1.idSearch.value == ''){
		alert('Please Enter Property ID...');
		document.frm1.idSearch.focus;
		return false;
	}
return true;
}
function ss2(){
	if(document.propertySearch.location.value == 'Enter Location Region City Town' || document.propertySearch.location.value == ''){
		alert('Please Enter Property Name OR Location (region / city / address / postcode)...');
		document.propertySearch.location.focus;
		return false;
	}
return true;
}

function ss3(){
	if(document.propertySearch.searchCountry.value == ''){
		alert('Please Select Country...');
		document.propertySearch.searchCountry.focus;
		return false;
	}
return true;
}

function ss4(){
	if(document.propertySearch.locationarea.value == ''){
		alert('Please Select Location...');
		document.propertySearch.locationarea.focus;
		return false;
	}
return true;
}
function checkhelp()
	{
	frm = document.checkrightform;
	
	if(frm.helpname.value=='')
	{
		alert('Please Enter Your First Name');
		frm.helpname.focus();
		return false;
	}
	if(frm.helpemail.value=='')
	{
		alert('Please Enter Your Email');
		frm.helpemail.focus();
		return false;
	}
	if(frm.helpemail.value!="")
	{
		var str = frm.helpemail.value;
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str))
		{ 	// if syntax is valid
	   		//return true;
		}
		else
		{
			alert ("Please Fill Proper email");
			frm.helpemail.focus();
			return false;
		}
	}
	if(frm.helpnumber.value=='')
	{
		alert('Please Enter Your Number');
		frm.helpnumber.focus();
		return false;
	}
	if(frm.helpenquiry.value=='')
	{
		alert('Please Enter Your Enquiry');
		frm.helpenquiry.focus();
		return false;
	}
	if(frm.securitycode.value=='')
	{
		alert('Please Enter Security code');
		frm.securitycode.focus();
		return false;
	}
return true;
}

function showMoreLang(){
if(document.getElementById('langGoogle').style.display == 'none')
    document.getElementById('langGoogle').style.display='inline';
else
	document.getElementById('langGoogle').style.display='none';
}

function getRegionsLeft(countryIds)
  {
  stateProgress();
  var d = document.searchLleftform;
	// new Ajax.Request('http://vv2/first/worldwideproperty/frameleftregion.php',
    new Ajax.Request('http://www.worldwideproperty.in/frameleftregion.php',
    {
	  method:'post',
      parameters: 'countryIds=' + countryIds ,
      onSuccess: function(transport){
	    var response = transport.responseText || "Error: 10005...";

        $('regionTableAjax1').innerHTML = "";
        $('regionTableAjax1').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }

function getToPrice(fromPriceIds, toPriceId)
  {
	//new Ajax.Request('http://vv2/first/worldwideproperty/fromPrice.php',
	new Ajax.Request('http://www.worldwideproperty.in/fromPrice.php',
    {
	  method:'post',
      parameters: 'fromPriceIds=' + fromPriceIds + '&toPriceId=' + toPriceId,
      onSuccess: function(transport){
	    var response = transport.responseText || "Error: 10005...";
        document.getElementById('PriceTableAjax').innerHTML = "";
        document.getElementById('PriceTableAjax').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });

  }   
function getAjaxCountryListPage(selCountry)
  {
	
	//new Ajax.Request('http://vv2/first/worldwideproperty/ajaxcountrysearchpage.php',
	new Ajax.Request('http://www.worldwideproperty.in/ajaxcountrysearchpage.php',
    {
	  method:'post',
      parameters: 'searchCountry='+ selCountry,
      onSuccess: function(transport){
	    var response = transport.responseText || "Sorry please refresh...";
		
        $('ajaxCountryBoxLeftSearch').innerHTML = "";
        $('ajaxCountryBoxLeftSearch').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }

function TooltipTxt(n)
{
    return "<div style='background-color:#5A85C7;color:#ffffff;line-height:21px;'><b>&nbsp;Key Points</b></div>" + n ;
}
function emailtoFriendVal(){
	var frm = document.emailtoFriend;
	if(frm.friendName.value == "")
	{
		alert("Please enter your friend name.");
		frm.friendName.focus();
		return false;
	}
	if(frm.friendEmail.value=='')
	{
		alert("Please enter your friend email address");
		frm.friendEmail.focus();
		return false;
	}
	if(frm.friendEmail.value!="")
	{
		var str = frm.friendEmail.value;
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str))
		{ 	// if syntax is valid
	   		//return true;
		}
		else
		{
			alert ("Please enter proper email address");
			frm.friendEmail.focus();
			return false;
		}
	}
	if(frm.yourName.value == "")
	{
		alert("Please enter your name.");
		frm.yourName.focus();
		return false;
	}
	if(frm.yourEmail.value=='')
	{
		alert("Please enter your email address");
		frm.yourEmail.focus();
		return false;
	}
	if(frm.yourEmail.value!="")
	{
		var str = frm.yourEmail.value;
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str))
		{ 	// if syntax is valid
	   		//return true;
		}
		else
		{
			alert ("Please enter proper email address");
			frm.yourEmail.focus();
			return false;
		}
	}
return true;
}


function loadProgressajax(){
$('ajaxNnumProperty').innerHTML = "loading...";
}
// Initialize version 1.0 of Google AJAX API
google.load("language", "1");
function translate(lang, divID, transID) {
//alert(divID);
var content = document.getElementById(divID).innerHTML;
//var source = stripHTML(content);
var source = content;

var len = source.length;
//var len1 = document.getElementById(divID);
//len = content.length;

// Google Language API accepts 500 characters per request
var words = 500;

// This is for English pages, you can change the
// sourcelang variable for other languages
var sourcelang = "en";
document.getElementById(transID).innerHTML = "";

for(i=0; i<=(len/words); i++) {
google.language.translate (source.substr(i*words, words),
"en", lang, function (result) {
if (!result.error) {
document.getElementById(transID).innerHTML = document.getElementById(transID).innerHTML + result.translation;
} }); }

// Hide the text written in the original language
document.getElementById(divID).style.display = 'none';
return false;
}



  function getPropertyCount3(pTypeOpt, countryID)
  {
	var d = document.propertySearch;
	var pTypeOpt = 0;
	
  loadProgressajax();

	new Ajax.Request('http://www.worldwideproperty.in/propertyCount.php',
    {
	  method:'post',
      parameters: 'pTypeOpt=' + pTypeOpt + '&countryID=' + countryID,
      onSuccess: function(transport){
	    var response = transport.responseText || "Please Try Again...";

        $('ajaxNnumProperty').innerHTML = "";
        $('ajaxNnumProperty').innerHTML = response;
        },
      onFailure: function(){ alert('Something went wrong...') }
    });
  }

if (top.location != self.location) {
  top.location = self.location.href
 }
