<!--
var path  = 'property_img/';
var ie4 = (document.all) ? true : false;
var nn4 = (document.layers) ? true : false;

function DivBtnImg(divclass,text,Btnlog)
{
    document.getElementById("divtitle").innerHTML=text;
    document.getElementById("divtitle").className=divclass;
    document.getElementById("btnImg2").src='../images/'+Btnlog;
}


function OpenZoomImgWin(id){
	window.open("ShowPhoto.aspx?ID="+id, "Zoom","scrollbars=yes,width=600,height=560");
}
function OpenZoomImgRental(id){
	window.open("ShowPhotoRental.aspx?ID="+id, "Zoom","scrollbars=yes,width=600,height=560");
}
function OpenZoomImgSales(id){
	window.open("ShowPhotoSales.aspx?ID="+id, "Zoom","scrollbars=yes,width=600,height=560");
}
function ChangePhoto(filename){
    
	if (filename.substring(0,1).toUpperCase()=='H'){
		document.photo.src ='property_img/'+filename;
		document.photo.width=480;
		document.photo.height=360;
	}else if (filename.substring(0,1).toUpperCase()=='V'){
		document.photo.src ='property_img/'+filename;
		document.photo.width=360;
		document.photo.height=480;
	}else {
		document.photo.src ='property_img/default.jpg';
		document.photo.width=360;
		document.photo.height=480;
	}	
}


function ChangePhotoSearchResult(filename){
    
	if (filename.substring(0,1).toUpperCase()=='H'){
		document.photo.src ='property_img/'+filename;
		document.photo.width=240;
		document.photo.height=180;
	}else if (filename.substring(0,1).toUpperCase()=='V'){
		document.photo.src ='property_img/'+filename;
		document.photo.width=180;
		document.photo.height=240;
	}else {
		document.photo.src ='property_img/default.jpg';
		document.photo.width=180;
		document.photo.height=240;
	}	
}

function SelectFormCheck(){
	if (formSearch.price1.value==formSearch.price2.value) {
		alert(" The Low price can not be equal to the High price .");
		return false;
	}
}

function FormCheck(){
	 if (!CheckNotNull(document.SaleEnquireForm.firstname, "First Name")) {return false;}
	 if (!CheckNotNull(document.SaleEnquireForm.lastname, "Last Name")) {return false;}
	 if (!CheckNotNull(document.SaleEnquireForm.company, "Company Name")) {return false;}
	 if (!CheckNotNull(document.SaleEnquireForm.phone, "Phone Number")) {return false;} 
	 if (!CheckNotNull(document.SaleEnquireForm.email, "Your Email")) {return false;}
	 if (!CheckEmail(document.SaleEnquireForm.email, "")) {return false;}
}

function SaleAlertFormCheck(){
	 if (!CheckNotNull(document.SaleAlertForm.name, " Name")) {return false;}
	 if (!CheckNotNull(document.SaleAlertForm.email, "Your Email")) {return false;}
	 if (!CheckEmail(document.SaleAlertForm.email, "")) {return false;}
}

//去除字符串左端空格
function LTrim(str) {
  return str.replace(/^\s*/, '');
}

//去除字符串右端空格
function RTrim(str) {
  return str.replace(/\s*$/, '');
}

//去除字符串两端空格
function Trim(str) {
  return LTrim(RTrim(str));
}

//检查必填项
function CheckNotNull(objField, strText) {
  if (Trim(objField.value) == "") {
    alert("Please input " + strText + " ！");
    objField.focus();
    return false;
  }
  return true;
}

//检查字符串长度
function CheckStringLength(objField, strText, numMinLen, numMaxLen){
  if(objField.value == "") return true;
  if(numMinLen != null){
    if(objField.value.length < numMinLen){
      alert("“" + strText + "”的长度不能少于 " + numMinLen.toString() + " 个字符！");
      objField.focus();
      return false;
    }
  }
  if(numMaxLen != null){
    if(objField.value.length > numMaxLen){
      alert("“" + strText + "”的长度不能多于 " + numMaxLen.toString() + " 个字符！");
      objField.focus();
      return false;
    }
  }
  return true;
}

//检查输入内容是否为字母、数字和下划线
function CheckAlphaNumber(objField, strText, numMinLen, numMaxLen) {
  if (objField.value == "") return true;
  var RE = new RegExp("[^a-zA-Z0-9_]");
  if (objField.value.search(RE) != -1) {
    alert("“" + strText + "”中只能填写字母、数字或下划线！");
    objField.focus();
    return false;
  }
  return CheckStringLength(objField, strText, numMinLen, numMaxLen);
}

//检查字符串是否出现中文
function CheckNoChinese(objField, strText, numMinLen, numMaxLen) {
  if(objField.value == "") return true;
  var RE = new RegExp("[^\x01-\x7F]");
  if (objField.value.search(RE) != -1) {
    alert("“" + strText + "”中不能出现中文！");
    objField.focus();
    return false;		
  }
  return CheckStringLength(objField, strText, numMinLen, numMaxLen);
}

//检查是否为数字类型
function CheckNumber(objField, strText, numMinValue, numMaxValue) {
  if(objField.value == "") return true;
  if(isNaN(objField.value)){
    alert("“" + strText + "”中只能填写数字！");
    objField.focus();
    return false;
  }
  var numValue = parseFloat(objField.value);
  if(numMinValue != null){
    if(numValue < numMinValue){
      alert("“" + strText + "”的值不能小于 " + numMinValue.toString() + " ！");
      return false;
    }
  }
  if(numMaxValue != null){
    if(numValue > numMaxValue){
      objField.focus();
      alert("“" + strText + "”的值不能大于 " + numMaxValue.toString() + " ！");
      return false;
    }
  }
  return true;
}

//检查字符串是否由数字组成
function CheckInteger(objField,strText)
 {
  if(objField.value == "") return true;
  var numStr=objField.value;
  var cmpStr,tstChr
  for (var i=0;i<numStr.length;i++)
  {
   cmpStr="0123456789";
   tstChr=numStr.substring(i,i+1);
   if (cmpStr.indexOf(tstChr)<0)
   {
    alert("“" + strText + "”只能由数字组成！");
    objField.focus();
    return false;
   }
  }
  return true;
 }

//检查EMail格式
function CheckEmail(objField, strText){
  var objValue = Trim(objField.value);
  if(objValue=="") return true;

  var strErr = strText + "Please enter a VALID Email";
  var RE=/[^A-Za-z0-9_-]/;
  var parts=objValue.split("@");

  if (parts.length!=2)		//	not format as ***@***
  {
    alert(strErr);
    objField.focus();
    return false;
  }

  var oneparts;

  oneparts=parts[0].split(".");		//	first-parts
  
  for(i=0;i<oneparts.length;i++)
  {
    if (oneparts[i].length==0)	//连续两点..
    {
      alert(strErr);
      objField.focus();
      return false;
    }
    if (RE.exec(oneparts[i])!=null)
    {
      alert(strErr);
      objField.focus();
      return false;
    }
  }
  
  oneparts=parts[1].split(".");		//	second-parts

  if (oneparts.length<2)	//连续两点..
  {
    alert(strErr);
    objField.focus();
    return false;
  }

  for(i=0;i<oneparts.length;i++)
  {
    if (oneparts[i].length==0)	//连续两点..
    {
      alert(strErr);
      objField.focus();
      return false;
    }
    if (RE.exec(oneparts[i])!=null)
    {
      alert(strErr);
      objField.focus();
      return false;
    }
  }
  return true;
}

//检查日期类型
function CheckDate(objField,strText,dateMinumValue,dateMaxValue){
  if(objField.value=="") return true;
  
  //Check Data
  var dates=objField.value.split(new RegExp("-|/| |:"));
  for(var i=0;i<6;i++){
    if(isNaN(dates[i])){
      if(i<3){
        objField.focus();
        alert(strText+":日期错误！");
        return false;
      }else{
        dates[i]=0;
      }
    }else{
      if(i==1) dates[i]--;
    }
  }  
  if (dates[0]<100 && dates[0]>30) dates[0]=1900+parseInt(dates[0]);
  if (dates[0]<100 && dates[0]<=30) dates[0]=2000+parseInt(dates[0]);
  if (dates[0]<1900 || dates[0]>2100 || dates[1]>11 || dates[1]<0 || dates[2]>31 || dates[2]<1
   || dates[3]>60 || dates[4]>60 || dates[5]>60)
  {
    alert(strText+":日期错误！");
    return false;
  }
  var dateDate=new Date(dates[0],dates[1],dates[2],dates[3],dates[4],dates[5]);
  
  if(dateDate=="Invalid Date"){
    objField.focus();
    alert(strText+":日期错误！");
    return false;
  }

  //Out put date
  objField.value = dateDate.getFullYear()+"-"+(dateDate.getMonth()+1)+"-"+dateDate.getDate();
  if (dates[3]>0 || dates[4]>0 || dates[5]>0)	objField.value =objField.value+" "+dateDate.getHours()+":"+dateDate.getMinutes()+":"+dateDate.getSeconds();

  //Check minimum
  if(dateMinumValue!=null){
    if(dateDate<dateMinumValue){
      objField.focus();
      alert(strText+"不能早于 "+dateMinumValue.getFullYear()+"年"+(dateMinumValue.getMonth()+1)+"月"+dateMinumValue.getDate()+"日"+" ！");
      return false;
    }
  }
  //Check maximum
  if(dateMaxValue!=null){
    if(dateDate>dateMaxValue){
      objField.focus();
      alert(strText+"不能迟于 "+dateMaxValue.getFullYear()+"年"+(dateMaxValue.getMonth()+1)+"月"+dateMaxValue.getDate()+"日"+" ！");
      return false;
    }
  }
  return true;
}

//格式化日期
function FormatDate(strVal){
  if (strVal=="") return null;
      
  //Check Data
  var dates=strVal.split(new RegExp("-|/| |:"));
  for(var i=0;i<6;i++){
    if(isNaN(dates[i])){
      if(i<3){
        return null;
      }else{
        dates[i]=0;
      }
    }else{
      if(i==1) dates[i]--;
    }
  }
  var dateDate = new Date(dates[0],dates[1],dates[2],dates[3],dates[4],dates[5]);
  if(dateDate=="Invalid Date"){
    return null;
  }
  return dateDate;		
}

//输出日期
function getDate(strDate){
  if(strDate=="") return true;
  
  //Check Data
  var dates=strDate.split(new RegExp("-|/| |:"));
  for(var i=0;i<6;i++){
    if(isNaN(dates[i])){
      if(i<3){
        return false;
      }else{
        dates[i]=0;
      }
    }else{
      if(i==1) dates[i]--;
    }
  }
  if (dates[0]<100 && dates[0]>30) dates[0]=1900+parseInt(dates[0]);
  if (dates[0]<100 && dates[0]<=30) dates[0]=2000+parseInt(dates[0]);
  if (dates[0]<1900 || dates[0]>2100 || dates[1]>11 || dates[1]<0 || dates[2]>31 || dates[2]<1
   || dates[3]>60 || dates[4]>60 || dates[5]>60)
  {
    return false;
  }
  var dateDate=new Date(dates[0],dates[1],dates[2],dates[3],dates[4],dates[5]);
  
  if(dateDate=="Invalid Date"){
    return false;
  }

  //Out put date
  return dateDate;
}

//-->