﻿// JScript File
        function CheckValue()
        {   
            var txt_Name=document.getElementById('txt_Name');
            var txt_Company=document.getElementById('txt_Company');
            var txt_Phone=document.getElementById('txt_Phone');
            var txt_MobileNo=document.getElementById('txt_MobileNo');
            var txt_Email=document.getElementById('txt_Email');
            var txt_Subject=document.getElementById('txt_Subject');
            var txt_Message=document.getElementById('txt_Message');
            var strError=document.getElementById('lbl_mandotary');
            
            if(fnValidateInput(txt_Name,"getlen") == 0)
            {
                   alert('Name should not left blank !!');
                    if (txt_Name.disabled==false)
                    {
                        txt_Name.focus();
                    }    
                    return false;
            } 
           else if(!fnValidateInput(txt_Name,"alnum_s"))
            {
                     alert('Special Characters are not allowed for Name !!');
                     if (txt_Name.disabled==false)
                     {
                        txt_Name.focus();
                     }    
                     return false;  
            }
            
            if(fnValidateInput(txt_Company,"getlen") == 0)
            {
                   alert('Company Name should not left blank !!');
                    if (txt_Company.disabled==false)
                    {
                        txt_Company.focus();
                    }    
                    return false;
            } 
            else if(!fnValidateInput(txt_Company,"alnum_s"))
            {
                     alert('Special Characters are not allowed for Company Name !!');
                     if (txt_Company.disabled==false)
                     {
                        txt_Company.focus();
                     }    
                     return false;  
            }
            
            if (fnValidateInput(txt_MobileNo,"getlen") == 0 && fnValidateInput(txt_Phone,"getlen") == 0)
            {
                alert("Out of the Phone No. or Mobile No. One is mandatory !!");
                if (txt_Phone.disabled==false)
                    {
                        txt_Phone.focus();
                    }    
                return false;
            }
            else if (fnValidateInput(txt_Phone,"getlen") != 0 && fnValidateInput(txt_Phone,"maxlen",7))
            {
                alert("Please enter valid Telephone No. !!");
                if (txt_Phone.disabled==false)
                    {
                        txt_Phone.focus();
                    }    
                return false;
            }
            else if (fnValidateInput(txt_MobileNo,"getlen") != 0 && fnValidateInput(txt_MobileNo,"maxlen",9))
            {
                alert("Please enter valid Mobile No. !!");
                if (txt_MobileNo.disabled==false)
                    {
                        txt_MobileNo.focus();
                    }    
                return false;
            }
            
            if(fnValidateInput(txt_Email,"getlen") == 0)
            {       
                alert('Email should not left blank !!');
                if (txt_Email.disabled==false)
                {
                    txt_Email.focus();
                }    
                return false; 
            }
            else if (!(txt_Email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1))
            {
                alert("Please enter valid Email ID !!");
                if(txt_Email.disabled==false)
                {
                    txt_Email.focus();   
                } // if(txt_Email.disabled==false)
                return false; 
            }
            
            if(fnValidateInput(txt_Subject,"getlen") == 0)
            {
                   alert('Subject should not left blank !!');
                    if (txt_Subject.disabled==false)
                    {
                        txt_Subject.focus();
                    }    
                    return false;
            } 
            else if(!fnValidateInput(txt_Subject,"alnum_s"))
            {
                     alert('Special Characters are not allowed for Subject !!');
                     if (txt_Subject.disabled==false)
                     {
                        txt_Subject.focus();
                     }    
                     return false;  
            }
            
            if(fnValidateInput(txt_Message,"getlen") == 0)
            {
                   alert('Message should not left blank !!');
                    if (txt_Message.disabled==false)
                    {
                        txt_Message.focus();
                    }    
                    return false;
            } 
            
            return true;
    } // function CheckValue()
