﻿function defaultButtonFix() {
__defaultFired = false;
}
function addPropertyType()
{

drpPropertyType=document.getElementById('ctl00_ContentPlaceHolder1_drpPropertyType');

dpPackageId=document.getElementById('ctl00_ContentPlaceHolder1_dpPackageId');
for(i=drpPropertyType.options.length;i>=0;i--)
{

drpPropertyType.options.remove(i);
}
 var elOptNew = document.createElement('option');
        elOptNew.text = "--Select--";
        elOptNew.value = "";

if(dpPackageId.selectedIndex==1 || dpPackageId.selectedIndex==2 || dpPackageId.selectedIndex==4 || dpPackageId.selectedIndex==5 || dpPackageId.selectedIndex==6)
{

    drpPropertyType.add(elOptNew); 
    elOptNew = document.createElement('option');
        elOptNew.text = "Basic";
        elOptNew.value = "2";
    drpPropertyType.add(elOptNew); 
  
    elOptNew = document.createElement('option');
        elOptNew.text = "Prime";
        elOptNew.value = "1";

    drpPropertyType.add(elOptNew); 
    
} 
else if(dpPackageId.selectedIndex==3)
{
 drpPropertyType.add(elOptNew); 
    elOptNew = document.createElement('option');
        elOptNew.text = "Basic and Prime";
        elOptNew.value = "2~1";
    drpPropertyType.add(elOptNew); 
  
    elOptNew = document.createElement('option');
        elOptNew.text = "Prime";
        elOptNew.value = "1";

    drpPropertyType.add(elOptNew); 


}
else

{
 drpPropertyType.add(elOptNew); 
    elOptNew = document.createElement('option');
        elOptNew.text = "Basic";
        elOptNew.value = "2";
    drpPropertyType.add(elOptNew); 
  
    elOptNew = document.createElement('option');
        elOptNew.text = "Prime";
        elOptNew.value = "1";

    drpPropertyType.add(elOptNew);
    
     elOptNew = document.createElement('option');
        elOptNew.text = "Magnum";
        elOptNew.value = "4";

    drpPropertyType.add(elOptNew);
    
    
    
    }
}
 function PrintDateCheck(sender, args)
 {

 args.IsValid=compareIndianDates(document.getElementById('ctl00_ContentPlaceHolder1_dpFrom_txt_Date'),'From Date',document.getElementById('ctl00_ContentPlaceHolder1_dpTo_txt_Date'),'To Date')
 
 return args.IsValid;
 
 }
 
 

function ValidateHome()
{
ddlMinAmt=document.aspnetForm.ddlMinAmt;

ddlMaxAmt=document.aspnetForm.ddlMaxAmt;
ddlMinAmtType=document.aspnetForm.ddlMinAmtType;
ddlMaxAmtType=document.aspnetForm.ddlMaxAmtType;


if(parseInt(ddlMinAmt.value)!=0 && parseInt(ddlMinAmtType.value)!=0 && parseInt(ddlMaxAmt.value)!=0 && parseInt(ddlMaxAmtType.value)!=0)
{
if((parseInt(ddlMinAmt.value)*parseInt(ddlMinAmtType.value))>(parseInt(ddlMaxAmt.value)*parseInt(ddlMaxAmtType.value)))
{

alert("From Range Should be Less than To Range")
ddlMinAmt.selectedIndex=0;
ddlMaxAmt.selectedIndex=0;
ddlMinAmtType.selectedIndex=0;
ddlMaxAmtType.selectedIndex=0;
ddlMinAmt.focus();
}
}


}

function Validate()
{
//For Sale
ddlMinAmt=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlMinAmt;

ddlMaxAmt=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlMaxAmt;
ddlMinAmtType=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlMinAmtType;
ddlMaxAmtType=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlMaxAmtType;


if(parseInt(ddlMinAmt.value)!=0 && parseInt(ddlMinAmtType.value)!=0 && parseInt(ddlMaxAmt.value)!=0 && parseInt(ddlMaxAmtType.value)!=0)
{
if((parseInt(ddlMinAmt.value)*parseInt(ddlMinAmtType.value))>(parseInt(ddlMaxAmt.value)*parseInt(ddlMaxAmtType.value)))
{

alert("From Range Should be Less than To Range")
ddlMinAmt.selectedIndex=0;
ddlMaxAmt.selectedIndex=0;
ddlMinAmtType.selectedIndex=0;
ddlMaxAmtType.selectedIndex=0;
ddlMinAmt.focus();
}
}
// for Rent
ddlRMin=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlRMin;
ddlRUnit=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlRUnit;
ddlRMax=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlRMax;
ddlRUnitMax=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlRUnitMax;

if(ddlRMin!=null)
{
if(parseInt(ddlRMin.value)!=0 && parseInt(ddlRUnit.value)!=0 && parseInt(ddlRMax.value)!=0 && parseInt(ddlRUnitMax.value)!=0)
{
if((parseInt(ddlRMin.value)*parseInt(ddlRUnit.value))>(parseInt(ddlRMax.value)*parseInt(ddlRUnitMax.value)))
{

alert("From Range Should be Less than To Range")

ddlRMin.selectedIndex=0;
ddlRMax.selectedIndex=0;
ddlRUnit.selectedIndex=0;
ddlRUnitMax.selectedIndex=0;

ddlRMin.focus();
}
}
}
//for Rent Advance
ddlRMin=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlAMinAmt;
ddlRUnit=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlAMinAmtUnit;
ddlRMax=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlAMaxAmt;
ddlRUnitMax=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlAMaxAmtUnit;

if(ddlRMin!=null)
{
if(parseInt(ddlRMin.value)!=0 && parseInt(ddlRUnit.value)!=0 && parseInt(ddlRMax.value)!=0 && parseInt(ddlRUnitMax.value)!=0)
{
if((parseInt(ddlRMin.value)*parseInt(ddlRUnit.value))>(parseInt(ddlRMax.value)*parseInt(ddlRUnitMax.value)))
{

alert("From Range Should be Less than To Range")

ddlRMin.selectedIndex=0;
ddlRMax.selectedIndex=0;
ddlRUnit.selectedIndex=0;
ddlRUnitMax.selectedIndex=0;

ddlRMin.focus();
}
}
}

//for Lease
ddlRMin=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlLMin;
ddlRUnit=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlLMinUnit;
ddlRMax=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlLMax;
ddlRUnitMax=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlLMaxUnit;

if(ddlRMin!=null)
{
if(parseInt(ddlRMin.value)!=0 && parseInt(ddlRUnit.value)!=0 && parseInt(ddlRMax.value)!=0 && parseInt(ddlRUnitMax.value)!=0)
{
if((parseInt(ddlRMin.value)*parseInt(ddlRUnit.value))>(parseInt(ddlRMax.value)*parseInt(ddlRUnitMax.value)))
{

alert("From Range Should be Less than To Range")
ddlRMin.selectedIndex=0;
ddlRMax.selectedIndex=0;
ddlRUnit.selectedIndex=0;
ddlRUnitMax.selectedIndex=0;
ddlRMin.focus();
}
}
}
}
// JScript File
function AllowOnlyNumeric(e)
{
	
     var key = (window.event) ? event.keyCode : e.which;  
	//alert(key) 
if ( key > 47 && key < 58 || key == 46 || key==8 || key==45)  
   return;
 else
 {
   if (window.event) 
       window.event.returnValue = null;
     else 
     e.preventDefault(); 
	 }
}
// JScript File

function AllowOnlyNumericDotDash(e)
{
	
     var key = (window.event) ? event.keyCode : e.which;  
	
if ( key > 47 && key < 58 || key == 46 || key==8 || key==45)  
   return;
 else
 {
   if (window.event) 
       window.event.returnValue = null;
     else 
     e.preventDefault(); 
	 }
}
function AllowOnlyNumericDot(e)
{
	
     var key = (window.event) ? event.keyCode : e.which;  
	
if ( key > 47 && key < 58 || key == 46 || key==8)  
   return;
 else
 {
   if (window.event) 
       window.event.returnValue = null;
     else 
     e.preventDefault(); 
	 }
}
function EnableCity(obj)
{
txtCity=document.aspnetForm.ctl00_ContentPlaceHolder1_txtCity;


if(obj.value=="0" || obj.value=="100000")
{

txtCity.style.display="inline";
}
else
{
txtCity.style.display="none";


}
}
function EnableStateText(obj)
{
ddlCity=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlCity;
txtState=document.aspnetForm.ctl00_ContentPlaceHolder1_txtState;
txtCity=document.aspnetForm.ctl00_ContentPlaceHolder1_txtCity;
if(obj.value=="36")
{


txtState.style.display="inline";
txtCity.style.display="inline";

}
else
{


txtState.style.display="none";
txtCity.style.display="none";
}
}
function EnableState(obj)
{

ddlCity=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlCity;
ddlState=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlState;
txtState=document.aspnetForm.ctl00_ContentPlaceHolder1_txtState;
txtCity=document.aspnetForm.ctl00_ContentPlaceHolder1_txtCity;

if(obj.value!="1")
{
ddlCity.style.display="none";
ddlState.style.display="none";
txtState.style.display="inline";
txtCity.style.display="inline";

}
else
{


ddlCity.style.display="inline";
ddlState.style.display="inline";
txtState.style.display="none";
txtCity.style.display="none";

}
}


function EnableControls(Val)
{
ddlArea=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlArea;
ddlPrice=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlPrice;

if(Val==3 || Val==4 || Val==12 || Val==20 || Val==21)
{
document.getElementById("divbed").style.display="block";
document.getElementById("divFloors").style.display="block";
document.getElementById("divAge").style.display="block";
document.getElementById("divBuilt").style.display="block";

}
else if(Val==1 || Val==2 || Val==5 || Val==6 || Val==14 || Val==15 || Val==19 || Val==21)
{
document.getElementById("divbed").style.display="none";
document.getElementById("divFloors").style.display="none";
document.getElementById("divAge").style.display="none";
document.getElementById("divBuilt").style.display="none";
}
else
{

document.getElementById("divbed").style.display="none";
document.getElementById("divFloors").style.display="block";
document.getElementById("divAge").style.display="block";

document.getElementById("divBuilt").style.display="block";

}


if(Val==4)
{
if(document.getElementById("divUArea")!=null)
{
document.getElementById("divUArea").style.display="block";
document.getElementById("divbed").style.display="none";
}
}
else
{
if(document.getElementById("divUArea")!=null)
document.getElementById("divUArea").style.display="none";

}
if(document.getElementById("ChangeArea")!=null)
{
if(Val==4)
{
document.getElementById("ChangeArea").innerHTML="Flat Area";
}
else if(Val==6 || Val==15 || Val==19|| Val==20)
{
document.getElementById("ChangeArea").innerHTML="Land Area";
}
else if(Val==8 || Val==9 || Val==10 || Val==11 || Val==16)
{
document.getElementById("ChangeArea").innerHTML="Empty Space Available";

}
else
{
document.getElementById("ChangeArea").innerHTML="Site Area";
}
}


if(Val==15 || Val==16 || Val==17 || Val==18 || Val==19 || Val==20 )
{
    if(ddlArea.length==4)
    {
      var elOptNew = document.createElement('option');
        elOptNew.text = "Acres";
        elOptNew.value = 2;

    ddlArea.add(elOptNew,2); 

    }
    if(ddlPrice.length==3)
    {
      var elOptNew = document.createElement('option');
        elOptNew.text = "Per Acre";
        elOptNew.value = 2;

    ddlPrice.add(elOptNew,2); 

    }

}
else
{
if(ddlArea.length==5)
ddlArea.remove(2);
if(ddlPrice!=null)
if(ddlPrice.length==4)
ddlPrice.remove(2);

}
rdnType_1=document.aspnetForm.ctl00_ContentPlaceHolder1_rdnType_1;
if(rdnType_1.checked)
{
document.getElementById("divbed").style.display="none";
document.getElementById("divFloors").style.display="none";
document.getElementById("divAge").style.display="none";
document.getElementById("divBuilt").style.display="none";
document.getElementById("divUArea").style.display="none";
document.getElementById("ChangeArea").innerHTML="Land Area";
}
}


function EnLocationText(Val)
{

txtLocation=document.aspnetForm.ctl00_ContentPlaceHolder1_txtLocation;

if(Val.options(Val.selectedIndex).text=="Others")
{
txtLocation.style.display="inline";

}
else
{
txtLocation.style.display="none";


}
}


function isDimension(Val)
{
TextD1=document.aspnetForm.ctl00_ContentPlaceHolder1_TextD1;
TextD2=document.aspnetForm.ctl00_ContentPlaceHolder1_TextD2;
txtArea=document.aspnetForm.ctl00_ContentPlaceHolder1_txtArea;

if(Val==3 || Val==4)
{
TextD1.style.display="inline";
TextD2.style.display="inline";
txtArea.style.display="none";
document.getElementById("x").style.display="inline";
}
else
{
TextD1.style.display="none";
TextD2.style.display="none";
txtArea.style.display="inline";
document.getElementById("x").style.display="none";

}


}

function isDimensionSearch(Val)
{
TextD1=document.aspnetForm.ctl00_ContentPlaceHolder1_TextD1;
TextD2=document.aspnetForm.ctl00_ContentPlaceHolder1_TextD2;
txtAreaMin=document.aspnetForm.ctl00_ContentPlaceHolder1_txtAreaMin;
txtAreaMax=document.aspnetForm.ctl00_ContentPlaceHolder1_txtAreaMax;

if(Val==3 || Val==4)
{
TextD1.style.display="inline";
TextD2.style.display="inline";
txtAreaMin.style.display="none";
txtAreaMax.style.display="none";
document.getElementById("To").style.display="none";

document.getElementById("x").style.display="inline";
}
else
{
TextD1.style.display="none";
TextD2.style.display="none";
txtAreaMin.style.display="inline";
txtAreaMax.style.display="inline";
document.getElementById("To").style.display="inline";
document.getElementById("x").style.display="none";

}


}

function Display()
{
rdnType_2=document.aspnetForm.ctl00_ContentPlaceHolder1_rdnType_2;
rdnType_0=document.aspnetForm.ctl00_ContentPlaceHolder1_rdnType_0;
rdnType_1=document.aspnetForm.ctl00_ContentPlaceHolder1_rdnType_1;
rdnType_3=document.aspnetForm.ctl00_ContentPlaceHolder1_rdnType_3;
ddlPtype=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlPtype;
if(rdnType_2.checked)
{
document.getElementById("div2").style.display="none";
document.getElementById("div1").style.display="block";
document.getElementById("div3").style.display="none";
}
else if(rdnType_3.checked)

{

document.getElementById("div1").style.display="none";
document.getElementById("div2").style.display="block";
document.getElementById("div3").style.display="none";

}
else

{
document.getElementById("div1").style.display="none";
document.getElementById("div2").style.display="none";
document.getElementById("div3").style.display="block";

}
}



function DisFloors()
    {

  
   var val=parseInt(document.getElementById("ctl00_ContentPlaceHolder1_ddlFloor").value)
    
    for(i=1;i<=5;i++)
   {
   
   document.getElementById("spn" + i).style.display="none";  
   
   
   
   }
   for(i=1;i<=5;i++)
   {
   if(i<=val)
   {
   document.getElementById("spn" + i).style.display="inline";  
   
   }
   
   }
   
    
    }
   
   

   
function CheckPType(source, args)
{
args.IsValid = true;
ddlPtype=document.getElementById("ctl00_ContentPlaceHolder1_ddlPtype").value

if(ddlPtype=="0")
{
args.IsValid = false;

}
return args.IsValid;

}
function ValidatePass(source, args)
{
args.IsValid = true;
txtUSname=document.getElementById("ctl00_ContentPlaceHolder1_txtUSname").value
txtEmail=document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value

if(txtUSname=="" && txtEmail=="")
{
args.IsValid = false;

}
return args.IsValid;

}
function CheckPAllotment(source, args)
{
args.IsValid = true;
ddlPtype=document.getElementById("ctl00_ContentPlaceHolder1_allotment").value

if(ddlPtype=="0")
{
args.IsValid = false;

}
return args.IsValid;

}
function CheckPOwner(source, args)
{
args.IsValid = true;
ddlPtype=document.getElementById("ctl00_ContentPlaceHolder1_ownership").value

if(ddlPtype=="0")
{
args.IsValid = false;

}
return args.IsValid;

}
function CheckCity(source, args)
{
args.IsValid = true;
ddlPtype=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity").options[document.getElementById("ctl00_ContentPlaceHolder1_ddlCity").selectedIndex].text;

ddlCityText=document.getElementById("ctl00_ContentPlaceHolder1_txtCity").value
if(ddlPtype=="Others")
{

 if(ddlCityText=="")
args.IsValid = false;

}
return args.IsValid;

}
function CheckCitySearch(source, args)
{
args.IsValid = true;
ddlPtype=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity").value
if(ddlPtype=="Select")
{

 
args.IsValid = false;

}
return args.IsValid;

}
function CheckLengthDesc(source, args)
{
args.IsValid = true;
ddlPDesc=document.getElementById("ctl00_ContentPlaceHolder1_txtMessage").value
if(ddlPDesc.length<50)
{
args.IsValid = false;


}
return args.IsValid;

}


function CheckLayout(source, args)
{
args.IsValid = true;
ddlPtype=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity").options[document.getElementById("ctl00_ContentPlaceHolder1_ddlCity").selectedIndex].text;
ddlLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation").options[document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation").selectedIndex].text;
txtLocation=document.getElementById("ctl00_ContentPlaceHolder1_txtLocation").value

if(ddlPtype=="Others")
{
if(txtLocation=="")
args.IsValid = false;
}
else
{

if(ddlLocation=="Select")
args.IsValid = false;

if(ddlLocation=="Others" || ddlLocation=="1216")
{
if(txtLocation=="")
args.IsValid = false;

}

}

return args.IsValid;

}



function CheckLayoutSearch(source, args)
{
args.IsValid = true;
ddlLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation").value

if(ddlLocation=="Select")
args.IsValid = false;


return args.IsValid;

}



function CheckPrice(source, args)
{
args.IsValid = true;

ddlPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice").value
ddlCAmount=document.getElementById("ctl00_ContentPlaceHolder1_ddlCAmount").value
ddlLAmount=document.getElementById("ctl00_ContentPlaceHolder1_ddlLAmount").value
ddlTAmount=document.getElementById("ctl00_ContentPlaceHolder1_ddlTAmount").value
ddlHAmount=document.getElementById("ctl00_ContentPlaceHolder1_ddlHAmount").value

if((ddlPrice!="0") && (ddlCAmount=="0" && ddlLAmount=="0" && ddlTAmount=="0" && ddlHAmount=="0"))
{
args.IsValid = false;
return args.IsValid;
}
if((ddlPrice=="0") && (ddlCAmount!="0" || ddlLAmount!="0" || ddlTAmount!="0" || ddlHAmount!="0"))
{
args.IsValid = false;
return args.IsValid;
}
return args.IsValid;

}
function CheckSiteArea(source, args)
{
args.IsValid = true;

ddlPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlArea").value
ddlCAmount=document.getElementById("ctl00_ContentPlaceHolder1_txtArea").value
ddlLAmount=document.getElementById("ctl00_ContentPlaceHolder1_TextD1").value
ddlTAmount=document.getElementById("ctl00_ContentPlaceHolder1_TextD2").value

if((ddlPrice=="0") || (ddlCAmount=="" && ddlLAmount=="" && ddlTAmount==""))
{
args.IsValid = false;
return args.IsValid;
}

if((ddlPrice=="1" || ddlPrice=="2") && (ddlCAmount==""))
{
args.IsValid = false;
return args.IsValid;
}
if((ddlPrice=="3" || ddlPrice=="4") && (ddlLAmount=="" || ddlTAmount==""))
{
args.IsValid = false;
return args.IsValid;
}

return args.IsValid;

}

function CheckSiteAreaSearch(source, args)
{
args.IsValid = true;

ddlArea=document.getElementById("ctl00_ContentPlaceHolder1_ddlArea").value
txtMinArea=document.getElementById("ctl00_ContentPlaceHolder1_txtAreaMin").value
txtMaxArea=document.getElementById("ctl00_ContentPlaceHolder1_txtAreaMax").value
TextD1=document.getElementById("ctl00_ContentPlaceHolder1_TextD1").value
TextD2=document.getElementById("ctl00_ContentPlaceHolder1_TextD2").value
if(ddlArea=="0")
{
    if(txtMinArea!="" || txtMaxArea!="" || TextD1!="" || TextD2!="")
    {
    args.IsValid=false;
    }
}
else if(ddlArea=="3")
{
if(TextD1=="" || TextD2=="")
    {
    args.IsValid=false;
    }
}
else
{
if(txtMinArea=="" || txtMaxArea=="")
    {
    args.IsValid=false;
    }

}


return args.IsValid;

}
function ValidBudget(source, args)
{
args.IsValid = true;

ddlMinPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlMinPrice").value
ddlMinPriceUnit=document.getElementById("ctl00_ContentPlaceHolder1_ddlMinPriceUnit").value
ddlMaxPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlMaxPrice").value
ddlMaxPriceUnit=document.getElementById("ctl00_ContentPlaceHolder1_ddlMaxPriceUnit").value
valP=parseInt(ddlMinPrice)*parseInt(ddlMinPriceUnit)
val=parseInt(ddlMaxPrice)*parseInt(ddlMaxPriceUnit)

if(valP>val)
{


args.IsValid = false;
}

return args.IsValid;

}

function ValidBudgetHome(source, args)
{
args.IsValid = true;
ddlMinPrice=document.getElementById("ddlMinPrice").value
ddlMinPriceUnit=document.getElementById("ddlMinPriceUnit").value
ddlMaxPrice=document.getElementById("ddlMaxPrice").value
ddlMaxPriceUnit=document.getElementById("ddlMaxPriceUnit").value
valP=parseInt(ddlMinPrice)*parseInt(ddlMinPriceUnit)
val=parseInt(ddlMaxPrice)*parseInt(ddlMaxPriceUnit)
if(valP>val)
{


args.IsValid = false;
}

return args.IsValid;

}

function CheckBuiltAreaSearch(source, args)
{
args.IsValid = true;

ddlArea=document.getElementById("ctl00_ContentPlaceHolder1_ddlBArea").value
txtMinArea=document.getElementById("ctl00_ContentPlaceHolder1_txtBAreaMin").value
txtMaxArea=document.getElementById("ctl00_ContentPlaceHolder1_txtBAreaMax").value
if((parseInt(ddlArea)!=0) && (txtMinArea=="" || txtMaxArea==""))
{


args.IsValid = false;
}

if(parseInt(ddlArea)==0 && (txtMinArea!="" || txtMaxArea!=""))
{

args.IsValid = false;
}


return args.IsValid;

}

function CheckBudget(source, args)
{
args.IsValid = true;

ddlMinPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlMinPrice").value
ddlMinPriceUnit=document.getElementById("ctl00_ContentPlaceHolder1_ddlMinPriceUnit").value
ddlMaxPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlMaxPrice").value
ddlMaxPriceUnit=document.getElementById("ctl00_ContentPlaceHolder1_ddlMaxPriceUnit").value
if(!((parseInt(ddlMinPriceUnit)==0) && (parseInt(ddlMinPrice)==0) &&(parseInt(ddlMaxPrice)==0) && (parseInt(ddlMaxPriceUnit)==0) ))
{
if((parseInt(ddlMinPriceUnit)==0) || (parseInt(ddlMinPrice)==0) ||(parseInt(ddlMaxPrice)==0) || (parseInt(ddlMaxPriceUnit)==0) )
{


args.IsValid = false;
}
}





return args.IsValid;

}

function CheckBuiltArea(source, args)
{
args.IsValid = true;

ddlPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlBArea").value
ddlCAmount=document.getElementById("ctl00_ContentPlaceHolder1_txtBArea").value

if((ddlPrice!="0") && (ddlCAmount==""))
{
args.IsValid = false;
return args.IsValid;
}
if((ddlPrice=="0") && (ddlCAmount!=""))
{
args.IsValid = false;
return args.IsValid;
}

return args.IsValid;

}
function ChangeArea()
{
ddlPrice=document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice").value
ddlArea=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlArea;

if(ddlPrice=="1")
{
ddlArea.selectedIndex=1;
}
else if(ddlPrice=="2")
{
ddlArea.selectedIndex=2;
}
else
{
ddlArea.selectedIndex=0;
}
}





function EnableControlsSearch(Val)
{
ddlArea=document.aspnetForm.ctl00_ContentPlaceHolder1_ddlArea;

if(Val==3 || Val==4 || Val==12 || Val==20 || Val==22 || Val==21)
{
document.getElementById("divbed").style.display="block";

document.getElementById("divAge").style.display="block";


}
else if(Val==1 || Val==2 || Val==5 || Val==6 || Val==14 || Val==15 || Val==19)
{
document.getElementById("divbed").style.display="none";

document.getElementById("divAge").style.display="none";

}
else
{

document.getElementById("divbed").style.display="none";

document.getElementById("divAge").style.display="block";



}


if(Val==4)
{
if(document.getElementById("divUArea")!=null)
{
document.getElementById("divUArea").style.display="block";
document.getElementById("divbed").style.display="none";
}
}
else
{
if(document.getElementById("divUArea")!=null)
document.getElementById("divUArea").style.display="none";

}
if(document.getElementById("ChangeArea")!=null)
{
if(Val==4)
{
document.getElementById("ChangeArea").innerHTML="Flat Area";
}
else if(Val==6 || Val==15 || Val==19|| Val==20)
{
document.getElementById("ChangeArea").innerHTML="Land Area";
}
else if(Val==8 || Val==9 || Val==10 || Val==11 || Val==16)
{
document.getElementById("ChangeArea").innerHTML="Empty Space Available";

}
else
{
document.getElementById("ChangeArea").innerHTML="Site Area";
}
}


if(Val==15 || Val==16 || Val==17 || Val==18 || Val==19 || Val==20 )
{
    if(ddlArea.length==3)
    {
      var elOptNew = document.createElement('option');
        elOptNew.text = "Acres";
        elOptNew.value = 2;

    ddlArea.add(elOptNew,2); 

    }
   

}
else
{
if(ddlArea.length==4)
ddlArea.remove(2);


}

}


function Confirm(val)
{
if(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(val); 
     
    if(!Page_IsValid)
    { 
      
var i;
    for (i = 0; i < Page_Validators.length; i++) 
    {
        if (!Page_Validators[i].isvalid)
         {
            document.getElementById(Page_Validators[i].controltovalidate).focus();
            break;
        }
    } 
    }


}


function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}



//**************************************************************************
//Comparing two Indian Dates in the format dd/mm/yyyy
//**************************************************************************

function compareIndianDates(fromdate,fromname,todate,toname)
{
	
	//check whether the entered dates are [from date, to date] valid
	if (validIndianDate(fromdate,fromname) == false)
	{
		return false;
	} 
	if (validIndianDate(todate,toname) == false)
	{
		return false;
	} 
	
	//obtain month,day and year of date1
	var mdate = fromdate.value;
	var pos1 = mdate.indexOf("/");
	var newdate = mdate.substr(pos1+1);
	var pos2 = newdate.indexOf("/");
	var dval1= mdate.substr(0,pos1);
	var mval1 = newdate.substr(0,pos2);
	var yval1 = newdate.substr(pos2+1);
	
	//obtain month,day and year of date2
	var mdate = todate.value;
	var pos1 = mdate.indexOf("/");
	var newdate = mdate.substr(pos1+1);
	var pos2 = newdate.indexOf("/");
	var dval2= mdate.substr(0,pos1);
	var mval2 = newdate.substr(0,pos2);
	var yval2 = newdate.substr(pos2+1);
		
	var date1=mval1 + "/" + dval1 + "/" + yval1;
	var date2=mval2 + "/" + dval2 + "/" + yval2;

	
	date1=new Date(date1);
	date2=new Date(date2);
	
	if(date1 > date2) 
	{ 
		alert(fromname + " should be less than " + toname);
		fromdate.focus();
		return false; 
	} 
	return true;
}
//***************************************************************************
//Check if the Date is Valid Indian Date. [dd/mm/yyyy]
// return date if valid,
// false otherwise
//***************************************************************************
function validIndianDate(srcObj,objNamePassed) {
	if(srcObj == "undefined" || srcObj == null ) {
		alert(objNamePassed + " Object Not Defined")
		return false;
	}
	var formatMessage = "\n\nPlease Enter the date in DD/MM/YYYY Format";
	var val = srcObj.value;
	var objName = objNamePassed;
	if(objName == "" || objName == null) {
		objName = srcObj.name;
	}
	val = trim(val);
	var re = new RegExp("^\([0-9]{1,2}\).\([0-9]{1,2}\).\([0-9][0-9][0-9]{0,2}\)$");
	var daysOfMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
	var monthNames = ["January","February","March","April","May","June","July","August","September","October","November","December"];
	if(val.match(re)) {
		var tmpDate = re.exec(val);
		if(tmpDate[2] > 12 || tmpDate[2] < 1) {
			alert("Invalid Month : " + tmpDate[2] + " in Field " + objName + formatMessage);
			srcObj.focus();
			return false;
		}
		tmpDate[2]--;
		if(tmpDate[3] <49 && tmpDate[3] > 0) {
			tmpDate[3] = "20" + tmpDate[3];
		}
		if(tmpDate[3] == "00" ||tmpDate[3] == "0") {
			tmpDate[3] = "2000";
		}
		if(tmpDate[3] <100 && tmpDate[3] > 49) {
			tmpDate[3] = "19" + tmpDate[3];
		}
		if(tmpDate[3] > 9999 || tmpDate[3] < 1900) {
			alert("Invalid Year : " + tmpDate[3] + ". Valid Values are between 1900 and 9999 Only." + " for Field " + objName + formatMessage);
			srcObj.focus();
			return false;
		}
		if(tmpDate[3]%4 == 0) {
			daysOfMonth[1]++;
		}
		if(tmpDate[3]%400 != 0 && tmpDate[3]%100 == 0) {
			daysOfMonth[1]--;
		}
		if(tmpDate[1] <= 0) {
			alert("Invalid Day : " + tmpDate[1] + " in Field " + objName + formatMessage);
			srcObj.focus();
			return false;
		}
		if(tmpDate[1] > daysOfMonth[tmpDate[2]]) {
			alert(monthNames[tmpDate[2]]  + " in Field " + objName + " can have only " + daysOfMonth[tmpDate[2]] + " Days.");
			srcObj.focus();
			return false;
		}
		//var newDate = new Date(tmpDate[3],tmpDate[1],tmpDate[2]);
		var newDate = tmpDate[1]  + " " + monthNames[tmpDate[2]] + ", " + tmpDate[3];
		return newDate;
	}
	alert("Invalid Date : " + val + " in Field " + objName + formatMessage);
	srcObj.focus();
	return false;
}
//***************************************************************************
// Removes Leading and Trailing White Spaces
//***************************************************************************
function trim(txt) {
	if(txt == null || txt == "" || txt == "undefined") {
		return "";
	}
        var re = "\\s*";
        var re1 = new RegExp("^" + re);
        var re2 = new RegExp(re + "$");
        txt = txt.replace(re1,"");
        txt = txt.replace(re2,"");
        return txt;
}
