﻿
//To allow Numeric input only
    function evalTextInput(e)
    { 
        var allow = '1234567890';
        var k;
        if((e.keyCode==46 && !document.all)||(e.keyCode==8)||(e.keyCode==9)||(e.keyCode==37 && !document.all)||(e.keyCode==39 && !document.all)||(e.keyCode==35 && !document.all)||(e.keyCode==36 && !document.all))
        {    
            return true;
        }
        k=document.all?parseInt(e.keyCode):parseInt(e.which);
        return (allow.indexOf(String.fromCharCode(k))!=-1);
    }
    
//To check the Range of mobile no
    function checkNumeric(objName,minval, maxval,comma,period,hyphen)
    {
        var numberfield = objName;
        if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
        {
	        numberfield.select();
	        numberfield.focus();
	        return false;
        }
        else
        {
	        return true;
        }
    }
    function chkNumeric(objName,minval,maxval,comma,period,hyphen)
    {
        // only allow 0-9 be entered, plus any values passed
        // (can be in any order, and don't have to be comma, period, or hyphen)
        // if all numbers allow commas, periods, hyphens or whatever,
        // just hard code it here and take out the passed parameters
        var checkOK = "0123456789" + comma + period + hyphen;
        var checkStr = objName;
        var allValid = true;
        var decPoints = 0;
        var allNum = "";

    for (i = 0;  i < checkStr.value.length;  i++)
    {
        ch = checkStr.value.charAt(i);
        for (j = 0;  j < checkOK.length;  j++)
        if (ch == checkOK.charAt(j))
        break;
            if (j == checkOK.length)
            {
                allValid = false;
                break;
            }
            if (ch != ",")
                allNum += ch;
    }
        if (!allValid)
        {	
            alertsay = "Please enter only these values \""
            alertsay = alertsay + checkOK + "\" in the \"" + "GTMobile Number" + "\" field."
            alert(alertsay);
            return (false);
        }

    // set the minimum and maximum
    var chkVal = allNum;
    var prsVal = parseInt(allNum);
        if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
        {
            alertsay = "Please enter a value greater than or "
            alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
            alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + "GTMobile Number" + "\" field."
            alert(alertsay);
            return (false);
        }
    }
//To check Terms and condition checkbox selected or not

    function chkTerms(args)
    {
        var ctrlTerms = document.getElementById(args).id;
            /*if(!ctrlTerms)
            {
                alert("Please select agree Terms and conditions");
                return false;
            }
            else(ctrlTerms)
                return true;*/
        alert(ctrlTerms);
       
    }
     

function evalTextPass(e)
{
    allow = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
    var k;
    if((e.keyCode==46 && !document.all)||(e.keyCode==8)||(e.keyCode==9)||(e.keyCode==37 && !document.all)||(e.keyCode==39 && !document.all)||(e.keyCode==35 && !document.all)||(e.keyCode==36 && !document.all))
    {
    return true;
    }
    k=document.all?parseInt(e.keyCode):parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))!=-1);
}

function evalTextAlphaNum(e)
{
    allow = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
    var k;
    if((e.keyCode==46 && !document.all)||(e.keyCode==8)||(e.keyCode==9)||(e.keyCode==37 && !document.all)||(e.keyCode==39 && !document.all)||(e.keyCode==35 && !document.all)||(e.keyCode==36 && !document.all))
    {
    return true;
    }
    k=document.all?parseInt(e.keyCode):parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))!=-1);
}
// Used for Name Fields (Apellidos)
function evalTextAlpha(e)
{
    allow = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    var k;
    if((e.keyCode==46 && !document.all)||(e.keyCode==8)||(e.keyCode==9)||(e.keyCode==37 && !document.all)||(e.keyCode==39 && !document.all)||(e.keyCode==35 && !document.all)||(e.keyCode==36 && !document.all))
    {
    return true;
    }
    k=document.all?parseInt(e.keyCode):parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))!=-1);
}

function evalTextAlphaNon(e)
{
    allow="'";
    var k;
    if(e.keyCode != 39)
        return true;
    k=document.all?parseInt(e.keyCode):parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))==-1);
}

function evalTextAlphaDocNo(e)
{
    allow = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,.-_:;/\\";
    var k;
    if((e.keyCode==46 && !document.all)||(e.keyCode==8)||(e.keyCode==9)||(e.keyCode==37 && !document.all)||(e.keyCode==39 && !document.all)||(e.keyCode==35 && !document.all)||(e.keyCode==36 && !document.all))
    {
    return true;
    }
    k=document.all?parseInt(e.keyCode):parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))!=-1);
}
// Used for IDentification field
function evalTextAlphaSpecial(e)
{
    allow = ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890/-';
    var k;
    if((e.keyCode==46 && !document.all)||(e.keyCode==8)||(e.keyCode==9)||(e.keyCode==37 && !document.all)||(e.keyCode==39 && !document.all)||(e.keyCode==35 && !document.all)||(e.keyCode==36 && !document.all))
    {
    return true;
    }
    k=document.all?parseInt(e.keyCode):parseInt(e.which);
    return (allow.indexOf(String.fromCharCode(k))!=-1);
}
    
function checkpasslen(objValue, object)
{
    if(objValue.value.length>4)
    {
        alert('Post Code Must be 4 digits');
        objValue.value = "";
        document.getElementById(object).focus();
    }
}

//function checkMobile(str,val)
//{
//    strvalue = str.value;   
//     
//    if(strvalue.length > 0)
//    {
//        if(strvalue.length<8)
//        {
//        if(val == "Mob")
//        {
//            alert('You have entered a wrong Lycamobile number');
//        }
//        else
//        {
//            alert('You have entered a wrong PUK code');
//        }
//        str.value = "";
//        str.focus();
//        }
//    }
//}

//function checkPuk(str)
//{
//    strvalue = str.value;
//    if(strvalue.length<8)
//    {
//    alert('You have entered a wrong PUK code');
//    str.value = "";
//    str.focus();
//    }
//}


