﻿// JScript File
function FriendValidate()
{
                        
                       var obj = document.getElementById('txtFirstName');
                       if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            return false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                            return false;
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("CountryError").innerHTML = "";
                            document.getElementById("CountryError").innerHTML = "Select your country of residence";
                            document.getElementById("CountryError").style.display = "block";
                            return false;
                       }
                       else
                       {
                            document.getElementById("CountryError").style.display = "none";
                       }
                     
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                            return false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            return false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            return false;
                       }
                       
                       obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("contactDiv").innerHTML = "";
                            document.getElementById("contactError").innerHTML = "Select your contact preference";
                            document.getElementById("contactDiv").style.display = "block";
                            return false;
                       }
                       else
                       {
                            document.getElementById("contactDiv").style.display = "none";
                       }
                       
                       
                       obj = document.getElementById("ddlPropertyLocated");
                       if(obj != null)
                       {
                               if(obj.options[obj.options.selectedIndex].value == "-1")
                               {
                                    document.getElementById("propertyError").innerHTML = "";
                                    document.getElementById("propertyError").innerHTML = "Select your property location";
                                    document.getElementById("propertyError").style.display = "block";
                                    return false;
                               }
                               else
                               {
                                    document.getElementById("propertyError").style.display = "none";
                               }
                       }
                       
                       obj = document.getElementById("ddlPropertyType");
                       if(obj != null)
                       {
                               if(obj.options[obj.options.selectedIndex].value == "-1")
                               {
                                    document.getElementById("propertyType").innerHTML = "";
                                    document.getElementById("propertyType").innerHTML = "Select your property type";
                                    document.getElementById("propertyType").style.display = "block";
                                    return false;
                               }
                               else
                               {
                                    document.getElementById("propertyType").style.display = "none";
                               }
                       }
                       
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            return false;
                       }
                       obj = document.getElementById('txtSubject');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"subject",'subjectError')))
                           {
                                return false;
                           }
                       }
                       
                       obj = document.getElementById('txtComments');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"your comments",'commentsError')))
                           {
                                return false;
                           }
                       }
                       obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                                return false;
                           }
                       }
                       
                       return true;
                                     
        }
      
      

function CheckAttachement(id)
{
    var obj = document.getElementById(id);
    if(obj.value.length > 0)
              {
                var str = obj.value.substring(obj.value.length-3);
                if(str != 'pdf' && str != 'doc' && str != 'ocx' )
                {
                    document.getElementById("attachDiv").innerHTML = "";
                    document.getElementById("attachDiv").innerHTML = "Add your attachment in pdf/doc format.";
                    document.getElementById("attachDiv").style.display = "block";
                }
                else
                {
                    document.getElementById("attachDiv").style.display = "none";
                }
           }
           
}



function CheckFiles(id){
var letterType =  "";
if(id == "coverLetter")
   letterType = "cover letter"; 
else
   letterType = "CV / Resume";

var obj = document.getElementById(id);
            if(obj.value.length > 0)
              {
                var str = obj.value.substring(obj.value.length-3);
                if(str != 'pdf' && str != 'doc' && str != 'ocx' )
                 {
                    if(id == "coverLetter")
                    {
                    document.getElementById("coverLetterDiv").innerHTML = "";
                    document.getElementById("coverLetterDiv").innerHTML = "The cover letter should be in PDF/Word format";
                    document.getElementById("coverLetterDiv").style.display = "block";
                    }
                    else
                    {
                    document.getElementById("resumeLetterDiv").innerHTML = "";
                    document.getElementById("resumeLetterDiv").innerHTML = "The resume should be in PDF/Word format";
                    document.getElementById("resumeLetterDiv").style.display = "block";
                    }
                    return false;
                 }
                 else
                 {
                    document.getElementById("coverLetterDiv").style.display = "none";
                    document.getElementById("resumeLetterDiv").style.display = "none";
                    return true;
                 }
             }
             else
             {
                if(id == "coverLetter")
                {
                    document.getElementById("coverLetterDiv").innerHTML = "";
                    document.getElementById("coverLetterDiv").innerHTML = "Please attach a cover letter";
                    document.getElementById("coverLetterDiv").style.display = "block";
                }
                else
                {
                    document.getElementById("resumeLetterDiv").innerHTML = "";
                    document.getElementById("resumeLetterDiv").innerHTML = "Please attach a Resume/CV";
                    document.getElementById("resumeLetterDiv").style.display = "block";
                }
                                
                //alert('Please provide your ' + letterType + ' in pdf or doc format');
                return false;
             }
 }
 
 function validateEnquireAboutProperty()
 {
 
        var result = true;
        var obj = document.getElementById("ddlTitle");
    
        if(obj.options[obj.options.selectedIndex].value == '-1')
        {
            document.getElementById("titleError").style.display = "block";
            result = false;
        }
        else{ document.getElementById("titleError").style.display = "none"; }
                       obj = document.getElementById('txtFirstName');
                       if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            result = false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                            result =  false;
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("CountryError").innerHTML = "";
                            document.getElementById("CountryError").innerHTML = "Select your country of residence";
                            document.getElementById("CountryError").style.display = "block";
                            result = false;
                       }
                       else
                       {
                            document.getElementById("CountryError").style.display = "none";
                       }
                       
                       
                       
                      
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            result = false;
                       }
                       
                       obj = document.getElementById("ddlHowWeCont");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("ddlHowWeContError").innerHTML = "";
                            document.getElementById("ddlHowWeContError").innerHTML = "Select your contact preference";
                            document.getElementById("ddlHowWeContError").style.display = "block";
                            result = false;
                       }
                       else
                       {
                            document.getElementById("ddlHowWeContError").style.display = "none";
                       }
                      obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                                result = false;
                           }
                       }                 
                       obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("contactDiv").innerHTML = "";
                            document.getElementById("contactDiv").innerHTML = "Select your contact preference";
                            document.getElementById("contactDiv").style.display = "block";
                            result = false;
                       }
                       else
                       {
                            document.getElementById("contactDiv").style.display = "none";
                       }
                       
                       if(!result)
                       {
                            validateEnquireAboutPropertyFocus();
                       }
                     
                       return result;
                       
                       
 }
 
  function validateEnquireAboutPropertyFocus()
 {
 
        
        var obj = document.getElementById("ddlTitle");
    
        if(obj.options[obj.options.selectedIndex].value == '-1')
        {
          obj.focus();
            return false;
        }
       
                       obj = document.getElementById('txtFirstName');
                       if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                               obj.focus();
                          return false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                          obj.focus();
                          return false;
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                          obj.focus();
                           return false;
                       }
                      
                       
                       
                       
                      obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                          obj.focus();
                         return false;
                       }
                       
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                              obj.focus();
                           return false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                          obj.focus();
                           return false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                         obj.focus();
                           return false;
                       }
                       
                       obj = document.getElementById("ddlHowWeCont");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                          obj.focus();
                           return false;
                       }
                       
                       obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                              obj.focus();
                              return false;
                           }
                       }                
                       
                       
                       return false;
                     
                       
                       
                       
 }
 
 function validateGeneralContactFocus()
 {
        var obj = document.getElementById("ddlTitle");
    
        if(obj.options[obj.options.selectedIndex].value == '-1')
        {
             obj.focus();
             return false;
        }
                       obj = document.getElementById('txtFirstName');
                       if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            obj.focus();
                             return false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                       obj.focus();
                            return false;
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       { 
                       obj.focus();
                            return false;
                       }                 
                       
                      
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                             obj.focus();
                             return false;
                       }
                        obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            obj.focus();
                            return false;
                       }
                       
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            obj.focus();
                            return false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                             obj.focus();
                             return false;
                       }
                       
                        obj = document.getElementById('txtSubject');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"subject",'subjectError')))
                           {
                                obj.focus();
                                 return false;
                           }
                       }   
                       
                        obj = document.getElementById('txtMessage');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"message",'txtMessageError')))
                           {
                                 return false;
                           }
                       }   
                       
                      obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                                obj.focus();
                               return false;
                           }
                       }                 
                       
                       
                       return true;
 }
 function validateGeneralContact()
 {
 
        var result  = true;
        var obj = document.getElementById("ddlTitle");
    
        if(obj.options[obj.options.selectedIndex].value == '-1')
        {
            document.getElementById("titleError").style.display = "block";
            result = false;
        }else{ document.getElementById("titleError").style.display = "none"; }
                       obj = document.getElementById('txtFirstName');
                       if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            result = false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                            result =  false;
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("CountryError").innerHTML = "";
                            document.getElementById("CountryError").innerHTML = "Select your country of residence";
                            document.getElementById("CountryError").style.display = "block";
                            result = false;
                       }
                       else
                       {
                            document.getElementById("CountryError").style.display = "none";
                       }
                       
                       
                       
                      
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            result = false;
                       }
                       
                        obj = document.getElementById('txtSubject');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"subject",'subjectError')))
                           {
                                result = false;
                           }
                       }   
                       
                        obj = document.getElementById('txtMessage');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"message",'txtMessageError')))
                           {
                                result = false;
                           }
                       }   
                       
                      obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                                result = false;
                           }
                       }                 
                       obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("contactDiv").innerHTML = "";
                            document.getElementById("contactDiv").innerHTML = "Select your contact preference";
                            document.getElementById("contactDiv").style.display = "block";
                            result = false;
                       }
                       else
                       {
                            document.getElementById("contactDiv").style.display = "none";
                       }
                       
                         if(!result)
                       {validateGeneralContactFocus();}
                         return result;
                       
                       return result;
                       
                       
 }
 
 


function validateSellersAndLandLords()
{
                       var result = true;
                       var obj = document.getElementById('ddlTitle');
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                           
                            document.getElementById("ddlTitleError").style.display = "block";                            
                           result = false;
                       }
                       else
                       {
                            document.getElementById("ddlTitleError").style.display = "none";
                       } 
                       
                       obj = document.getElementById('txtFirstName');
                        if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            result = false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                            result = false;
                       } 
                                              
                       obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("contactDiv").innerHTML = "";
                            document.getElementById("contactDiv").innerHTML = "Select your contact preference";
                            document.getElementById("contactDiv").style.display = "block";
                            result = false;
                       }
                       else
                       {
                            document.getElementById("contactDiv").style.display = "none";
                       }
                     
                       obj = document.getElementById('txtCountryCode');
                       if(!(chkEmpty(obj,"country code",'contactDiv') && chkPattern(obj,"country code",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv') && chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv') && chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            result = false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            result = false;
                       }
                       
                       
                       
                       
                       obj = document.getElementById("ddlPropertyType");
                       if(obj != null)
                       {
                       
                           if(!(chkEmpty(obj,"property type",'errorddlPropertyType')))
                               {
                                    result = false;
                               }                       
                              
                       }
                       
                       
                       
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            result = false;
                       }
                                              
                      
                       
                       obj = document.getElementById('txtLocation');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"your community",'errortxtLocation')))
                           {
                                result = false;
                           }
                       }
                       
                       obj = document.getElementById('txtBuldingName');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"building name",'errortxtBuldingName')))
                           {
                                result = false;
                           }
                       }
                       
                       obj = document.getElementById('txtFloorNo');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"floor no.",'errortxtFloorNo')))
                           {
                              result = false;
                           }
                       }
                       obj = document.getElementById('txtUnitNo');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"unit no.",'errortxtUnitNo')))
                           {
                               result = false;
                           }
                       }
                      
                      
//                       obj = document.getElementById('txtStreetNo');
//                       if(obj != null)
//                       {
//                           if(!(chkEmpty(obj,"street no.",'errortxtStreetNo')))
//                           {
//                                result = false;
//                           }
//                       }
                       
                       
//                       obj = document.getElementById('txtOrignalPrice');
//                       if(obj != null)
//                       {
//                           if(!(chkEmpty(obj,"Orignal price",'errortxtOrignalPrice')))
//                           {
//                                result = false;
//                           }
//                       }
                       
                       
                       obj = document.getElementById('txtAskingPrice');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"asking price",'errortxtAskingPrice')))
                           {
                                result = false;
                           }
                       }
                       obj = document.getElementById('txtView');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"unit views",'errortxtView')))
                           {
                                result = false;
                           }
                       }
                        obj = document.getElementById('txtBeds');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"bedrooms",'txtBedsError')))
                           {
                               result = false;
                           }
                       }
                       
                       obj = document.getElementById('txtDescription');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"description",'errortxtDescription')))
                           {
                               result = false;
                           }
                       }
                       
                        obj = document.getElementById('txtUnitArea');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"unit area.",'errortxtUnitArea')))
                           {
                               result = false;
                           }
                       }
                       
                       obj = document.getElementById('txtImage');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"Image",'errortxtImage')))
                           {
                                result = false;
                           }
                       }
                       obj = document.getElementById('txtFloorPlans');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"Floor plan",'errortxtFloorPlans')))
                           {
                               result = false;
                           }
                       }                       
                       obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                                result = false;
                           }
                       }
                       if(!result)
                       {validateSellersAndLandLordsFocus();}
                         return result;
}

function validateSellersAndLandLordsFocus()
{
                       
                       var obj = document.getElementById("ddlPropertyType");
                       if(obj != null)
                       {
                       
                           if(!(chkEmpty(obj,"property type",'errorddlPropertyType')))
                               {
                                    return false;
                               }                       
                              
                       }
                       
                       
                       
                       obj = document.getElementById('txtLocation');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"your loaction",'errortxtLocation')))
                           {
                                return false;
                           }
                       }
                       
                       obj = document.getElementById('txtBuldingName');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"bulding name",'errortxtBuldingName')))
                           {
                                return false;
                           }
                       }
                       
                       obj = document.getElementById('txtFloorNo');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"floor no.",'errortxtFloorNo')))
                           {
                             return false;
                           }
                       }
                       obj = document.getElementById('txtUnitNo');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"unit no.",'errortxtUnitNo')))
                           {
                               return false;
                           }
                       }
//                       obj = document.getElementById('txtStreetNo');
//                       if(obj != null)
//                       {
//                           if(!(chkEmpty(obj,"street no.",'errortxtStreetNo')))
//                           {
//                                return false;
//                           }
//                       }
//                       obj = document.getElementById('txtOrignalPrice');
//                       if(obj != null)
//                       {
//                           if(!(chkEmpty(obj,"Orignal price",'errortxtOrignalPrice')))
//                           {
//                               return false;
//                           }
//                       }
                       obj = document.getElementById('txtAskingPrice');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"asking price",'errortxtAskingPrice')))
                           {
                                return false;
                           }
                       }
                       obj = document.getElementById('txtView');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"unit views",'errortxtView')))
                           {
                               return false;
                           }
                       }
                        obj = document.getElementById('txtBeds');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"bedrooms",'txtBedsError')))
                           {
                               return false;
                           }
                       }
                       
                                             
                        obj = document.getElementById('txtUnitArea');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"unit area.",'errortxtUnitArea')))
                           {
                               return false;
                           }
                       }
                       
                         obj = document.getElementById('txtDescription');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"description",'errortxtDescription')))
                           {
                              return false;
                           }
                       }
                       
                       obj = document.getElementById('txtImage');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"Image",'errortxtImage')))
                           {
                                return false;
                           }
                       }
                       obj = document.getElementById('txtFloorPlans');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"Floor plan",'errortxtFloorPlans')))
                           {
                               return false;
                           }
                       }                   
                        obj = document.getElementById('ddlTitle');
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {               
                               return false;
                       }
                       
                       
                       obj = document.getElementById('txtFirstName');
                        if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            return false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                             return false;
                       } 
                       
                       obj = document.getElementById("ddlContactMethod");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                        {                                      
                           return false;
                       }
                     
                       obj = document.getElementById('txtCountryCode');
                       if(!(chkEmpty(obj,"country code",'contactDiv') && chkPattern(obj,"country code",/^\s*([0-9])/,'contactDiv')))
                       {
                            return false;
                       }
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv') && chkPattern(obj,"area code",/^\s*([0-9])/,'contactDiv')))
                       {
                            return false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv') && chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            return false;
                       }
                       
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                           return false;
                       }
                       
                       obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                                return false;
                           }
                       }
                       
                         
}


function careerApplyNowValidate()
{
         var result  = true;
        var obj = document.getElementById("ddlTitle");
    
        if(obj.options[obj.options.selectedIndex].value == '-1')
        {
            document.getElementById("titleError").style.display = "block";
             result = false;
             obj.focus();
             
        }else{ document.getElementById("titleError").style.display = "none"; }
        
                        obj = document.getElementById('txtName');
                        if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                             result = false;
                             obj.focus();
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                             result = false;
                               obj.focus();
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("CountryError").innerHTML = "";
                            document.getElementById("CountryError").innerHTML = "Select your country of residence";
                            document.getElementById("CountryError").style.display = "block";
                             result = false;
                               obj.focus();
                       }
                       else
                       {
                            document.getElementById("CountryError").style.display = "none";
                       }
                     
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code", /^\s*\d+\s*$/,'contactDiv')))
                       {
                            result = false;
                              obj.focus();
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number", /^\s*\d+\s*$/,'contactDiv')))
                       {
                           result = false;
                             obj.focus();
                       }
                        
                       obj = document.getElementById('txtEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                           result = false;
                            obj.focus();
                       }
                       if(!(CheckFiles("coverLetter") && CheckFiles("ResumeLetter")))
                       {
                           result = false;
                             obj.focus();
                       }
                       
                      obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                               result = false;
                                 obj.focus();
                           }
                       }
                       
                        if(!result)
                       {careerApplyNowValidateSharfo();}
                         return result;
                       
           
}


function careerApplyNowValidateSharfo()
{
        var obj = document.getElementById("ddlTitle");
    
        if(obj.options[obj.options.selectedIndex].value == '-1')
        {
            document.getElementById("titleError").style.display = "block";
             return false;
        }else{ document.getElementById("titleError").style.display = "none"; }
        
                        obj = document.getElementById('txtName');
                        if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            return false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                             return false;
                       } 
                                              
                       obj = document.getElementById("ddlCountry");
                       if(obj.options[obj.options.selectedIndex].value == "-1")
                       {
                            document.getElementById("CountryError").innerHTML = "";
                            document.getElementById("CountryError").innerHTML = "Select your country of residence";
                            document.getElementById("CountryError").style.display = "block";
                           return false;
                       }
                       else
                       {
                            document.getElementById("CountryError").style.display = "none";
                       }
                     
                      
                       obj = document.getElementById('txtAreaCode');
                       if(!(chkEmpty(obj,"area code",'contactDiv')&& chkPattern(obj,"area code", /^\s*\d+\s*$/,'contactDiv')))
                       {
                            return false;
                       }
                        
                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number", /^\s*\d+\s*$/,'contactDiv')))
                       {
                           result = false;
                       }
                        
                       obj = document.getElementById('txtEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                           return false;
                       }
                       if(!(CheckFiles("coverLetter") && CheckFiles("ResumeLetter")))
                       {
                           return false;
                       }
                       
                      obj = document.getElementById('txtCaptcha');
                       if(obj != null)
                       {
                           if(!(chkEmpty(obj,"captcha text",'captchaError')))
                           {
                              return false;
                           }
                       }
                       
                      
                       
           
}
//----------------
function validateGenericForm()
 {

        var result  = true;
        var errorElement = "";
        var obj = document.getElementById('txtFirstName');
    
                       obj = document.getElementById('txtFirstName');
                       if(!(chkEmpty(obj,"first name",'firstnameError')  && chkPattern(obj,"first name",/^\s*([A-Z]|[a-z])/,'firstnameError')))
                       {
                            errorElement = "txtFirstName";
                            result = false;
                       } 
                       
                       obj = document.getElementById('txtLastName');
                        if(!(chkEmpty(obj,"last name",'lastnameError')  && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/,'lastnameError')))
                       {
                            if(errorElement == "")
                            {
                                errorElement = "txtLastName";
                            }
                            result =  false;
                       } 

                       obj = document.getElementById('txtPhoneNumber');
                       if(!(chkEmpty(obj,"phone number",'contactDiv')&& chkPattern(obj,"phone number",/^\s*([0-9])/,'contactDiv')))
                       {
                            if(errorElement == "")
                            {
                                errorElement = "txtPhoneNumber";
                            }
                            result = false;
                       }
                        
                       obj = document.getElementById('txtYourEmail');
                       if(!(chkEmpty(obj,"your email address",'yourEmailError') && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,'yourEmailError')))
                       {
                            if(errorElement == "")
                            {
                                errorElement = "txtYourEmail";
                            }
                            result = false;
                       }
//                       
//                       obj = document.getElementById("ddlproperty");
//                       if(obj.options[obj.options.selectedIndex].value == "-1")
//                       {
//                            document.getElementById("PropertyError").innerHTML = "";
//                            document.getElementById("PropertyError").innerHTML = "Select a property.";
//                            document.getElementById("PropertyError").style.display = "block";
//                            result = false;
//                       }
//                       else
//                       {
//                            document.getElementById("PropertyError").style.display = "none";
//                       }
                        
                       
                         if(!result)
                        {
                            if(errorElement != "")
                            {
                                document.getElementById(errorElement).focus();
                            }
                            return false;
                        }
                         return result;
                       
                      
                       
                       
 }
 
 



//----------------
