﻿// JScript File


//To check whether all mendatory fields all filled on not

function validate_comparepass1()
{   
    var _Telno = window.document.getElementById('ctl00_BodyContents_txt_Phone_Number').value;
    var _Mobile= window.document.getElementById('ctl00_BodyContents_txt_Mobile').value;
    
    if (_Telno === "" && _Mobile=== "")
    {
        alert("Please provide either Telephone or Mobile Number.");  
        window.document.getElementById('ctl00_BodyContents_txt_Phone_Number').focus();
        return false;  
    } 
    else
    {
      return confirm('Your Login Crendentials will be sent to your email address, \nClick OK to continue.');
    }    
}


//To check whether all mendatory fields all filled on not 
//Paid-users section Register

function validate_comparepass()
{       

var EmaiAddress=window.document.getElementById('ctl00_BodyContents_txt_emailid').value;
var RegExEmail = /^(?:\w+\.?)*\w+@(?:\w+\.)+\w+$/; 

    var _Contactperson = window.document.getElementById('ctl00_BodyContents_txt_firstname').value;
    var _Email = window.document.getElementById('ctl00_BodyContents_txt_emailid').value;
    var _Loginid = window.document.getElementById('ctl00_BodyContents_txt_loginid').value;   
    var captcha = window.document.getElementById('ctl00_BodyContents_txt_captcha_verification').value;   
    

    if (_Contactperson === "" || _Email === "" || _Loginid === "" || captcha === "")
    {
        alert("Please enter all fields marked with (*)");        
        return false;  
    }  
    else 
    {
        if (!RegExEmail.test(EmaiAddress)) 
        { 
            alert("Please Enter Valid E-mail Adress"); 
            return false;
        }   
  
       if( captcha === 'Enter the security code' || captcha === '')    
       {
         alert("Please Enter the Security Code");   
         return false;      
       } 
       
       if(document.getElementById("ctl00_BodyContents_chk_Terms_conditions").checked === false)
       {
         alert("Please accept the Terms and Conditions of this site.");   
         return false;             
       }
        
    }  
 }


//postal code validation function in paid user registration page 2 on
  function onlynumber_pincode(e)         
    {      
        var code;   
    e = e || window.event;
    if (e.keyCode) 
        {
            code = e.keyCode;
        } 
    else if (e.which) 
        {
            code = e.which;
        }

    if (code === 32) 
        {
        e.cancelBubble = true;
        e.returnValue = false;

        if (e.stopPropagation) 
            {
                e.stopPropagation();
                e.preventDefault();
            }
        return false;
        }
   
    if((code < 48 || code >57) && (code !== 8) && (code !== 46) && (code !== 37) && (code !== 39))
    {
        e.cancelBubble = true;
        e.returnValue = false;
        
         if (e.stopPropagation) 
            {
                e.stopPropagation();
                e.preventDefault();
            }
            
        return false;   
    }                   
}   
    
    
//restrict user to enter only number in textbox in home.masterpage
function validate_phone_mobile(e)         
 {      
      var code;   
    e = e || window.event;
    if (e.keyCode) 
        {
            code = e.keyCode;
        } 
    else if (e.which) 
        {
            code = e.which;
        }

    if (code === 32) 
        {
        e.cancelBubble = true;
        e.returnValue = false;

        if (e.stopPropagation) 
            {
                e.stopPropagation();
                e.preventDefault();
            }
        return false;
        }
   
    if((code < 48 || code > 57) && (code !== 8) && (code !== 46) && (code !== 37) && (code !== 39) && (code !== 43) && (code !== 45) && (code !== 40) && (code !== 41))
    {
        e.cancelBubble = true;
        e.returnValue = false;
        
         if (e.stopPropagation) 
            {
                e.stopPropagation();
                e.preventDefault();
            }
            
        return false;   
    }  
      
        
}       
       