﻿// JScript File
function AlertMsg(Ele, msg)
{
    alert("Please "+msg);
    Ele.focus();
    return false;
}
function ValidateRegistration()
{

    

    var rdoIndividual = document.getElementById("ctl00_ContentPlaceHolder1_rdoIndividual");
    var txtLogin = document.getElementById("ctl00_ContentPlaceHolder1_txtLogin");
    var txtPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtPassword");
    var txtConfPassword = document.getElementById("ctl00_ContentPlaceHolder1_txtConfPassword");
    var txtFName = document.getElementById("ctl00_ContentPlaceHolder1_txtFName");
    var txtLName = document.getElementById("ctl00_ContentPlaceHolder1_txtLName");
    var txtDOB = document.getElementById("ctl00_ContentPlaceHolder1_txtDOB");
    var ddlCountry = document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry");
    var ddlState = document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var ddlCity = document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
    var txtAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    var txtLandline = document.getElementById("ctl00_ContentPlaceHolder1_txtLandline");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail");
    var ddlOccupation = document.getElementById("ctl00_ContentPlaceHolder1_ddlOccupation");
    var chkAgree = document.getElementById("ctl00_ContentPlaceHolder1_chkAgree");
    
    var tdSMS1 = document.getElementById("tdSMS1");
    var tdSMS2 = document.getElementById("tdSMS2");
    var tdSMS3 = document.getElementById("tdSMS3");
    var chkSms = document.getElementById("ctl00_ContentPlaceHolder1_chkSms");
    var txtSMS1 = document.getElementById("ctl00_ContentPlaceHolder1_txtSMS1");
    var txtSMS2 = document.getElementById("ctl00_ContentPlaceHolder1_txtSMS2");
    var txtSMS3 = document.getElementById("ctl00_ContentPlaceHolder1_txtSMS3");
    
    var tdEmail1 = document.getElementById("tdEmail1");
    var tdEmail2 = document.getElementById("tdEmail2");
    var tdEmail3 = document.getElementById("tdEmail3");
    var chkEmail = document.getElementById("ctl00_ContentPlaceHolder1_chkEmail");
    var txtEmail1 = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail1");
    var txtEmail2 = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail2");
    var txtEmail3 = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail3");

    var txtCaptcha = document.getElementById("ctl00_ContentPlaceHolder1_Captcha1_txtCaptcha");

    if(txtFName && (txtFName.value.toLowerCase()=="first name" || txtFName.value==""))
        return AlertMsg(txtFName, "enter First Name");
    else if(txtLName && (txtLName.value.toLowerCase()=="last name" || txtLName.value==""))
        return AlertMsg(txtLName, "enter Last Name");
    else if(txtMobile  && (txtMobile.value.toLowerCase()=="mobile no." || txtMobile.value==""))
        return AlertMsg(txtMobile, "enter Mobile No."); 
    else if (txtLogin && (txtLogin.value.toLowerCase()=="email-id" || txtLogin.value==""))
        return AlertMsg(txtLogin, "enter Email-Id");
    else if(txtLogin && txtLogin.value.toLowerCase()!="email-id" && txtLogin.value!="" && !echeck(txtLogin.value))
        return AlertMsg(txtLogin, "enter valid Email-Id"); 
    else if(txtPassword && (txtPassword.value.toLowerCase()=="password" || txtPassword.value==""))
        return AlertMsg(txtPassword, "enter Password");
    else if(txtConfPassword && txtConfPassword.value!=txtPassword.value)
       return AlertMsg(txtConfPassword, "enter Password.\r\n\r\nConfirm Password should be same as Password.");        
    
//    else if(txtDOB && (txtDOB.value.toLowerCase()=="dd/mm/yyyy" || txtDOB.value==""))
//        return AlertMsg(txtDOB, "enter Date of Birth");
//    else if(ddlCountry && ddlCountry.value=="0")
//        return AlertMsg(ddlCountry, "select Country");       
//    else if(ddlState && ddlState.value=="0")
//        return AlertMsg(ddlState, "select State");               
//    else if(ddlCity && ddlCity.value=="0")
//        return AlertMsg(ddlCity, "select City");   
//    else if((txtMobile && txtLandline) && (txtMobile.value.toLowerCase()=="mobile no." || txtMobile.value=="") && (txtLandline.value.toLowerCase()=="landline no." || txtLandline.value==""))
//        return AlertMsg(txtMobile, "enter Mobile or Landline No.");
       
//    else if(txtEmail && (txtEmail.value.toLowerCase()=="email-id" || txtEmail.value==""))
//        return AlertMsg(txtEmail, "enter Email-Id");   
//    else if(txtEmail && txtEmail.value.toLowerCase()!="email-id" && txtEmail.value!="" && !echeck(txtEmail.value))
//        return AlertMsg(txtEmail, "enter valid Email-Id");        
//    else if(rdoIndividual && ddlOccupation && rdoIndividual.checked && ddlOccupation.value=="0")
//        return AlertMsg(ddlOccupation, "select Occupation");
//    else if(chkSms && chkSms.checked && tdSMS1 && txtSMS1 && tdSMS1.style.display!="none" && txtSMS1.value=="")
//        return AlertMsg(txtSMS1, "enter Mobile No.");     
//    else if(chkSms && chkSms.checked && tdSMS2 && txtSMS2 && tdSMS2.style.display!="none" && txtSMS2.value=="")
//        return AlertMsg(txtSMS2, "enter alternate Mobile No.");    
//    else if(chkSms && chkSms.checked && tdSMS3 && txtSMS3 && tdSMS3.style.display!="none" && txtSMS3.value=="")
//        return AlertMsg(txtSMS3, "enter alternate Mobile No.");     
    
//    else if(chkEmail && chkEmail.checked && tdEmail1 && txtEmail1 && tdEmail1.style.display!="none" && txtEmail1.value=="")
//        return AlertMsg(txtEmail1, "enter Email-Id");     
//    else if(chkEmail && chkEmail.checked && tdEmail2 && txtEmail2 && tdEmail2.style.display!="none" && txtEmail2.value=="")
//        return AlertMsg(txtEmail2, "enter alternate Email-Id");    
//    else if(chkEmail && chkEmail.checked && tdEmail3 && txtEmail3 && tdEmail3.style.display!="none" && txtEmail3.value=="")
//        return AlertMsg(txtEmail3, "enter alternate Email-Id");  
        
    else if(txtCaptcha && txtCaptcha.value=="")
        return AlertMsg(txtCaptcha, "enter code correctly");
        
    else if(chkAgree && !chkAgree.checked)
    {
        alert("You need to accept the Terms of Use to proceed further");
        chkAgree.focus();
        return false;
    }
                                       
       
}

function ValidateRegistrationForm()
{

    

    var rdoIndividual = document.getElementById("ctl00_ContentPlaceHolder1_rdoIndividual");
    var txtFName = document.getElementById("ctl00_ContentPlaceHolder1_txtFName");
    var txtLName = document.getElementById("ctl00_ContentPlaceHolder1_txtLName");
    var txtDOB = document.getElementById("ctl00_ContentPlaceHolder1_txtDOB");
    var ddlCountry = document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry");
    var ddlState = document.getElementById("ddlState");
    var ddlCity = document.getElementById("ddlCity");
    var txtCity = document.getElementById("txtCity");
    var txtAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    var txtLandline = document.getElementById("ctl00_ContentPlaceHolder1_txtLandline");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail");
    var ddlOccupation = document.getElementById("ctl00_ContentPlaceHolder1_ddlOccupation");
    
    var HiddenValue = document.getElementById("ctl00_ContentPlaceHolder1_HiddenValue");


      
    if(txtFName && (txtFName.value.toLowerCase()=="first name" || txtFName.value==""))
        return AlertMsg(txtFName, "enter First Name");
    else if(txtLName && (txtLName.value.toLowerCase()=="last name" || txtLName.value==""))
        return AlertMsg(txtLName, "enter Last Name");
    else if(txtDOB && (txtDOB.value.toLowerCase()=="dd/mm/yyyy" || txtDOB.value==""))
        return AlertMsg(txtDOB, "enter Date of Birth");
    else if(rdoIndividual && ddlOccupation && rdoIndividual.checked && ddlOccupation.value=="")
        return AlertMsg(ddlOccupation, "select Occupation"); 
    else if(txtEmail && (txtEmail.value.toLowerCase()=="email-id" || txtEmail.value==""))
        return AlertMsg(txtEmail, "enter Email-Id"); 
    else if(txtMobile  && (txtMobile.value.toLowerCase()=="mobile no." || txtMobile.value==""))
        return AlertMsg(txtMobile, "enter Mobile No.");       
    else if(ddlCountry && ddlCountry.value=="")
        return AlertMsg(ddlCountry, "select Country");       
    else if(ddlState && ddlState.value=="")
        return AlertMsg(ddlState, "select State");               
    else if(ddlCity && ddlCity.value=="")
        return AlertMsg(ddlCity, "select City");   
    else if(ddlCity && txtCity && ddlCity.value=="-1" && txtCity.value=="")
        return AlertMsg(txtCity, "enter City Name");   
    else if(txtMobile  && (txtMobile.value.toLowerCase()=="mobile no." || txtMobile.value==""))
        return AlertMsg(txtMobile, "enter Mobile No.");    
    else if(txtAddress && txtAddress.value.toLowerCase()=="address")
        return AlertMsg(txtAddress, "enter Address");        
    
    else
    {
        HiddenValue.value=ddlState.value+":"+ddlCity.value+":"+txtCity.value;
    }
                                  
       
}

function ValidateSeller()
{
    var CheckText = document.getElementsByTagName("span");

    var HiddenPicFile = document.getElementById("ctl00_ContentPlaceHolder1_HiddenPicFile");
    var HiddenFloorFile = document.getElementById("ctl00_ContentPlaceHolder1_HiddenFloorFile");
    var HiddenVideoFile = document.getElementById("ctl00_ContentPlaceHolder1_HiddenVideoFile");
    var HiddenDocFile = document.getElementById("ctl00_ContentPlaceHolder1_HiddenDocFile");
    
    for(i=0;i<CheckText.length;i++)
    {
        CheckId = CheckText[i].id;
        
        if(CheckId.indexOf("spanPicFile")!=-1 && document.getElementById(CheckId))
            HiddenPicFile.value+="|"+document.getElementById(CheckId).innerHTML;
            
        if(CheckId.indexOf("spanFloorFile")!=-1 && document.getElementById(CheckId))
            HiddenFloorFile.value+="|"+document.getElementById(CheckId).innerHTML;
            
        if(CheckId.indexOf("spanVideoFile")!=-1 && document.getElementById(CheckId))
            HiddenVideoFile.value+="|"+document.getElementById(CheckId).innerHTML;
            
        if(CheckId.indexOf("spanDocFile")!=-1 && document.getElementById(CheckId))
            HiddenDocFile.value+="|"+document.getElementById(CheckId).innerHTML;
    }




    var rdoSell = document.getElementById("ctl00_ContentPlaceHolder1_rdoSell");
    var rdoRent = document.getElementById("ctl00_ContentPlaceHolder1_rdoRent");
    var rdoCopLease = document.getElementById("ctl00_ContentPlaceHolder1_rdoCopLease");
    var rdoPG = document.getElementById("ctl00_ContentPlaceHolder1_rdoPG");
    
    var ddlCategory = document.getElementById("ctl00_ContentPlaceHolder1_ddlCategory");
    var ddlType = document.getElementById("ctl00_ContentPlaceHolder1_ddlType");
    var ddlCountry = document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry");
    var ddlState = document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var ddlCity = document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
    var txtAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var txtPincode = document.getElementById("ctl00_ContentPlaceHolder1_txtPincode");
    
    var ddlOccType = document.getElementById("ctl00_ContentPlaceHolder1_ddlOccType");
    var ddlPGType = document.getElementById("ctl00_ContentPlaceHolder1_ddlPGType");
    
    var ddlBedrooms = document.getElementById("ctl00_ContentPlaceHolder1_ddlBedrooms");
    var txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtPrice");
    var txtRent = document.getElementById("ctl00_ContentPlaceHolder1_txtRent");
    var ddlOwnership = document.getElementById("ctl00_ContentPlaceHolder1_ddlOwnership");
    var txtFName = document.getElementById("ctl00_ContentPlaceHolder1_txtFName");
    var txtLName = document.getElementById("ctl00_ContentPlaceHolder1_txtLName");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    var txtLandline = document.getElementById("ctl00_ContentPlaceHolder1_txtLandline");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail");
    var txtLocateAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtLocateAddress");
    var txtPropertyTitle = document.getElementById("ctl00_ContentPlaceHolder1_txtPropertyTitle");
    var txtComment = document.getElementById("ctl00_ContentPlaceHolder1_txtComment");
    
    
    if(ddlCategory && ddlCategory.value=="0")
        return AlertMsg(ddlCategory, "select Property Category"); 
    else if(ddlType && ddlType.value=="")
        return AlertMsg(ddlType, "select Property Type");
    else if(ddlCountry && ddlCountry.value=="0")
        return AlertMsg(ddlCountry, "select Country");     
    else if(ddlState && ddlState.value=="0")
        return AlertMsg(ddlState, "select State / UT");  
    else if(ddlCity && ddlCity.value=="0")
        return AlertMsg(ddlCity, "select City");  
    else if(txtAddress && (txtAddress.value.toLowerCase()=="enter address" || txtAddress.value==""))
        return AlertMsg(txtAddress, "enter Address");  
    else if(txtPincode && (txtPincode.value.toLowerCase()=="enter pincode" || txtPincode.value==""))
        return AlertMsg(txtPincode, "enter Pincode");
    else if(txtPincode && txtPincode.value.toLowerCase()!="enter pincode" && txtPincode.value!="" && txtPincode.value.length!=6)
        return AlertMsg(txtPincode, "enter proper Pincode");       
    else if(ddlOccType && rdoPG && rdoPG.checked && ddlOccType.value=="0")
        return AlertMsg(ddlOccType, "select Occupancy Type");
    else if(ddlPGType && rdoPG && rdoPG.checked && ddlPGType.value=="0")
        return AlertMsg(ddlPGType, "select PG Type");                      
    else if(ddlBedrooms && ddlCategory && ddlBedrooms.value=="0" && ddlCategory.value=="1")
        return AlertMsg(ddlBedrooms, "select Bedrooms");      
    else if(txtPrice && rdoSell && rdoSell.checked && (txtPrice.value.toLowerCase()=="enter property price" || txtPrice.value==""))
        return AlertMsg(txtPrice, "enter Property Price");    
    else if(txtRent && rdoSell && (!rdoSell.checked) && (txtRent.value.toLowerCase()=="enter monthly rent" || txtRent.value==""))
        return AlertMsg(txtRent, "enter Monthly Rent");  
    else if(ddlOwnership && ddlOwnership.value=="0")
        return AlertMsg(ddlOwnership, "select Type of Ownership");                                 
    else if(txtFName && (txtFName.value.toLowerCase()=="enter first name" || txtFName.value==""))
        return AlertMsg(txtFName, "enter First Name");
    else if(txtLName && (txtLName.value.toLowerCase()=="enter last name" || txtLName.value==""))
        return AlertMsg(txtLName, "enter Last Name");
    else if((txtMobile && txtLandline) && (txtMobile.value.toLowerCase()=="enter mobile no." || txtMobile.value=="") && (txtLandline.value.toLowerCase()=="enter landline no." || txtLandline.value==""))
        return AlertMsg(txtMobile, "enter Mobile or Landline No.");
    else if(txtEmail && (txtEmail.value.toLowerCase()=="enter email-id" || txtEmail.value==""))
        return AlertMsg(txtEmail, "enter Email-Id"); 
    else if(txtEmail && txtEmail.value.toLowerCase()!="enter email-id" && txtEmail.value!="" && !echeck(txtEmail.value))
        return AlertMsg(txtEmail, "enter valid Email-Id");     
    else if(txtLocateAddress && txtLocateAddress.value=="")
        return AlertMsg(txtEmail, "enter address to locate your property");                  
    else if(txtPropertyTitle && (txtPropertyTitle.value.toLowerCase()=="enter property title" || txtPropertyTitle.value==""))
        return AlertMsg(txtPropertyTitle, "enter Property Title");
    else if(txtComment && (txtComment.value.toLowerCase()=="enter property description" || txtComment.value==""))
        return AlertMsg(txtComment, "enter Property Description");                 
                
}

function ValidationBuyer()
{
    var rdoPurchase = document.getElementById("ctl00_ContentPlaceHolder1_rdoPurchase");
    var rdoRent = document.getElementById("ctl00_ContentPlaceHolder1_rdoRent");
    var rdoCopLease = document.getElementById("ctl00_ContentPlaceHolder1_rdoCopLease");
    var rdoPG = document.getElementById("ctl00_ContentPlaceHolder1_rdoPG");
    
    var ddlCategory = document.getElementById("ctl00_ContentPlaceHolder1_ddlCategory");
    var ddlType = document.getElementById("ctl00_ContentPlaceHolder1_ddlType");
    var ddlState = document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var ddlCity = document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
    var lstLocation = document.getElementById("ctl00_ContentPlaceHolder1_lstLocation");
    var ddlBedrooms = document.getElementById("ctl00_ContentPlaceHolder1_ddlBedrooms");
    var ddlBudget = document.getElementById("ctl00_ContentPlaceHolder1_ddlBudget");
    var ddlOccType = document.getElementById("ctl00_ContentPlaceHolder1_ddlOccType");
    var ddlPGType = document.getElementById("ctl00_ContentPlaceHolder1_ddlPGType");
    var txtMinArea = document.getElementById("ctl00_ContentPlaceHolder1_txtMinArea");
    var txtMaxArea = document.getElementById("ctl00_ContentPlaceHolder1_txtMaxArea");
    
    var txtFName = document.getElementById("ctl00_ContentPlaceHolder1_txtFName");
    var txtLName = document.getElementById("ctl00_ContentPlaceHolder1_txtLName");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    var txtLandline = document.getElementById("ctl00_ContentPlaceHolder1_txtLandline");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    
    var HiddenPropertyType = document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyType");
    var HiddenCityId = document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId");
    
    if(ddlCategory && ddlCategory.value=="0")
        return AlertMsg(ddlCategory, "select Property Category"); 
    else if(ddlType && ddlType.value=="")
        return AlertMsg(ddlType, "select Property Type");
    else if(ddlState && ddlState.value=="0")
        return AlertMsg(ddlState, "select State / UT");  
    else if(ddlCity && ddlCity.value=="0")
        return AlertMsg(ddlCity, "select City");  
        
    else if(ddlBedrooms && ddlCategory && ddlBedrooms.value=="0" && ddlCategory.value=="1")
        return AlertMsg(ddlBedrooms, "select Bedrooms");      
    else if(ddlBudget && ddlBudget.value=="0")
        return AlertMsg(ddlBudget, "select Budget / Rent");     
        
    else if(ddlOccType && rdoPG && rdoPG.checked && ddlOccType.value=="0")
        return AlertMsg(ddlOccType, "select Occupancy Type");
    else if(ddlPGType && rdoPG && rdoPG.checked && ddlPGType.value=="0")
        return AlertMsg(ddlPGType, "select PG Type");   
                
    else if(txtMinArea && (txtMinArea.value.toLowerCase()=="enter minimum area" || txtMinArea.value==""))
        return AlertMsg(txtMinArea, "enter Minimum Area");     
    else if(txtMaxArea && (txtMaxArea.value.toLowerCase()=="enter maximum area" || txtMaxArea.value==""))
        return AlertMsg(txtMaxArea, "enter Maximum Area");
            
//    else if(txtFName && (txtFName.value.toLowerCase()=="enter first name" || txtFName.value==""))
//        return AlertMsg(txtFName, "enter First Name");
//    else if(txtLName && (txtLName.value.toLowerCase()=="enter last name" || txtLName.value==""))
//        return AlertMsg(txtLName, "enter Last Name");
//    else if((txtMobile && txtLandline) && (txtMobile.value.toLowerCase()=="enter mobile no." || txtMobile.value=="") && (txtLandline.value.toLowerCase()=="enter landline no." || txtLandline.value==""))
//        return AlertMsg(txtMobile, "enter Mobile or Landline No.");
//    else if(txtEmail && (txtEmail.value.toLowerCase()=="enter email-id" || txtEmail.value==""))
//        return AlertMsg(txtEmail, "enter Email-Id"); 
//    else if(txtEmail && txtEmail.value.toLowerCase()!="enter email-id" && txtEmail.value!="" && !echeck(txtEmail.value))
//        return AlertMsg(txtEmail, "enter valid Email-Id");  

    else
    {
        HiddenPropertyType.value = ddlType.value;
        HiddenCityId.value = ddlCity.value;
        GetSelectedLocations(lstLocation);
        
    }
         
}

function ValidateLogin()
{
    var txtLUserName =  document.getElementById("ctl00_txtLNUserName");
    var txtLPassword =  document.getElementById("ctl00_txtLNPassword");
    
    if(txtLUserName && txtLUserName.value=="")
        return AlertMsg(txtLUserName, "enter Login Id");
    else if(txtLPassword && txtLPassword.value=="")
        return AlertMsg(txtLPassword, "enter Password");         
}

function ValidateIndexLogin()
{
    var txtLUserName =  document.getElementById("txtLUserName");
    var txtLPassword =  document.getElementById("txtLPassword");
    
    if(txtLUserName && txtLUserName.value=="")
        return AlertMsg(txtLUserName, "enter Login Id");
    else if(txtLPassword && txtLPassword.value=="")
        return AlertMsg(txtLPassword, "enter Password");         
}
function ValidateMasterLogin()
{
    var txtLUserName =  document.getElementById("ctl00_txtLUserName");
    var txtLPassword =  document.getElementById("ctl00_txtLPassword");
    
    if(txtLUserName && txtLUserName.value=="")
        return AlertMsg(txtLUserName, "enter Login Id");
    else if(txtLPassword && txtLPassword.value=="")
        return AlertMsg(txtLPassword, "enter Password");         
}
function ValidateSearch()
{
    var ddlType = document.getElementById("ddlType");
    var ddlState = document.getElementById("ddlState");
    var ddlCity = document.getElementById("ddlCity");
    var ddlBudget = document.getElementById("ddlBudget");
    var HiddenCategory = document.getElementById("HiddenCategory");
    var ddlBedrooms = document.getElementById("ddlBedrooms");

    if(ddlType && ddlType.value=="")
        return AlertMsg(ddlType, "select Property Type");
//    else if(HiddenCategory && ddlBedrooms && ddlBedrooms.value=="0" && HiddenCategory.value=="1")
//        return AlertMsg(ddlBedrooms, "select Bedrooms");         
//    else if(ddlState && ddlState.value=="0")
//        return AlertMsg(ddlState, "select State");            
//    else if(ddlCity && ddlCity.value=="0")
//        return AlertMsg(ddlCity, "select City");                    
//    else if(ddlBudget && ddlBudget.value=="0")
//        return AlertMsg(ddlBudget, "select your Budget");                            
}
function ValidateChangePassword()
{
    var txtOldPass = document.getElementById("txtOldPass");
    var txtNewPass = document.getElementById("txtNewPass");
    
    if(txtOldPass && txtOldPass.value=="")
        return AlertMsg(txtOldPass, "enter Old Password");
    else if(txtNewPass && txtNewPass.value=="")
        return AlertMsg(txtNewPass, "enter New Password");       
    else
        ChangePassword();             
}

function ValidatePostProperty()
{
    var rdoSell = document.getElementById("ctl00_ContentPlaceHolder1_rdoSell");
    var rdoRent = document.getElementById("ctl00_ContentPlaceHolder1_rdoRent");
    var rdoCopLease = document.getElementById("ctl00_ContentPlaceHolder1_rdoCopLease");
    var rdoPG = document.getElementById("ctl00_ContentPlaceHolder1_rdoPG");
    
    var ddlCategory = document.getElementById("ctl00_ContentPlaceHolder1_ddlCategory");
    var ddlType = document.getElementById("ctl00_ContentPlaceHolder1_ddlType");
    var ddlCountry = document.getElementById("ctl00_ContentPlaceHolder1_ddlCountry");
    var ddlState = document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var ddlCity = document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var ddlLocation = document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation");
    var txtLocation = document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");
    
    var txtAddress = document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var txtPincode = document.getElementById("ctl00_ContentPlaceHolder1_txtPincode");
    
    var ddlOccType = document.getElementById("ctl00_ContentPlaceHolder1_ddlOccType");
    var ddlPGType = document.getElementById("ctl00_ContentPlaceHolder1_ddlPGType");
    
    var ddlPropAge = document.getElementById("ctl00_ContentPlaceHolder1_ddlPropAge");
    var ddlBedrooms = document.getElementById("ctl00_ContentPlaceHolder1_ddlBedrooms");
    var ddlBathroom = document.getElementById("ctl00_ContentPlaceHolder1_ddlBathroom");
    var txtArea = document.getElementById("ctl00_ContentPlaceHolder1_txtArea");
    var ddlPrice = document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice");
    var txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtPrice");
    var ddlRent = document.getElementById("ctl00_ContentPlaceHolder1_ddlRent");
    var txtRent = document.getElementById("ctl00_ContentPlaceHolder1_txtRent");
    var ddlOwnership = document.getElementById("ctl00_ContentPlaceHolder1_ddlOwnership");

    var txtPropertyTitle = document.getElementById("ctl00_ContentPlaceHolder1_txtPropertyTitle");
    //var txtComment = document.getElementById("ctl00_ContentPlaceHolder1_txtComment");
    var txtComment = document.getElementById("wysiwygctl00_ContentPlaceHolder1_txtComment");
    
    var HiddenVal = document.getElementById("ctl00_ContentPlaceHolder1_HiddenVal");
    
    //alert(document.getElementById("wysiwygctl00_ContentPlaceHolder1_txtComment").contentWindow.document.body.innerHTML)
    
    if(ddlCategory && ddlCategory.selectedIndex==0)
        return AlertMsg(ddlCategory, "select Property Category");
    else if(ddlType && ddlType.selectedIndex==0)
        return AlertMsg(ddlType, "select Property Type");
//    if(ddlCountry && ddlCountry.selectedIndex==0)
//        return AlertMsg(ddlCountry, "select Country");
    else if(ddlState && ddlState.selectedIndex==0)
        return AlertMsg(ddlState, "select State");    
    else if(ddlCity && ddlCity.selectedIndex==0)
        return AlertMsg(ddlCity, "select City");
    else if(ddlCity.value=="-1" && txtCity && (txtCity.value.toLowerCase()=="enter city" || txtCity.value==""))
        return AlertMsg(txtCity, "enter City");  
    else if(ddlLocation && ddlLocation.selectedIndex==0 && ddlCity.value!="-1" && txtLocation.style.display=="none")
        return AlertMsg(ddlLocation, "select Location");
    else if((ddlLocation.value=="-1" || ddlLocation.style.display=="none") && txtLocation && (txtLocation.value.toLowerCase()=="enter location" || txtLocation.value==""))
        return AlertMsg(txtLocation, "enter Location");   
        
    else if(txtAddress && (txtAddress.value.toLowerCase()=="enter address" || txtAddress.value==""))
        return AlertMsg(txtAddress, "enter Address");  
    else if(txtPincode && (txtPincode.value.toLowerCase()=="enter pincode" || txtPincode.value==""))
        return AlertMsg(txtPincode, "enter Pincode");
    else if(txtPincode && txtPincode.value.toLowerCase()!="enter pincode" && txtPincode.value!="" && txtPincode.value.length!=6)
        return AlertMsg(txtPincode, "enter proper Pincode");       
    else if(ddlOccType && rdoPG && rdoPG.checked && ddlOccType.value=="0")
        return AlertMsg(ddlOccType, "select Occupancy Type");
    else if(ddlPGType && rdoPG && rdoPG.checked && ddlPGType.value=="0")
        return AlertMsg(ddlPGType, "select PG Type");                      
    else if(ddlBedrooms && ddlCategory && ddlBedrooms.value=="0" && ddlCategory.value=="1")
        return AlertMsg(ddlBedrooms, "select Bedrooms");    
    
    else if(txtArea && (txtArea.value.toLowerCase()=="enter area" || txtArea.value==""))
        return AlertMsg(txtArea, "enter Area");  
        
          
    else if(txtPrice && rdoSell && rdoSell.checked && ddlPrice && ddlPrice.selectedIndex==0)
        return AlertMsg(txtPrice, "enter Property Price");    
    else if(txtRent && rdoSell && (!rdoSell.checked) && ddlRent && ddlRent.selectedIndex==0)
        return AlertMsg(txtRent, "enter Monthly Rent");  
    else if(ddlOwnership && ddlOwnership.value=="0")
        return AlertMsg(ddlOwnership, "select Type of Ownership");   
                       
    else if(txtPropertyTitle && (txtPropertyTitle.value.toLowerCase()=="enter property title" || txtPropertyTitle.value==""))
        return AlertMsg(txtPropertyTitle, "enter Property Title");
    //else if(txtComment && (txtComment.value.toLowerCase()=="enter property description" || txtComment.value==""))
    else if(txtComment && txtComment.contentWindow.document.body.innerHTML.toLowerCase().replace("<p>&nbsp;</p>","")=="")
        return AlertMsg(txtComment, "enter Property Description");     
    else
    {
        HiddenVal.value=ddlCategory.value+"|"+ddlType.value+"|"+ddlCountry.value+"|"+ddlState.value+"|"+ddlCity.value+"|"+ddlLocation.value;
        HiddenVal.value+="|"+ddlOccType.value+"|"+ddlPGType.value+"|"+ddlPropAge.value+"|"+ddlBedrooms.value+"|"+ddlBathroom.value;
        HiddenVal.value+="|"+ddlRent.value+"|"+ddlPrice.value+"|"+ddlOwnership.value;
        
    }                                       
}

function ValidatePostPropertyAdditional()
{
    var HiddenExtFeat = document.getElementById("ctl00_ContentPlaceHolder1_HiddenExtFeat");
    var HiddenExtFac = document.getElementById("ctl00_ContentPlaceHolder1_HiddenExtFac");
    var HiddenIntFeat = document.getElementById("ctl00_ContentPlaceHolder1_HiddenIntFeat");
    var HiddenIntFac = document.getElementById("ctl00_ContentPlaceHolder1_HiddenIntFac"); 
    
    var Ele = new Array("tblExtFeat","tblExtFac","tblIntFeat","tblIntFac");
    
    for(i=0;i<Ele.length;i++)
    {
        var HiddenVal = document.getElementById("ctl00_ContentPlaceHolder1_"+Ele[i].replace("tbl","Hidden"));
        HiddenVal.value="";
        
        var eleID = PPAGetElementId(Ele[i]); 
        var eleText = PPAGetElementText(Ele[i]);  
        for(p=0;p<99;p++)
        {
            if(Ele[i].indexOf("Feat")!=-1)
            {
                var lbl=document.getElementById(eleID[0]+p);
                var txt=document.getElementById(eleID[1]+p);
                if(lbl)
                {
                    if((lbl.value.toLowerCase()==eleText[0].toLowerCase()) || lbl.value=="")
                        return AlertMsg(lbl, "enter value");
                    else if((txt.value.toLowerCase()==eleText[1].toLowerCase()) || txt.value=="")  
                        return AlertMsg(txt, "enter value");     
                    else
                    {
                        HiddenVal.value+="|"+lbl.value+"~"+txt.value;
                    }                                     
                }    
                else
                    break;                
            }
            else if(Ele[i].indexOf("Fac")!=-1)
            {
                var txt=document.getElementById(eleID[0]+p);
                if(txt)
                {
                    if((txt.value.toLowerCase()==eleText[0].toLowerCase()) || txt.value=="")  
                        return AlertMsg(txt, "enter value");
                    else
                    {
                        HiddenVal.value+="|"+txt.value;
                    }                        
                }
                else
                    break;                    
            }
        }  
        //alert(HiddenVal.value);
    }
    
   


//    var CheckItem = document.getElementsByTagName("input");
//    var CheckId;
//    var ChkHead;
//    for(i=0;i<CheckItem.length;i++)
//    {
//        CheckId = CheckItem[i].id;
//        
//        if(CheckId.indexOf("ChkHead")!=-1)
//            ChkHead=CheckId;
//        if(CheckId.indexOf("ChkItem")!=-1)
//        {
//            if(document.getElementById(CheckId).checked)
//                isChecked=true;
//            else
//            {
//                isChecked=false;
//                break;
//            }
//        }
//    } 
//    document.getElementById(ChkHead).checked = isChecked; 
    
}
function ValidateMasterEmail(Ele)
{   
    if(Ele.value!="")
    {
        if(!echeck(Ele.value))
        {
            Ele.select();
            return false;  
        }
    }        
    else 
        return false;
}
function SetContactNowData(val)
{
    var HiddenContactPPID = document.getElementById("ctl00_HiddenContactPPID")   
    var tdContactMessage = document.getElementById("tdContactMessage")
    HiddenContactPPID.value=val; 
    tdContactMessage.innerHTML="You have selected the given Property ID: "+val;
}    
function ValidateMasterContactNow()
{
    var txtContactName = document.getElementById("ctl00_txtContactName")
    var txtContactEmail = document.getElementById("ctl00_txtContactEmail")
    var txtContactMobile = document.getElementById("ctl00_txtContactMobile")
    var txtContactPhone = document.getElementById("ctl00_txtContactPhone")
    var txtContactMessage = document.getElementById("ctl00_txtContactMessage")
    
    if(txtContactName && txtContactName.value=="")
        return AlertMsg(txtContactName, "enter your name");  
    else if(txtContactEmail && txtContactEmail.value=="")
        return AlertMsg(txtContactEmail, "enter your email-id");          
    else if(txtContactMobile && txtContactMobile.value=="")
        return AlertMsg(txtContactMobile, "enter your mobile number");
    else if(txtContactMobile.value!="" && txtContactMobile.value.length<10)
        return AlertMsg(txtContactMobile, "enter valid mobile number");
    else if(txtContactMessage && txtContactMessage.value=="")
        return AlertMsg(txtContactMessage, "enter message");        
}
function ValidateIndexQuickContact()
{
    var txtEnquiryName = document.getElementById("txtEnquiryName")
    var txtEnquiryEmail = document.getElementById("txtEnquiryEmail")
    var txtEnquiryMobile = document.getElementById("txtEnquiryMobile")
    var txtQuery = document.getElementById("txtQuery")
    
    if(txtEnquiryName && (txtEnquiryName.value.toLowerCase()=="name" ||  txtEnquiryName.value==""))
        return AlertMsg(txtEnquiryName, "enter your name");  
    else if(txtEnquiryEmail && (txtEnquiryEmail.value.toLowerCase()=="email-id" ||  txtEnquiryEmail.value==""))
        return AlertMsg(txtEnquiryEmail, "enter your email-id");          
    else if(txtEnquiryMobile && (txtEnquiryMobile.value.toLowerCase()=="mobile no." ||  txtEnquiryMobile.value==""))
        return AlertMsg(txtEnquiryMobile, "enter your mobile number");
    else if(txtEnquiryMobile.value!="" && txtEnquiryMobile.value.length<10)
        return AlertMsg(txtEnquiryMobile, "enter valid mobile number");
    else if(txtQuery && (txtQuery.value.toLowerCase()=="query" ||  txtQuery.value==""))
        return AlertMsg(txtQuery, "enter query");       
}
function ValidateSearchContactNow()
{
    var txtContactName = document.getElementById("ctl00_ContentPlaceHolder1_txtContactName")
    var txtContactEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtContactEmail")
    var txtContactMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtContactMobile")
    var txtContactPhone = document.getElementById("ctl00_ContentPlaceHolder1_txtContactPhone")
    var txtContactMessage = document.getElementById("ctl00_ContentPlaceHolder1_txtContactMessage")
    
    if(txtContactName && txtContactName.value=="")
        return AlertMsg(txtContactName, "enter your name");  
    else if(txtContactEmail && txtContactEmail.value=="")
        return AlertMsg(txtContactEmail, "enter your email-id");          
    else if(txtContactMobile && txtContactMobile.value=="")
        return AlertMsg(txtContactMobile, "enter your mobile number");
    else if(txtContactMobile.value!="" && txtContactMobile.value.length<10)
        return AlertMsg(txtContactMobile, "enter valid mobile number");
    else if(txtContactMessage && txtContactMessage.value=="")
        return AlertMsg(txtContactMessage, "enter message");        
}

function ValidateEnquiry()
{
    var txtEnquiryName = document.getElementById("ctl00_txtEnquiryName")
    var txtEnquiryEmail = document.getElementById("ctl00_txtEnquiryEmail")
    var txtEnquiryMobile = document.getElementById("ctl00_txtEnquiryMobile")
    var txtQuery = document.getElementById("ctl00_txtQuery")
    
    if(txtEnquiryName && (txtEnquiryName.value.toLowerCase()=="name" ||  txtEnquiryName.value==""))
        return AlertMsg(txtEnquiryName, "enter your name");  
    else if(txtEnquiryEmail && (txtEnquiryEmail.value.toLowerCase()=="email-id" ||  txtEnquiryEmail.value==""))
        return AlertMsg(txtEnquiryEmail, "enter your email-id");          
    else if(txtEnquiryMobile && (txtEnquiryMobile.value.toLowerCase()=="mobile no." ||  txtEnquiryMobile.value==""))
        return AlertMsg(txtEnquiryMobile, "enter your mobile number");
    else if(txtEnquiryMobile.value!="" && txtEnquiryMobile.value.length<10)
        return AlertMsg(txtEnquiryMobile, "enter valid mobile number");
    else if(txtQuery && (txtQuery.value.toLowerCase()=="query" ||  txtQuery.value==""))
        return AlertMsg(txtQuery, "enter query");  
}


function ValidatePropertyDetails()
{
    var rdoIndividual=document.getElementById("ctl00_ContentPlaceHolder1_rdoIndividual");
    var rdoBuilder=document.getElementById("ctl00_ContentPlaceHolder1_rdoBuilder");
    var ddlBuilder=document.getElementById("ctl00_ContentPlaceHolder1_ddlBuilder");
    var txtRID=document.getElementById("ctl00_ContentPlaceHolder1_txtRID");
    var ddlTitle=document.getElementById("ctl00_ContentPlaceHolder1_ddlTitle")
    var txtFName=document.getElementById("ctl00_ContentPlaceHolder1_txtFName")
    var txtMName=document.getElementById("ctl00_ContentPlaceHolder1_txtMName")
    var txtLName=document.getElementById("ctl00_ContentPlaceHolder1_txtLName")
    var txtMobile=document.getElementById("ctl00_ContentPlaceHolder1_txtMobile")
    var txtLandline=document.getElementById("ctl00_ContentPlaceHolder1_txtLandline")
    var txtEmail=document.getElementById("ctl00_ContentPlaceHolder1_txtEmail")
    var txtIndAddress=document.getElementById("ctl00_ContentPlaceHolder1_txtIndAddress")
    var txtProject=document.getElementById("ctl00_ContentPlaceHolder1_txtProject");
    var txtTitle=document.getElementById("ctl00_ContentPlaceHolder1_txtTitle");
    var txtStartDate=document.getElementById("ctl00_ContentPlaceHolder1_txtStartDate");
    var txtEndDate=document.getElementById("ctl00_ContentPlaceHolder1_txtEndDate");
    var txtAbout=document.getElementById("wysiwygctl00_ContentPlaceHolder1_txtAbout");
    var ddlCategory=document.getElementById("ctl00_ContentPlaceHolder1_ddlCategory");
    var ddlType=document.getElementById("ctl00_ContentPlaceHolder1_ddlType");
    
    var chkResiType=document.getElementById("ctl00_ContentPlaceHolder1_chkResiType_0");
    var chkCommType=document.getElementById("ctl00_ContentPlaceHolder1_chkCommType_0");
    var ResiType="";
    var CommType="";
    
    for(i=0;i<30;i++)
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_chkResiType_"+i))
        {
            if(document.getElementById("ctl00_ContentPlaceHolder1_chkResiType_"+i).checked)
                ResiType+="|"+i+"|";           
        }
        else
            break;                            
    }
    for(i=0;i<30;i++)
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_chkCommType_"+i))
        {
            if(document.getElementById("ctl00_ContentPlaceHolder1_chkCommType_"+i).checked)
                CommType+="|"+i+"|";
        }
        else
            break;            
    }
    
    var ddlState=document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var ddlCity=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
    var txtCity=document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var ddlLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation");
    var txtLocation=document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");
    var txtAddress=document.getElementById("ctl00_ContentPlaceHolder1_txtAddress");
    var txtPincode=document.getElementById("ctl00_ContentPlaceHolder1_txtPincode");
    
    var HiddenVal=document.getElementById("ctl00_ContentPlaceHolder1_HiddenVal");
    
    
    
    if(rdoBuilder && ddlBuilder && rdoBuilder.checked && ddlBuilder.selectedIndex==0)
        return AlertMsg(ddlBuilder, "select Builder");
    else if(rdoIndividual && txtRID && txtFName && rdoIndividual.checked && txtRID.value.toLowerCase()=="enter registration id" && (txtFName.value.toLowerCase()=="enter first name" || txtFName.value==""))
        return AlertMsg(txtFName, "enter First Name");   
    else if(rdoIndividual && txtRID && txtLName && rdoIndividual.checked && txtRID.value.toLowerCase()=="enter registration id" && (txtLName.value.toLowerCase()=="enter last name" || txtLName.value==""))
        return AlertMsg(txtLName, "enter Last Name");                    
    else if(rdoIndividual && txtRID && txtMobile && rdoIndividual.checked && txtRID.value.toLowerCase()=="enter registration id" && (txtMobile.value.toLowerCase()=="enter mobile no." || txtMobile.value==""))
        return AlertMsg(txtMobile, "enter Mobile No.");
    else if(rdoIndividual && txtRID && txtEmail && rdoIndividual.checked && txtRID.value.toLowerCase()=="enter registration id" && (txtEmail.value.toLowerCase()=="enter email-id" || txtEmail.value==""))
        return AlertMsg(txtEmail, "enter Email-Id");  
    else if(rdoIndividual && txtRID && txtIndAddress && rdoIndividual.checked && txtRID.value.toLowerCase()=="enter registration id" && (txtIndAddress.value.toLowerCase()=="enter address" || txtIndAddress.value==""))
        return AlertMsg(txtIndAddress, "enter Address");  
    else if(txtProject && (txtProject.value.toLowerCase()=="enter project name" || txtProject.value==""))
        return AlertMsg(txtProject, "enter Project Name");             
    else if(txtTitle && (txtTitle.value.toLowerCase()=="enter title" || txtTitle.value==""))
        return AlertMsg(txtTitle, "enter Title"); 
    else if(txtStartDate && (txtStartDate.value.toLowerCase()=="enter start date" || txtStartDate.value==""))
        return AlertMsg(txtStartDate, "enter Start Date");  
//    else if(txtEndDate && (txtEndDate.value.toLowerCase()=="enter end date" || txtEndDate.value==""))
//        return AlertMsg(txtEndDate, "enter End Date"); 
    else if(txtAbout && txtAbout.contentWindow.document.body.innerHTML.toLowerCase().replace("<p>&nbsp;</p>","")=="")
        return AlertMsg(txtAbout, "enter About Project");   

    else if(ddlCategory && ddlCategory.selectedIndex==0)
        return AlertMsg(ddlCategory, "select Property Category");
//    else if(ddlType && ddlType.selectedIndex==0)
//        return AlertMsg(ddlType, "select Property Type");

    else if(ddlCategory && ddlCategory.value=="1" && ResiType=="")
        return AlertMsg(chkResiType, "select Property Type");
    else if(ddlCategory && ddlCategory.value=="2" && CommType=="")
        return AlertMsg(chkCommType, "select Property Type");    
             
    else if(ddlState && ddlState.selectedIndex==0)
        return AlertMsg(ddlState, "select State");    
    else if(ddlCity && ddlCity.selectedIndex==0)
        return AlertMsg(ddlCity, "select City");
    else if(ddlCity.value=="-1" && txtCity && (txtCity.value.toLowerCase()=="enter city" || txtCity.value==""))
        return AlertMsg(txtCity, "enter City");  
    else if(ddlLocation && ddlLocation.selectedIndex==0 && ddlCity.value!="-1" && txtLocation.style.display=="none")
        return AlertMsg(ddlLocation, "select Location");
    else if((ddlLocation.value=="-1" || ddlLocation.style.display=="none") && txtLocation && (txtLocation.value.toLowerCase()=="enter location" || txtLocation.value==""))
        return AlertMsg(txtLocation, "enter Location");   
        
    else if(txtAddress && (txtAddress.value.toLowerCase()=="enter address" || txtAddress.value==""))
        return AlertMsg(txtAddress, "enter Address");  
//    else if(txtPincode && (txtPincode.value.toLowerCase()=="enter pincode" || txtPincode.value==""))
//        return AlertMsg(txtPincode, "enter Pincode");
//    else if(txtPincode && txtPincode.value.toLowerCase()!="enter pincode" && txtPincode.value!="" && txtPincode.value.length!=6)
//        return AlertMsg(txtPincode, "enter proper Pincode");    
    else
    {
        //HiddenVal.value=ddlCategory.value+"|"+ddlType.value+"|"+ddlState.value+"|"+ddlCity.value+"|"+ddlLocation.value;
        HiddenVal.value=ddlCategory.value+"|1|"+ddlState.value+"|"+ddlCity.value+"|"+ddlLocation.value;
        
    }                                                          
}
function ValidateProjectPropertyDetails()
{
    var CheckText = document.getElementsByTagName("input");
    var CheckLink = document.getElementsByTagName("a");
    var CheckId; 
    
    var txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtPrice");
    var chkOnRequest = document.getElementById("ctl00_ContentPlaceHolder1_chkOnRequest");     
    var txtSize = document.getElementById("ctl00_ContentPlaceHolder1_txtSize"); 
    var txtPlotArea = document.getElementById("ctl00_ContentPlaceHolder1_txtPlotArea");    
    var txtBuiltUpArea = document.getElementById("ctl00_ContentPlaceHolder1_txtBuiltUpArea");  
    var ddlBedrooms = document.getElementById("ctl00_ContentPlaceHolder1_ddlBedrooms");
    var HiddenLabel = document.getElementById("ctl00_ContentPlaceHolder1_HiddenLabel");
    var HiddenLayout = document.getElementById("ctl00_ContentPlaceHolder1_HiddenLayout");
    
    
    if(txtPrice && chkOnRequest && (txtPrice.value.toLowerCase()=="enter price" || txtPrice.value=="") && !chkOnRequest.checked)
        return AlertMsg(txtPrice, "enter Price");
    else if(!CheckNumValidate(txtPrice) && !chkOnRequest.checked)
        return AlertMsg(txtPrice, "enter proper value");        
    else if(txtSize && (txtSize.value.toLowerCase()=="enter super area" || txtSize.value==""))
        return AlertMsg(txtSize, "enter Super Area");  
    else if(!CheckNumValidate(txtSize))
        return AlertMsg(txtSize, "enter proper value");   
    else if(txtPlotArea && txtPlotArea.value.toLowerCase()!="enter plot area" && txtPlotArea.value!="" && !CheckNumValidate(txtPlotArea))
        return AlertMsg(txtPlotArea, "enter proper value");    
    else if(txtBuiltUpArea && txtBuiltUpArea.value.toLowerCase()!="enter built-up area" && txtBuiltUpArea.value!="" && !CheckNumValidate(txtBuiltUpArea))
        return AlertMsg(txtBuiltUpArea, "enter proper value");                           
    else if(ddlBedrooms && ddlBedrooms.selectedIndex==0)
        return AlertMsg(ddlBedrooms, "select Bedrooms");
    
    HiddenLabel.value="";
    HiddenLayout.value="";
    
    for(i=0;i<CheckText.length;i++)
    {
        CheckId = CheckText[i].id;
        
        if(CheckId.indexOf("txtLabel")!=-1 && document.getElementById(CheckId))
            HiddenLabel.value+="|"+document.getElementById(CheckId).value;
            
    } 
    for(i=0;i<CheckLink.length;i++)
    {
        CheckId = CheckLink[i].id;
        
        if(CheckId.indexOf("linkLayout")!=-1 && document.getElementById(CheckId))
            HiddenLayout.value+="|"+document.getElementById(CheckId).innerHTML;
            
    }          
}

function ValidatePropertyFlooring()
{
    var HiddenVal = document.getElementById("ctl00_ContentPlaceHolder1_HiddenVal");
    var linkLocation = document.getElementById("ctl00_ContentPlaceHolder1_linkLocation");
    var linkSite = document.getElementById("ctl00_ContentPlaceHolder1_linkSite");
    var linkMaster = document.getElementById("ctl00_ContentPlaceHolder1_linkMaster");

    HiddenVal.value=linkLocation.innerHTML+"|"+linkSite.innerHTML+"|"+linkMaster.innerHTML;

    var CheckText = document.getElementsByTagName("input");
    var CheckLink = document.getElementsByTagName("a");
    var CheckId;

    var txtType = document.getElementById("ctl00_ContentPlaceHolder1_Hidden1");
    var txtSize = document.getElementById("ctl00_ContentPlaceHolder1_Hidden2");
    var txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_Hidden3");
//    var txtFlats = document.getElementById("ctl00_ContentPlaceHolder1_Hidden4");
    var linkLayout = document.getElementById("ctl00_ContentPlaceHolder1_Hidden5");
//    var txtSpecification = document.getElementById("ctl00_ContentPlaceHolder1_Hidden6");
//    var txtDescription = document.getElementById("ctl00_ContentPlaceHolder1_Hidden7");
    
    txtType.value="";
    txtSize.value="";
    txtPrice.value="";
//    txtFlats.value="";
    linkLayout.value="";
//    txtSpecification.value="";
//    txtDescription.value="";
    
    for(i=0;i<CheckText.length;i++)
    {
        CheckId = CheckText[i].id;
        
        if(CheckId.indexOf("txtType")!=-1 && document.getElementById(CheckId))
            txtType.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtSize")!=-1 && document.getElementById(CheckId))
            txtSize.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtPrice")!=-1 && document.getElementById(CheckId))
            txtPrice.value+="|"+document.getElementById(CheckId).value;
            
//        if(CheckId.indexOf("txtFlats")!=-1 && document.getElementById(CheckId))
//            txtFlats.value+="|"+document.getElementById(CheckId).value; 
                                               
//        if(CheckId.indexOf("txtSpecification")!=-1 && document.getElementById(CheckId))
//            txtSpecification.value+="|"+document.getElementById(CheckId).value;
//            
//        if(CheckId.indexOf("txtDescription")!=-1 && document.getElementById(CheckId))
//            txtDescription.value+="|"+document.getElementById(CheckId).value;
            
    } 
    for(i=0;i<CheckLink.length;i++)
    {
        CheckId = CheckLink[i].id;
        
        if(CheckId.indexOf("linkLayout")!=-1 && document.getElementById(CheckId))
            linkLayout.value+="|"+document.getElementById(CheckId).innerHTML;
            
    }
}
function ValidatePropertyAmenities()
{
    var CheckText = document.getElementsByTagName("input");
    var CheckId;
    
    var txtSent = document.getElementById("ctl00_ContentPlaceHolder1_HiddenSent");
    txtSent.value="";
    
    for(i=0;i<CheckText.length;i++)
    {
        CheckId = CheckText[i].id;

        if(CheckId.indexOf("txtSent")!=-1 && document.getElementById(CheckId))
            txtSent.value+="|"+document.getElementById(CheckId).value;

    } 
}

function ValidateBranch()
{
    var txtBranchCode = document.getElementById("ctl00_ContentPlaceHolder1_txtBranchCode");
    var txtBranchName = document.getElementById("ctl00_ContentPlaceHolder1_txtBranchName");
    var txtLocation = document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");
    
    if(txtBranchCode && (txtBranchCode.value.toLowerCase()=="enter branch code" || txtBranchCode.value==""))
        return AlertMsg(txtBranchCode, "enter Branch Code");  
    else if(txtBranchName && (txtBranchName.value.toLowerCase()=="enter branch name" || txtBranchName.value==""))
        return AlertMsg(txtBranchName, "enter Branch Name");
    else if(txtLocation && (txtLocation.value.toLowerCase()=="enter location name" || txtLocation.value==""))
        return AlertMsg(txtLocation, "enter Location Name");                
}
function ValidateUserType()
{
    var txtUserType = document.getElementById("ctl00_ContentPlaceHolder1_txtUserType");
    
    if(txtUserType && (txtUserType.value.toLowerCase()=="enter user role" || txtUserType.value==""))
        return AlertMsg(txtUserType, "enter User Role");                
}

function ValidateBuilder()
{
    var txtBuilder = document.getElementById("ctl00_ContentPlaceHolder1_txtBuilder");
    var txtPersonName = document.getElementById("ctl00_ContentPlaceHolder1_txtPersonName");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    var txtLandline = document.getElementById("ctl00_ContentPlaceHolder1_txtLandline");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmailId");
    var txtHOPlace = document.getElementById("ctl00_ContentPlaceHolder1_txtHOPlace");
    var txtAbout = document.getElementById("ctl00_ContentPlaceHolder1_txtAbout");
    
    if(txtBuilder && (txtBuilder.value.toLowerCase()=="enter builder name" || txtBuilder.value==""))
        return AlertMsg(txtBuilder, "enter Builder Name");
    else if(txtPersonName && (txtPersonName.value.toLowerCase()=="enter person name" || txtPersonName.value==""))
        return AlertMsg(txtPersonName, "enter Contact Person Name");
    else if((txtMobile && txtLandline) && (txtMobile.value.toLowerCase()=="enter mobile no." || txtMobile.value=="") && (txtLandline.value.toLowerCase()=="enter landline no." || txtLandline.value==""))
        return AlertMsg(txtMobile, "enter Mobile or Landline No.");
    else if(txtEmail && (txtEmail.value.toLowerCase()=="enter email-id" || txtEmail.value==""))
        return AlertMsg(txtEmail, "enter Email-Id"); 
    else if(txtEmail && txtEmail.value.toLowerCase()!="enter email-id" && txtEmail.value!="" && !echeck(txtEmail.value))
        return AlertMsg(txtEmail, "enter valid Email-Id"); 
    else if(txtHOPlace && (txtHOPlace.value.toLowerCase()=="enter place name" || txtHOPlace.value==""))
        return AlertMsg(txtHOPlace, "enter Head Office Place Name");  
    if(txtAbout && (txtAbout.value.toLowerCase()=="enter about builder" || txtAbout.value==""))
        return AlertMsg(txtAbout, "enter some additional information about builder");              
    
}
function ValidateLeadSource()
{
    var txtSourceName = document.getElementById("ctl00_ContentPlaceHolder1_txtSourceName");
    if(txtSourceName && (txtSourceName.value.toLowerCase()=="enter source name" || txtSourceName.value==""))
        return AlertMsg(txtSourceName, "enter Source Name");
    
}

function ValidateCityZone()
{
    var ddlZone=document.getElementById("ctl00_ContentPlaceHolder1_ddlZone");
    var txtZone=document.getElementById("ctl00_ContentPlaceHolder1_txtZone");
    var ddlState=document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
    var ddlCity=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");

    if(ddlZone && ddlZone.selectedIndex==0)
        return AlertMsg(ddlZone, "select Main Zone");
    else if(txtZone && (txtZone.value.toLowerCase()=="enter zone name" || txtZone.value==""))
        return AlertMsg(txtZone, "enter Zone Name");   
    else if(ddlState && ddlState.selectedIndex==0)
        return AlertMsg(ddlState, "select State Name");
    else if(ddlCity && ddlCity.selectedIndex==0)
        return AlertMsg(ddlCity, "select City Name"); 
    else if(!CheckLocations())
        return AlertMsg(ddlCity, "select Locations");                             
    
}
function CheckLocations()
{
    var CheckBox = document.getElementsByTagName("input");
    var CheckId;
    
    var check=false;

    for(i=0;i<CheckBox.length;i++)
    {
        CheckId = CheckBox[i].id;

        if(CheckId.indexOf("ctl00_ContentPlaceHolder1_chkLocations")!=-1 && document.getElementById(CheckId) && document.getElementById(CheckId).checked==true)
        {   
            check=true;
            break;
        }
    }
    return check;
}
function SelectAllLocations(Ele)
{
    var CheckBox = document.getElementsByTagName("input");
    var CheckId;
    
    var check=Ele.checked;
    
    for(i=0;i<CheckBox.length;i++)
    {
        CheckId = CheckBox[i].id;

        if(CheckId.indexOf("ctl00_ContentPlaceHolder1_chkLocations")!=-1 && document.getElementById(CheckId))
            document.getElementById(CheckId).checked=check;

    } 
}
function CheckUncheckLocations()
{
    var CheckBox = document.getElementsByTagName("input");
    var CheckId;
    
    var check=true;
    
    var chkAll=document.getElementById("ctl00_ContentPlaceHolder1_chkAll");
    
    if(document.getElementById("ctl00_ContentPlaceHolder1_chkAll"))
    {
        for(i=0;i<CheckBox.length;i++)
        {
            CheckId = CheckBox[i].id;

            if(CheckId.indexOf("ctl00_ContentPlaceHolder1_chkLocations")!=-1 && document.getElementById(CheckId) && document.getElementById(CheckId).checked==false)
            {   
                check=false;
                break;
            }
        }
        chkAll.checked=check;
    }        
}
function ValidateProjectSearch()
{

    var ddlCity = document.getElementById("ddlCity");
    var ddlBdgtMin = document.getElementById("ctl00_ddlBdgtMin");
    var ddlBdgtMax = document.getElementById("ctl00_ddlBdgtMax");
    var HiddenSearchId = document.getElementById("ctl00_HiddenSearchId");
    var HiddenSearchCity = document.getElementById("ctl00_HiddenSearchCity");
    var ddlBedrooms = document.getElementById("ctl00_ddlBedrooms");

    if(ddlCity && ddlCity.selectedIndex==0)
        return AlertMsg(ddlCity, "select City");
//    else if(ddlBdgtMin && ddlBdgtMin.selectedIndex==0)
//        return AlertMsg(ddlBdgtMin, "select Budget Range");
//    else if(ddlBdgtMax && ddlBdgtMax.selectedIndex==0)
//        return AlertMsg(ddlBdgtMax, "select Budget Range");  
    else if(ddlBdgtMin && ddlBdgtMax && ddlBdgtMin.selectedIndex!=0 && ddlBdgtMax.selectedIndex!=0 && parseInt(ddlBdgtMin.value)>parseInt(ddlBdgtMax.value))
        return AlertMsg(ddlBdgtMin, "select Proper Range");     
    else
    {
        HiddenSearchId.value=ddlCity.value;
        HiddenSearchCity.value=ddlCity.options[ddlCity.selectedIndex].text;
        
        BdgtMin=ddlBdgtMin.options[ddlBdgtMin.selectedIndex].text;
        BdgtMax=ddlBdgtMax.options[ddlBdgtMax.selectedIndex].text;
        Bedrooms=ddlBedrooms.value;
        HiddenSearchCity.value=HiddenSearchCity.value+"|"+BdgtMin+"|"+BdgtMax+"|"+Bedrooms
        //alert(HiddenSearchCity.value)
    }                      
}

function validateFileTextBox()
{
    var Ele=document.getElementById("ctl00_ContentPlaceHolder1_BullionImageUpload")
    var FileName =Ele.value;
    if(FileName=="")
       return AlertMsg(Ele, "attach file");
    else if(FileName!="" && FileName.toLowerCase().indexOf(".jpg")==-1 && FileName.toLowerCase().indexOf(".bmp")==-1 && FileName.toLowerCase().indexOf(".jpeg")==-1 && FileName.toLowerCase().indexOf(".gif")==-1 && FileName.toLowerCase().indexOf(".png")==-1)
       return AlertMsg(Ele, "upload file, has extension .bmp | .gif | .png | .jpeg | .jpg only"); 

}

function ValidatePostRequirement()
{
    var txtPostName = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostName")
    var txtPostEmail = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostEmail")
    var txtPostPhone = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostPhone")
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtCity")
    var txtPostQuery = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostQuery")
    
    if(txtPostName && txtPostName.value=="")
        return AlertMsg(txtPostName, "enter Name");
    else if(txtPostEmail && txtPostEmail.value=="")
        return AlertMsg(txtPostEmail, "enter E-mail");
    else if(!Homeecheck(txtPostEmail.value)) 
    {
        txtPostEmail.select();
        return false;
    }      
    else if(txtPostPhone && txtPostPhone.value=="")
        return AlertMsg(txtPostPhone, "enter Phone");
    else if(!CheckHomeNumValidate(txtPostPhone) && txtPostPhone.value!="")
        return AlertMsg(txtPostPhone, "enter proper number");       
    else if(txtCity && txtCity.value=="")
        return AlertMsg(txtCity, "enter City"); 
    else
    {
//        setEnqCookie("UniconEnqPostName",txtPostName.value,365);
//        setEnqCookie("UniconEnqPostEmail",txtPostEmail.value,365);
//        setEnqCookie("UniconEnqPostPhone",txtPostPhone.value,365);
//        setEnqCookie("UniconEnqPostCity",txtCity.value,365);
        SavePostRequirement();
        return false;
    }                       
}

function ValidatePostLeads()
{
    var txtPostName = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostName")
    var txtPostEmail = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostEmail")
    var txtPostPhone = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostPhone")
    var txtCity = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtCity")
    var txtPostQuery = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostQuery")
    
    if(txtPostName && txtPostName.value=="")
        return AlertMsg(txtPostName, "enter Name");
    else if(txtPostEmail && txtPostEmail.value=="")
        return AlertMsg(txtPostEmail, "enter E-mail");
    else if(!Homeecheck(txtPostEmail.value)) 
    {
        txtPostEmail.select();
        return false;
    }      
    else if(txtPostPhone && txtPostPhone.value=="")
        return AlertMsg(txtPostPhone, "enter Phone");
    else if(!CheckHomeNumValidate(txtPostPhone) && txtPostPhone.value!="")
        return AlertMsg(txtPostPhone, "enter proper number");       
    else if(txtCity && txtCity.value=="")
        return AlertMsg(txtCity, "enter City"); 
    else
    {
//        setEnqCookie("UniconEnqPostName",txtPostName.value,365);
//        setEnqCookie("UniconEnqPostEmail",txtPostEmail.value,365);
//        setEnqCookie("UniconEnqPostPhone",txtPostPhone.value,365);
//        setEnqCookie("UniconEnqPostCity",txtCity.value,365);
        SavePostLeads();
        return false;
    }                       
}

function ValidateHomeEnquiry()
{
    var txtPostName = document.getElementById("txtPostName")
    var txtPostEmail = document.getElementById("txtPostEmail")
    var txtPostPhone = document.getElementById("txtPostPhone")
    var txtPostQuery = document.getElementById("txtPostQuery")
    var txtPostCity = document.getElementById("txtPostCity")
    var chkHomeLoan = document.getElementById("chkHomeLoan")
    
    if(txtPostName && txtPostName.value=="")
        return AlertMsg(txtPostName, "enter Name");
    else if(txtPostEmail && txtPostEmail.value=="")
        return AlertMsg(txtPostEmail, "enter E-mail");
    else if(txtPostPhone && txtPostPhone.value=="")
        return AlertMsg(txtPostPhone, "enter Phone");   
    else if(txtPostCity && txtPostCity.value=="")
        return AlertMsg(txtPostCity, "enter City");        
    else
    {
        SaveEnquiryNow();
        
        // Added By sameer For Thanks Heading 
    var EnqHead = document.getElementById("EnqHead")
    var ThkHead = document.getElementById("ThkHead")
    var trPostData = document.getElementById("trPostData")
    var tdPostData = document.getElementById("tdPostData")
    var trEnqForm = document.getElementById("trEnqForm")
    
    if(tdPostData)
    tdPostData.innerHTML = 'Processing your request,Please Wait !!'
    
    if(trEnqForm)
    trEnqForm.style.display = 'none'
    if(EnqHead){EnqHead.style.display='none';ThkHead.style.display='';}
        
        return false;
    }                   
}
function CheckHomeNumValidate(Ele)
{
    var invalid="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`-=[]\\;\',/~!@#$%^&*()_+{}|:\"<>?";
    var isExist=false;
    if(Ele.value!="")
    {
        var eleVal=Ele.value;
        for(i=0;i<eleVal.length;i++)
        {
            if(invalid.indexOf(eleVal.substr(i,1))!=-1)
            {
                isExist=true;
                break;
            }
        }
    }        
    return !isExist;
}
function HomeNumOnly(_char, _mozChar) 
{
//    alert(_char);

    if(_mozChar != null) 
    { 
        // Look for a Mozilla-compatible browser
        if((_mozChar >= 48 && _mozChar <= 57)  || _mozChar == 8 || _mozChar == 9 || _mozChar == 45 ) _RetVal = true;
        else 
        {
            //alert('Please enter a Character value.');
            _RetVal = false;
        }
    }
    else 
    {
        // Must be an IE-compatible Browser
        if((_char >= 48 && _char <= 57) || _char == 45   ) _RetVal = true;
        else 
        {
            //alert('Please enter a Character value.');
            _RetVal = false;
        }
    }
    return _RetVal;
}

//  Email Check
//  Start
function HomeValidateEmail(Ele, val)
{
    if(Ele.value=="" || Ele.value.toLowerCase()==val.toLowerCase())
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))
        {
            document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value=val;
            document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").className="TextCss";
        }                
        if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail1"))
            document.getElementById("ctl00_ContentPlaceHolder1_txtEmail1").value="";

    }
    else if(Ele.value!="" && Ele.value!=val)
    {
        if(!Homeecheck(Ele.value))
        {
            Ele.select();  
        }
        else
        {
            if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail"))
            {
                document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value=Ele.value; 
                document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").className="Text";
            }                
            if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail1"))
                document.getElementById("ctl00_ContentPlaceHolder1_txtEmail1").value=Ele.value; 

        }
                                                    
    }
}
function Homeecheck(str) 
{
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if(str=="")
	{
	    return true;
	}
	if (str.indexOf(at)==-1)
	{
	   alert("Invalid Email-Id");
	   return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
	   alert("Invalid Email-Id");
	   return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
	    alert("Invalid Email-Id");
	    return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1)
	 {
	    alert("Invalid Email-Id");
	    return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	 {
	    alert("Invalid Email-Id");
	    return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1)
	 {
	    alert("Invalid Email-Id");
	    return false;
	 }
	
	 if (str.indexOf(" ")!=-1)
	 {
	    alert("Invalid Email-Id");
	    return false;
	 }
	 var spCh=SpecialCharacters();
	 for(i=0;i<spCh.length;i++)
	 {
	    if(str.indexOf(spCh[i])!=-1)
	    {
	        alert("Invalid Email-Id");
	        return false;
	    }
	 }
	 if(str.indexOf("__")!=-1 || str.indexOf("..")!=-1 || str.indexOf("_.")!=-1 || str.indexOf("._")!=-1 || str.indexOf("@_")!=-1|| str.indexOf("_@")!=-1 || str.indexOf("@.")!=-1|| str.indexOf(".@")!=-1 ||str.indexOf("_")==0)
	 {
	    alert("Invalid Email-Id");
	    return false;
	 }

	 return true;					
}
function SpecialCharacters()
{
    var spCh = new Array("~","!","#","$","%","^","&","*","(",")","-","+","=","`",";",":","\"","'",",","/","<",">","?","[","]","\\","{","}","|");
    return spCh;
}
function LargePopup(strUrl)
{
     var mainwin=window.open(strUrl,'_blank','x=0,y=0,toolbar=no,location=yes,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=350,height=300,screenX=0,screenY=0,left=350,top=300');	
	 mainwin.focus();
	 return false;
}
function EnquiryPopup(strUrl)
{
     var enqwin=window.open(strUrl,'_blank','x=0,y=0,toolbar=no,location=yes,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=950,height=500,screenX=0,screenY=0,left=150,top=200');	
	 enqwin.focus();
	 
}
function ResetHomeLoan()
{
    document.getElementById("ctl00_ContentPlaceHolder1_txtHLName").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_ddlHLState").selectedIndex=0;
    document.getElementById("ctl00_ContentPlaceHolder1_txtHLCity").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_ddlHLDay").selectedIndex=0;
    document.getElementById("ctl00_ContentPlaceHolder1_ddlHLMonth").selectedIndex=0;
    document.getElementById("ctl00_ContentPlaceHolder1_ddlHLYear").selectedIndex=0;
    document.getElementById("ctl00_ContentPlaceHolder1_txtHLAmount").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtHLIncome").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtHLEmail").value="";
    document.getElementById("ctl00_ContentPlaceHolder1_txtHLMobile").value="";
    return false;
}
function ValidateHomeLoan()
{
    var txtHLName = document.getElementById("ctl00_ContentPlaceHolder1_txtHLName");
    var ddlHLState = document.getElementById("ctl00_ContentPlaceHolder1_ddlHLState");
    var txtHLCity = document.getElementById("ctl00_ContentPlaceHolder1_txtHLCity");
    var ddlHLDay = document.getElementById("ctl00_ContentPlaceHolder1_ddlHLDay");
    var ddlHLMonth = document.getElementById("ctl00_ContentPlaceHolder1_ddlHLMonth");
    var ddlHLYear = document.getElementById("ctl00_ContentPlaceHolder1_ddlHLYear");
    var txtHLAmount = document.getElementById("ctl00_ContentPlaceHolder1_txtHLAmount");
    var txtHLIncome = document.getElementById("ctl00_ContentPlaceHolder1_txtHLIncome");
    var txtHLEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtHLEmail");
    var txtHLMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtHLMobile");
    
    var HLAmount = txtHLAmount.value;
    var HLIncome = txtHLIncome.value;
    var HLMobile = txtHLMobile.value;
    var HLDOB = ddlHLDay.value+"/"+ddlHLMonth.value+"/"+ddlHLYear.value;
    
    for(i=0;i<HLAmount.split(',').length;i++)
        HLAmount=HLAmount.replace(",","");
    for(i=0;i<HLIncome.split(',').length;i++)
        HLIncome=HLIncome.replace(",","");   
        
    for(i=0;i<HLAmount.split(',').length;i++)
        HLAmount=HLAmount.replace(",","");
    for(i=0;i<HLIncome.split(',').length;i++)
        HLIncome=HLIncome.replace(",","");         

    
    if(txtHLName && txtHLName.value=="")
        return AlertMsg(txtHLName, "enter name");
    else if(ddlHLState && ddlHLState.selectedIndex==0)
        return AlertMsg(ddlHLState, "select state");  
    else if(txtHLCity && txtHLCity.value=="")
        return AlertMsg(txtHLCity, "enter city");
    else if(ddlHLDay && ddlHLDay.selectedIndex==0)
        return AlertMsg(ddlHLDay, "select day");                                  
    else if(ddlHLMonth && ddlHLMonth.selectedIndex==0)
        return AlertMsg(ddlHLMonth, "select month");                                  
    else if(ddlHLYear && ddlHLYear.selectedIndex==0)
        return AlertMsg(ddlHLYear, "select year");  
    else if(HLDOB!="" && !isDate(HLDOB,"false"))
    {   
        ddlHLDay.focus();
        return false;        
    }
    else if(txtHLAmount && txtHLAmount.value=="")
        return AlertMsg(txtHLAmount, "enter loan amount");
    else if(!CheckNumValidate(txtHLAmount) && txtHLAmount.value!="")
        return AlertMsg(txtHLAmount, "enter proper value");        
    else if(txtHLIncome && txtHLIncome.value=="")
        return AlertMsg(txtHLIncome, "enter montly income");
    else if(!CheckNumValidate(txtHLIncome) && txtHLIncome.value!="")
        return AlertMsg(txtHLIncome, "enter proper value");        
    else if(txtHLMobile && txtHLMobile.value=="")
        return AlertMsg(txtHLMobile, "enter mobile no.");
    else if(!CheckNumValidate(txtHLMobile) && txtHLMobile.value!="")
        return AlertMsg(txtHLMobile, "enter proper value");        
    else if(txtHLAmount && txtHLAmount.value!="" && eval(HLAmount)>eval(999999999))
    {
        txtHLAmount.focus();
        alert("Loan amount should not exceed Rs. 99,99,99,999");
        return false;
    }
    else if(txtHLIncome && txtHLIncome.value!="" && eval(HLIncome)>eval(9999999))
    {
        txtHLIncome.focus();
        alert("Montly income should not exceed Rs. 99,99,999");
        return false;
    }        
    else if(txtHLEmail && txtHLEmail.value!="" && !Homeecheck(txtHLEmail.value))
    {
        txtHLEmail.focus();
        return false;    
    }        
    else if(HLMobile!="" && (HLMobile.indexOf("9")!="0" && HLMobile.indexOf("8")!="0") || HLMobile.length<10)       
        return AlertMsg(txtHLMobile, "enter valid mobile no."); 
    else if(HLMobile.indexOf("000000000")!=-1 || HLMobile.indexOf("111111111")!=-1 || HLMobile.indexOf("222222222")!=-1 || HLMobile.indexOf("333333333")!=-1 || HLMobile.indexOf("444444444")!=-1 || HLMobile.indexOf("555555555")!=-1 || HLMobile.indexOf("666666666")!=-1 || HLMobile.indexOf("777777777")!=-1 || HLMobile.indexOf("888888888")!=-1 || HLMobile.indexOf("999999999")!=-1)
        return AlertMsg(txtHLMobile, "try another mobile no.");                                                                            

}

function CheckCurrencyNumOnly(_char, _mozChar, Ele) 
{
//    alert(_char);

    if(_mozChar != null) 
    { 
        // Look for a Mozilla-compatible browser
        if((_mozChar >= 48 && _mozChar <= 57)  || _mozChar == 8 || _mozChar == 9 )
        { 
            _RetVal = true;
        }            
        else 
        {
            //alert('Please enter a Character value.');
            _RetVal = false;
        }
    }
    else 
    {
        // Must be an IE-compatible Browser
        if((_char >= 48 && _char <= 57)   ) 
        {
            _RetVal = true;
        }            
        else 
        {
            //alert('Please enter a Character value.');
            _RetVal = false;
        }
    }
    return _RetVal;
}
function InsertComm(Ele)
{
    var strCurr=Ele.value;
    var retCurr="";
 
    for(c=0;c<strCurr.split(",").length;c++)
        strCurr=strCurr.replace(",","");
    for(c=0;c<strCurr.split(",").length;c++)
        strCurr=strCurr.replace(",","");        
    i=0;
    //alert(strCurr);
    for(p=0;p<strCurr.length;p++)
    {
        i++;
        if(i==4)
            retCurr=","+retCurr;
        if(i==6)
            retCurr=","+retCurr;
        if(i==8)
            retCurr=","+retCurr;
        if(i==10)
            retCurr=","+retCurr;                                    
        retCurr=strCurr.substr(strCurr.length-i,1)+retCurr;
        
    }
    //alert(retCurr);
    Ele.value=retCurr;
}

function ValidateNonWebisteUsers()
{
    var rdoSingle = document.getElementById("ctl00_ContentPlaceHolder1_rdoSingle");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail");
    var txtMobile = document.getElementById("ctl00_ContentPlaceHolder1_txtMobile");
    
    if(rdoSingle && rdoSingle.checked)
    {
        if(txtEmail && txtMobile && (txtEmail.value.toLowerCase()=="enter email-id" || txtEmail.value=="") && (txtMobile.value.toLowerCase()=="enter mobile no." || txtMobile.value==""))
        {
            AlertMsg(txtEmail, "enter Email-Id or Mobile No.");
            return false;
        }
    }
    
}

function ShowAddNonWebUsers(id)
{
    document.getElementById("trSingle").style.display="none";
    document.getElementById("trMultiple").style.display="none";
    
    document.getElementById("tr"+id).style.display="";
}

function ValidateCampCodeActTrack()
{
    var txtFromDate = document.getElementById("ctl00_ContentPlaceHolder1_txtFromDate");
    var txtToDate = document.getElementById("ctl00_ContentPlaceHolder1_txtToDate");
    
    if(txtFromDate && txtToDate && txtFromDate.value=="" && txtToDate.value!="")
    {
        AlertMsg(txtFromDate, "enter From Date");
        return false;
    }
    else if(txtFromDate && txtToDate && txtFromDate.value!="" && txtToDate.value=="")
    {
        AlertMsg(txtToDate, "enter To Date");
        return false;
    }
}
function SendReference()
{
    var Url="";
    if(document.getElementById("HiddenReferUrl"))
        Url=document.getElementById("HiddenReferUrl").value;
    var SenderName=document.getElementById("txtName")
    var SenderEmail=document.getElementById("txtEmail")
    var SenderComment=document.getElementById("txtMessage")
        
    if(SenderName && (SenderName.value.toLowerCase()=="your name" || SenderName.value==""))
        return AlertMsg(SenderName, "enter Your Name");
    else if(SenderEmail && (SenderEmail.value.toLowerCase()=="your email" || SenderEmail.value==""))
        return AlertMsg(SenderEmail, "enter Your Email");
    else if(SenderEmail.value!="" && !echeck(SenderEmail.value))
    {
        SenderEmail.select();    
        return false;                              
    }
    for(p=1;p<999;p++)
    {
        var RecName=document.getElementById("txtRecName"+p)
        var RecEmail=document.getElementById("txtRecEmail"+p)
        if(RecName && RecEmail)
        {
            if(RecName && (RecName.value.toLowerCase()=="recipient name" || RecName.value==""))
                return AlertMsg(RecName, "enter Recipient Name");
            if(RecEmail && (RecEmail.value.toLowerCase()=="recipient email" || RecEmail.value==""))
                return AlertMsg(RecEmail, "enter Recipient Email");  
            else if(RecEmail && RecEmail.value!="" && !echeck(RecEmail.value))
            {
                RecEmail.select();    
                return false;                              
            }
        }
        else
            break;                                
    }
      
        
                                                
    var strRecName="";
    var strRecEmail="";
    for(i=1;i<999;i++)
    {
        var RecName=document.getElementById("txtRecName"+i)
        var RecEmail=document.getElementById("txtRecEmail"+i)
        
        
        if(RecName && RecEmail)
        {
            strRecName+="|"+RecName.value+"|";
            strRecEmail+="|"+RecEmail.value+"|";
        }
        else
            break;                
    }
    
    if(document.getElementById("tblTellFriend"))
        document.getElementById("tblTellFriend").style.display="none";
    if(document.getElementById("tblSendFriend"))
        document.getElementById("tblSendFriend").style.display="";
        
    SendReferenceFriend(strRecName, strRecEmail, SenderName.value, SenderEmail.value, SenderComment.value, Url)
}

function ValidateCareer()
{
    var txtJobTitle = document.getElementById("ctl00_ContentPlaceHolder1_txtJobTitle");
    var txtExperience = document.getElementById("ctl00_ContentPlaceHolder1_txtExperience");
    var txtLocation = document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");
    var txtDesc = document.getElementById("wysiwygctl00_ContentPlaceHolder1_txtDesc");
    var txtEmail = document.getElementById("ctl00_ContentPlaceHolder1_txtEmail");
    var txtPostedOn = document.getElementById("ctl00_ContentPlaceHolder1_txtPostedOn");
    
    if(txtJobTitle && (txtJobTitle.value.toLowerCase()=="enter job title" || txtJobTitle.value==""))
        return AlertMsg(txtJobTitle, "enter Job Title");
    else if(txtExperience && (txtExperience.value.toLowerCase()=="enter experience" || txtExperience.value==""))
        return AlertMsg(txtExperience, "enter Experience");
    else if(txtLocation && (txtLocation.value.toLowerCase()=="enter location" || txtLocation.value==""))
        return AlertMsg(txtLocation, "enter Location");
    else if(txtDesc && txtDesc.contentWindow.document.body.innerHTML.toLowerCase().replace("<p>&nbsp;</p>","")=="")
        return AlertMsg(txtDesc, "enter Description"); 
//    else if(txtEmail && (txtEmail.value.toLowerCase()=="enter email-id" || txtEmail.value==""))
//        return AlertMsg(txtEmail, "enter Email-Id"); 
//    else if(txtEmail && txtEmail.value.toLowerCase()!="enter email-id" && txtEmail.value!="" && !echeck(txtEmail.value))
//        return AlertMsg(txtEmail, "enter valid Email-Id"); 
    else if(txtPostedOn && (txtPostedOn.value.toLowerCase()=="enter post date" || txtPostedOn.value==""))
        return AlertMsg(txtPostedOn, "enter Post Date");          
    
}

function ValidatePartnerRegistration()
{
    var txtPartMACode = document.getElementById("txtPartMACode");
    var txtPartPan = document.getElementById("txtPartPan");
    var txtPartPassword = document.getElementById("txtPartPassword");
    var txtPartConPassword = document.getElementById("txtPartConPassword");
    var txtPartContact = document.getElementById("txtPartContact");
    var txtPartEmail = document.getElementById("txtPartEmail");
    var chkPartAgree = document.getElementById("chkPartAgree");
    
    if(txtPartMACode && txtPartMACode.value=="")
        return AlertMsg(txtPartMACode, "enter MA Code");
    else if(txtPartPan && txtPartPan.value=="")
        return AlertMsg(txtPartPan, "enter PAN No.");
    else if(txtPartPan.value.length<10)
        return AlertMsg(txtPartPan, "enter correct PAN No.");                
    else if(txtPartPassword && txtPartPassword.value=="")
        return AlertMsg(txtPartPassword, "enter Password");                
    else if(txtPartConPassword && txtPartConPassword.value=="")
        return AlertMsg(txtPartConPassword, "enter Confirm Password");    
    else if(txtPartPassword.value!=txtPartConPassword.value)
        return AlertMsg(txtPartConPassword, "enter Confirm Password correctly");                   
    else if(txtPartContact && txtPartContact.value=="")
        return AlertMsg(txtPartContact, "enter Contact No.");                                
    else if(txtPartEmail && txtPartEmail.value=="")
        return AlertMsg(txtPartEmail, "enter Email");  
    else if(txtPartEmail.value!="" && !echeck(txtPartEmail.value))
    {
        txtPartEmail.focus();
        return false;                                      
    }        
    else if(chkPartAgree && !chkPartAgree.checked)
        return AlertMsg(chkPartAgree, "select the option to agree with the Terms & Conditions");    
    
    PartnerRegistration(txtPartMACode.value, txtPartPan.value, txtPartPassword.value, txtPartContact.value, txtPartEmail.value,"0");
    return false;
}

function ValidatePartnerLogin()
{
    var txtPartUserId = document.getElementById("txtPartUserId");
    var txtPartPassword = document.getElementById("txtPartPassword");
    
    if(txtPartUserId && txtPartUserId.value=="")
        return AlertMsg(txtPartUserId, "enter User ID");
    else if(txtPartPassword && txtPartPassword.value=="")
        return AlertMsg(txtPartPassword, "enter Password");

    PartnerLogin(txtPartUserId.value, txtPartPassword.value);  
    return false;                  
}

function ValidateEmployeeRegistration()
{
    var txtEmpCode = document.getElementById("txtEmpCode");
    var txtEmpDOB = document.getElementById("txtEmpDOB");
    var ddlEmpDay = document.getElementById("ddlEmpDay");
    var ddlEmpMonth = document.getElementById("ddlEmpMonth");
    var ddlEmpYear = document.getElementById("ddlEmpYear");
    var txtEmpPassword = document.getElementById("txtEmpPassword");
    var txtEmpConPassword = document.getElementById("txtEmpConPassword");
    var txtEmpContact = document.getElementById("txtEmpContact");
    var txtEmpEmail = document.getElementById("txtEmpEmail");
    var chkEmpAgree = document.getElementById("chkEmpAgree");
    
    var txtDOB=ddlEmpDay.value+"/"+ddlEmpMonth.value+"/"+ddlEmpYear.value;
    
    if(txtEmpCode && txtEmpCode.value=="")
        return AlertMsg(txtEmpCode, "enter Employee Code");
//    else if(txtEmpDOB && txtEmpDOB.value=="")
//        return AlertMsg(txtEmpDOB, "enter DOB");
//    else if(!isDate(txtEmpDOB.value))
//    {
//        txtEmpDOB.focus();
//        return false;
//    }
    else if(ddlEmpDay && ddlEmpDay.selectedIndex==0)
        return AlertMsg(ddlEmpDay, "select Day");
    else if(ddlEmpMonth && ddlEmpMonth.selectedIndex==0)
        return AlertMsg(ddlEmpMonth, "select Month");
    else if(ddlEmpYear && ddlEmpYear.selectedIndex==0)
        return AlertMsg(ddlEmpYear, "select Year");
    else if(!isDate(txtDOB))
    {
        ddlEmpDay.focus();
        return false;
    }        
    else if(txtEmpPassword && txtEmpPassword.value=="")
        return AlertMsg(txtEmpPassword, "enter Password");                
    else if(txtEmpConPassword && txtEmpConPassword.value=="")
        return AlertMsg(txtEmpConPassword, "enter Confirm Password");    
    else if(txtEmpPassword.value!=txtEmpConPassword.value)
        return AlertMsg(txtEmpConPassword, "enter Confirm Password correctly");                   
    else if(txtEmpContact && txtEmpContact.value=="")
        return AlertMsg(txtEmpContact, "enter Contact No.");                                
    else if(txtEmpEmail && txtEmpEmail.value=="")
        return AlertMsg(txtEmpEmail, "enter Email");  
    else if(txtEmpEmail.value!="" && !echeck(txtEmpEmail.value))
    {
        txtEmpEmail.focus();
        return false;                                      
    }        
    else if(chkEmpAgree && !chkEmpAgree.checked)
        return AlertMsg(chkEmpAgree, "select the option to agree with the Terms & Conditions");    
    
    EmployeeRegistration(txtEmpCode.value, txtDOB, txtEmpPassword.value, txtEmpContact.value, txtEmpEmail.value,"0")
    return false;   
}

function ValidateEmployeeLogin()
{
    var txtEmpUserId = document.getElementById("txtEmpUserId");
    var txtEmpPassword = document.getElementById("txtEmpPassword");
    
    if(txtEmpUserId && txtEmpUserId.value=="")
        return AlertMsg(txtEmpUserId, "enter User ID");
    else if(txtEmpPassword && txtEmpPassword.value=="")
        return AlertMsg(txtEmpPassword, "enter Password");

    EmployeeLogin(txtEmpUserId.value, txtEmpPassword.value);
    return false;                    
}