
var postback_ind = 0 ;
 
 function GetData(TextBox,cid){
		 	
    var opt;
    var cind;
	
    var obj = document.all['divLookUp'];
      
    if (document.all.txtLocation.value == ""){
	
        document.all.lstSearchResult.length = 0 ;
        document.all.lstSearchResult.options[0] = new Option(" ",0);
		
        obj.style.visibility = "hidden";
        
    }
    else {
	
        document.all.lstSearchResult.length = 0 ;
        document.all.lstSearchResult.options[0] = new Option("----  Loading   ---",0);
					
        document.frmSearch.action = "SearchAddress.aspx?cid=" + cid + "&loc=" + document.all.txtLocation.value
        document.frmSearch.target = "frSubmit"
        document.frmSearch.submit();
	    
        obj.style.visibility = "visible";

    }
}

function SetAddress(){

    if(document.all.lstSearchResult.selectedIndex == -1 || document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].value == "0"){
    

    }
    else{
    
        document.all.txtLocation.value = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].text ;
        document.all.txtLocation.focus();
        
        var fid = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].value;
        
      
        if(fid == "0"){
            document.all.txtLocation.value = "" ;
             document.all.txtLocation.focus();
        }
        else{
            document.all.hFID.value = fid ;
        }

        document.all.lstSearchResult.length = 0 ;
        document.all.lstSearchResult.options[0] = new Option(" ",0);

    }
    
   
    var obj = document.all['divLookUp'];
    obj.style.visibility = "hidden";
    
    return false ;

}
    
function SetAddressLot(){
 
    	
    document.all.txtLocation.value = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].text ;
    document.all.txtLocation.focus();
    
    var fid = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].value;
    
  
    document.all.txtLot.value = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].attributes("Lot").value ;
    document.all.txtBlock.value = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].attributes("Block").value ;
    
    if(fid == "0"){
        document.all.txtLocation.value = "" ;
         document.all.txtLocation.focus();
    }
    else{
        document.all.hFID.value = fid ;
    }

    document.all.lstSearchResult.length = 0 ;
    document.all.lstSearchResult.options[0] = new Option(" ",0);

    var obj = document.all['divLookUp'];
    obj.style.visibility = "hidden";
    
    return false ;

}
    
function Validate(fr)
{
	bReturn = true;
	
	if((fr.txtAssBlock.value == "" && fr.txtAssLot.value == "" && fr.txtStreetName.value == "" && fr.txtAssOwner.value == "" && fr.txtAssAcresFrom.value == ""  && fr.txtAssAcresTo.value == ""  && fr.txtAssAsmntFrom.value == ""  && fr.txtAssAsmntTo.value == "" && fr.txtAssLandFrom.value == "" && fr.txtAssLandTo.value == "" && fr.txtStreetName.value == "" && fr.optAssClass.selectedIndex == 0) && bReturn)
	{
	
	    if(fr.txtLocation.value == "" && bReturn)
	    {
		    alert("Please enter location OR use Advanced Search.");
		    fr.txtLocation.focus();
		    bReturn = false ;
	    }
		 
		fr.hSerchInd.value = "0";
	}
	else{
	    fr.hSerchInd.value = "1";
	}

    return bReturn ;
	 
	
    if(bReturn){
    
        if(document.all.hFID.value == "" ){
        
             if(document.all.lstSearchResult.selectedIndex >= 0){
                document.all.hFID.value = document.all.lstSearchResult.options[document.all.lstSearchResult.selectedIndex].value ;
            }
            else if(document.all.lstSearchResult.length == 1){
	        
                var FID = document.all.lstSearchResult.options[0].value;
	            
                if(FID > 0){
	            
                    document.all.hFID.value = FID;
                } 
            }
        }   
    }
    
	return bReturn ;
	
}


function LoginValidate(fr){

    var bReturn = true;
    
    if(fr.txtEmail.value == "" && bReturn)
    {
	    alert("Please enter your email address.");
	    fr.txtEmail.focus();
	    bReturn = false ;
    }
    
    if(fr.txtPassword.value == "" && bReturn)
    {
	    alert("Please enter your password.");
	    fr.txtPassword.focus();
	    bReturn = false ;
    }

    return bReturn ;
}

function UserLogOut(uid){
           
    document.frmLogOff.huid.value = uid ;
    document.frmLogOff.submit() ;
    
}

function LogIn(em,pwd){

    var sReturn = true ;
   
    if(em.value == "" && sReturn){
        
        alert("Please enter E-mail address.");
        em.focus();
        sReturn = false ;
    }
    
    if(pwd.value == "" && sReturn){
        
        alert("Please enter Password.");
        pwd.focus();
        sReturn = false ;
    }
    
    if(sReturn){
    
        document.frmLogIn.hEmail.value = em.value;
        document.frmLogIn.hPwd.value = pwd.value;
        document.frmLogIn.submit();
        
    }
    
    return false ;
}

function WelcomeMember(name){

            alert("Welcome! You are now logged in \n and may type in an Address to begin." );
            document.all.txtLogInEmail.value =  "" ;
            document.all.txtLogInPassword.value = "";
            
}

function MoveDown(){

 var k = event.keyCode; 
 var l = event.srcElement.form.elements.length; 
 var tIndex = event.srcElement.tabIndex; 
    if(k==40)
    { 
        document.all.lstSearchResult.focus(); 
    }
}


function MoveUp(){
 
 var k = event.keyCode; 
 var l = event.srcElement.form.elements.length; 
 var tIndex = event.srcElement.tabIndex; 
    if(k==13)
    { 
        SetAddress();
    }
}
 function ShowAdvSearch(LinkObj){
 
    var obj = document.all['divAdvSearch'];
     
    if(obj.style.display == "none"){
        obj.style.display = "block";
        LinkObj.innerHTML = "Advanced Search" ;
        setcookie("ShowAdvSearch","1",0);
    }
    else{
        obj.style.display = "none";
        LinkObj.innerHTML = "Advanced Search" ;
        setcookie("ShowAdvSearch","0",0);
    }
     
     return false ;
}

function ShowLogin(LinkObj){
 
    var obj = document.all['divLogin'];
    var objLogo = document.all['divLogo']; 
     
    if(obj.style.display == "none"){
        obj.style.display = "block";
        objLogo.style.display = "none";
        LinkObj.innerHTML = "Hide Login" ;
    }
    else{
        obj.style.display = "none";
        objLogo.style.display = "block";
        LinkObj.innerHTML = "Login" ; 
    }
     
     return false ;
}