﻿// JScript File

//Feedback-Suggestion.aspx form used the following function
//www.cybex.in>Feedback-Suggestion.aspx
function FeedBackFieldsRequired()
{    
    var name_len=window.document.getElementById('ctl00_BodyContents_txtName').value.length;    
    var mail_len=window.document.getElementById('ctl00_BodyContents_txtEmail').value.length;    
    var message_len=window.document.getElementById('ctl00$BodyContents$txtMessage').value.length;
    var captcha = window.document.getElementById('ctl00_BodyContents_txtCaptcha').value;
        

    if (name_len===0)
    {
        alert("Please Enter Your Name");
        window.document.getElementById('ctl00_BodyContents_txtName').focus();
        return false;        
    }    
    else
    {
        if(mail_len===0)
        {
        alert("Please Enter Your Email ID");
        window.document.getElementById('ctl00_BodyContents_txtEmail').focus();
        return false;      
        }
        else
        {
            if(mail_len!==0)
            {
                 /********* IF Email is Entered, VALIDATE EMAIL ADDRESS *********/    
                var mailadd=window.document.getElementById('ctl00_BodyContents_txtEmail').value;
                var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;         
                if( !emailPattern.test(mailadd))                        
                {
                    alert("Please Enter Valid Email Id");
                    window.document.getElementById('ctl00_BodyContents_txtEmail').focus();
                    window.document.getElementById('ctl00_BodyContents_txtEmail').select();
                    return false; 
                }                
                else
                {
                    if(message_len===0)
                    {
                    alert("Please Enter Your Message");
                    window.document.getElementById('ctl00_BodyContents_txtMessage').focus();
                    return false;      
                    }
                    else
                    {   
                      if( captcha === 'Enter the security code' || captcha === '')    
                      {
                      alert("Please Enter the Security Code");   
                      return false;      
                      }
                      else
                      {  
                       /* IF ALL FIELDS ARE ENTERED PROPERLY BY THE USER */
                       return true;
                      }
                    }
                }                 
                                
             }       
        }
    }      
    
}


function FeedBackofCRM()
{    
    var name_len=window.document.getElementById('ctl00_BodyContents_txtName').value.length;    
    var mail_len=window.document.getElementById('ctl00_BodyContents_txtEmail').value.length;    
    var sub_len=window.document.getElementById('ctl00_BodyContents_txtSubject').value.length;        
    var message_len=window.document.getElementById('ctl00$BodyContents$txtMessage').value.length;
    var captcha = window.document.getElementById('ctl00_BodyContents_txtCaptcha').value;
        

    if (name_len===0)
    {
        alert("Please Enter Your Name");
        window.document.getElementById('ctl00_BodyContents_txtName').focus();
        return false;        
    }
    
    
    else
    {
        if(mail_len===0)
        {
        alert("Please Enter Your Email ID");
        window.document.getElementById('ctl00_BodyContents_txtEmail').focus();
        return false;      
        }
        else
        {
            if(mail_len!==0)
            {
                 /********* IF Email is Entered, VALIDATE EMAIL ADDRESS *********/    
                var mailadd=window.document.getElementById('ctl00_BodyContents_txtEmail').value;
                var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;         
                if( !emailPattern.test(mailadd))                        
                {
                    alert("Please Enter Valid Email Id");
                    window.document.getElementById('ctl00_BodyContents_txtEmail').focus();
                    window.document.getElementById('ctl00_BodyContents_txtEmail').select();
                    return false; 
                }                
                else
                {
                    if(sub_len === 0)
                    {
                    alert("Please enter Subject Line");
                    window.document.getElementById('ctl00_BodyContents_txtSubject').focus();
                    return false;
                    }   
                    else
                    {
                        if(message_len===0)
                        {
                        alert("Please Enter Your Message");
                        window.document.getElementById('ctl00_BodyContents_txtMessage').focus();
                        return false;      
                        }
                        else
                        {   
                            if( captcha === 'Enter the security code' || captcha === '')    
                            {
                            alert("Please Enter the Security Code");  
                            window.document.getElementById('ctl00_BodyContents_txtCaptcha').focus(); 
                            return false;      
                            }
                            else
                            {  
                            /* IF ALL FIELDS ARE ENTERED PROPERLY BY THE USER */
                            return true;
                            }
                        }
                    }
                }                 
                                
             }       
        }
    }      
    
}

