﻿// JScript File
      function fillCountryCode(obj)
             {
                var txtCountryCode = document.getElementById('txtContactCountryCode');
                if(obj.options[obj.options.selectedIndex].value != "-1")
                {
                  var Code = obj.options[obj.options.selectedIndex].value.split('-') ;
                  txtCountryCode.value = Code[2];
                }
                else
                {
                     txtCountryCode.value = "";
                }
             }
             function validate()
             {
               var obj = document.getElementById('ddltitle');
               if(obj.options[obj.options.selectedIndex].value == "-1")
               {
                         alert("Please Select Title");
                         obj.focus();
                         return false;
               }
                
                obj = document.getElementById('txtName');
               if(!(chkEmpty(obj,"first name") && chkLength(obj,"First name",3,25) && chkPattern(obj,"First name",/^\s*([A-Z]|[a-z])/)))
               {
                    return false;
               }               
               obj = document.getElementById('txtLastName');
               if(!(chkEmpty(obj,"last name") && chkLength(obj,"Last name",3,25) && chkPattern(obj,"last name",/^\s*([A-Z]|[a-z])/)))
               {
                    return false;
               } 
                     
                          
                 obj = document.getElementById('txtContactAreaCode');
                if(!(chkEmpty(obj,"area code") && chkLength(obj,"Area code",1,3) && chkPattern(obj,"area code",/^\d*[0-9]?$/)))
               {
                    return false;
               } 
                     
                obj = document.getElementById('txtContactNo');
               if(!(chkEmpty(obj,"contact number") && chkLength(obj,"Contact number",5,9) && chkPattern(obj,"contact number",/^\d*[0-9]?$/)))
               {
                    return false;
               } 
               obj = document.getElementById('txtEmail');
               if(!(chkEmpty(obj,"email address") && chkPattern(obj,"email address",/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)))
               {
                    return false;
               } 
               
                obj = document.getElementById('txtEnquiry');
               if(!(chkEmpty(obj,"Some Content")))
               {
                    return false;
               } 
               
                            
               
                



               obj = document.getElementById('ddlCountry');
               if(obj.options[obj.options.selectedIndex].value == "-1")
               {
                         alert("Please Select Country of residence");
                         obj.focus();
                         return false;
               }
                return true;
                 
           
                 

            
                
             }
             
             


