﻿/* This function will not allow ' and ; in the text box. These 2 characters are mostly used 
    for sql injection */
        function notAllowOnlySpecialCharacters(e)
        {
            // Get the ASCII value of the key that the user entered
            var key = (document.all)?window.event.keyCode:e.which;
            if ((key == 39) || (key == 59))
                // If it was, then dispose the key and continue with entry
                return false;
            else
                // If it was, then allow the entry to continue
                return true; 
        }

        function notAllowSpecialCharacters(e) 
        {                        
            var keycode = (document.all)?window.event.keyCode:e.which;
            //Keys Allowed => HOME, END, DELETE, BACKSPACE, DOT, ALPHABETS, NUMBERS, TAB
            if((keycode >= 47 && keycode <= 57) || (keycode >= 65 && keycode <= 90) || (keycode >= 97 && keycode <= 122) ||  (keycode == 8) || (keycode == 46) || (keycode == 36) || (keycode == 190) || (keycode == 9)|| (keycode == 49)) 
            {
                return true; 
            }
            else
            {
                return false; 
            }

            return true; 
        }

/* This function will allow only alphabetical characters and spaces. */
        
        function allowOnlyAlphabet(e)
        {
            // Get the ASCII value of the key that the user entered
            var key = (document.all)?window.event.keyCode:e.which;
                   
            if ((key >= 65 && key <= 90 ) || (key >= 97 && key<= 122) || (key == 8) || (key == 32)|| (key == 0))
                // If it was, then allow the entry to continue
                return true;
            else
                // If it was not, then dispose the key and continue with entry
                return false; 
        }
        
/* This function will allow only numeric values with no spaces */

        function allowOnlyNumber(evt)
        {
       
            // Get the ASCII value of the key that the user entered
            var charCode = (evt.which) ? evt.which : evt.keyCode
                if ((charCode >= 48 && charCode <= 57 ) || (charCode == 8) || (charCode == 9) || (charCode == 0))
                    // If it was, then allow the entry to continue
                    return true;
                else
                    // If it was not, then dispose the key and continue with entry
                    return false;      
        }
        
/* This function will allow only float/double values with no spaces */

        function allowOnlyFloatNumber(evt)
        {
            // Get the ASCII value of the key that the user entered
            var charCode = (evt.which) ? evt.which : event.keyCode
                if ((charCode >= 48 && charCode <= 57 ) || (charCode == 8) || (charCode == 46) || (charCode == 0))
                    // If it was, then allow the entry to continue
                    return true;
                else
                    // If it was not, then dispose the key and continue with entry
                    return false;  
        }
        
/* This function will allow alphabetical characters, numeric values and spaces. */
        
        function allowAlphabetAndNumer(e)
        {
            // Get the ASCII value of the key that the user entered
            var key = (document.all)?window.event.keyCode:e.which;
            
            if ((key >= 65 && key <= 90 ) || (key >= 97 && key<= 122) || (key >= 48 && key<= 57) || (key == 8) || (key == 32)|| (key == 0) || (key == 45))
                // If it was, then allow the entry to continue
                return true;
            else
                // If it was not, then dispose the key and continue with entry
                return false; 
        }
        
/* This function will not allow anything. 
    It will be used in the date text boxes where no input will be taken from the user. 
    Here the user will click on the calenadr control only */
        function notAllowAnything(e)
                {
                    // Get the ASCII value of the key that the user entered
                    var key = (document.all)?window.event.keyCode:e.which;
                       return false;
                }
        
/* This function will not allow ' and ; and space in the text box. These 2 characters are mostly used 
    for sql injection */
        function ntalw(e)
                {
                    
                    // Get the ASCII value of the key that the user entered
                    var key = (document.all)?window.event.keyCode:e.which;
                    //alert(key);
                    if ((key == 39) || (key == 32) || (key == 59))
                    {
                        // If it was, then dispose the key and continue with entry
                        return false;
                        }
                    else
                        // If it was, then allow the entry to continue
                        return true; 
                }

/* This function will allow alphabetical characters, numeric values with no spaces. */
        function allowAlphabetAndNumerN(e)
        {
            // Get the ASCII value of the key that the user entered
            var key = (document.all)?window.event.keyCode:e.which;
            alert(key);
            if ((key >= 65 && key <= 90 ) || (key >= 97 && key<= 122) || (key >= 48 && key<= 57) || (key == 8) || (key == 0) || (key == 45))
                // If it was, then allow the entry to continue
                return true;
            else
                // If it was not, then dispose the key and continue with entry
                return false;
        }

/* This function will allow alphabetical characters, numeric values with hyphen and no spaces. */
        function allowAlphabetAndNumerSEONAME(e) {
            // Get the ASCII value of the key that the user entered
            var key = (document.all) ? window.event.keyCode : e.which;
          
            if ((key >= 65 && key <= 90) || (key >= 97 && key <= 122) || (key >= 48 && key <= 57) || (key == 8) || (key == 0) || (key == 45) || (key==95))
            // If it was, then allow the entry to continue
                return true;
            else
            // If it was not, then dispose the key and continue with entry
                return false;
        }
        
/* This function will allow only phone no. */        
        function allowPhoneNumber(evt)
        {
            // Get the ASCII value of the key that the user entered
            var charCode = (evt.which) ? evt.which : evt.keyCode
            //alert(charCode);
          
                if ((charCode >= 48 && charCode <= 57 ) || (charCode == 8) || (charCode == 45) || (charCode == 0))
                    // If it was, then allow the entry to continue
                    return true;
                else
                    // If it was not, then dispose the key and continue with entry
                    return false;      
        }

/* This function will allow only phone no. with + and Hyphen symbol */                
        function allowAlphabetAndNumerNPlus(e)
        {
            // Get the ASCII value of the key that the user entered
            var key = (document.all)?window.event.keyCode:e.which;
       
            if ((key >= 65 && key <= 90 ) || (key >= 97 && key<= 122) || (key >= 48 && key<= 57) || (key == 8) || (key == 43) || (key == 0) || (key == 45))
                // If it was, then allow the entry to continue
                return true;
            else
                // If it was not, then dispose the key and continue with entry
                return false;
        }


/* allow alphabat,number and   allow these three charatcter( + , - ) */
        function allowPhoneNumberUSFormat(evt) {
             var keycode = (document.all) ? window.event.keyCode : e.which;
                //Keys Allowed => HOME, END, DELETE, BACKSPACE, DOT, ALPHABETS, NUMBERS, TAB
             
                if ((keycode >= 43 && keycode <= 57)   || (keycode >= 65 && keycode <= 90) || (keycode >= 97 && keycode <= 122) || (keycode == 8) || (keycode == 46) || (keycode == 36) || (keycode == 190) || (keycode == 9)) {
                    return true;
                }
                else {
                    return false;
                }


            }

            function allowPhoneNumberV2(evt) {
                // Get the ASCII value of the key that the user entered
                var charCode = (evt.which) ? evt.which : evt.keyCode
                //alert(charCode);

                if ((charCode >= 43 && charCode <= 57) || (charCode == 8) || (charCode == 45) || (charCode == 9) || (charCode == 0))
                // If it was, then allow the entry to continue
                    return true;
                else
                // If it was not, then dispose the key and continue with entry
                    return false;
            }

