﻿// JScript File

function checkLength50(e,textboxID)
{

    var txtBoxID=document.getElementById(textboxID);
    var Val=txtBoxID.value;
    
    if(typeof txtBoxID == 'object')
    {
        if(Val.length > 50)
        {    
            errorMessage="You have exceeded the max limit of 50 for this field.";
            alert(errorMessage);
            txtBoxID.focus();
            
        }
    }
}
function checkLength10(e,textboxID)
{
    var txtBoxID=document.getElementById(textboxID);
    var Val=txtBoxID.value;

    if(typeof txtBoxID == 'object')
    {
        if(Val.length > 10)
        {    
            errorMessage="You have exceeded the max limit of 10 for this field.";
            alert(errorMessage);
            txtBoxID.focus();
           
        }
    }
}



function checkLength(e,ctl,maxlength)
{
 var unicode = e.charCode ? e.charCode : e.keyCode;
 if (unicode > 32 && unicode!=127 && unicode!=46 && unicode !=37 && unicode !=38 && unicode !=39 && unicode !=40)
 {
    if (ctl.value.length > maxlength-1)
    {
        alert("You have exceeded the max limit of " + maxlength + " for this field.");
        return false;
    }
    else
    return true;
 }
}
function checkLengthNoSpace(e,ctl,maxlength)
{
 var unicode = e.charCode ? e.charCode : e.keyCode;
 if (unicode > 31 && unicode!=127 && unicode!=46 && unicode !=37 && unicode !=38 && unicode !=39 && unicode !=40)
 {
    if (ctl.value.length > maxlength-1)
    {
        alert("You have exceeded the max limit of " + maxlength + " for this field.");
        return false;
    }
   else if (unicode ==32 )
     { 
     alert("Space is not allowed in this field.");
        return false;
    }
    else
    return true;
 }
}

function checkLength1()
{
    var errorMessage="";
    
    var txtFullName=document.getElementById("<%=txtFullName.ClientID%>");
    var txtLoginName=document.getElementById("<%=txtLoginName.ClientID%>");
    var txtPassword=document.getElementById("<%=txtPassword.ClientID%>");
    var txtConfirmPassword=document.getElementById("<%=txtConfirmPassword.ClientID%>");
    var txtVisitorSectionEmail=document.getElementById("<%=txtVisitorSectionEmail.ClientID%>");
    var txtMemberSectionEmail=document.getElementById("<%=txtMemberSectionEmail.ClientID%>");
    var txtSMTPServer=document.getElementById("<%=txtSMTPServer.ClientID%>");

    if(txtFullName.length > 50)
    {    
        errorMessage="You have exceeded the max limit of 50 for Full Name field.";
    }
    
    if(txtLoginName.length > 10)    
    {
        errorMessage+="You have exceeded the max limit of 10 for Login Name field.";
    }
    if(txtPassword.length > 10)    
    {
        errorMessage+="You have exceeded the max limit of 10 for Password field.";
    }
    if(txtConfirmPassword.length > 10)    
    {
        errorMessage+="You have exceeded the max limit of 10 for Confirm Password field.";    
    }    
    if(txtVisitorSectionEmail.length > 50)    
    {
        errorMessage+="You have exceeded the max limit of 50 for Visitor Section Email field."; 
    }

    if(txtMemberSectionEmail.length > 50)    
    {
        errorMessage+="You have exceeded the max limit of 50 for Memebr Section Email field.";                           
    }
    return errorMessage;
}


