﻿// File JScript
function ValidateLenght(sender, args) {
    if (args.Value.length > 10 || args.Value.length < 9) {

        args.IsValid = false;

    }
    else
        args.IsValid = true;
}
//Funzione per verificare che sia un numero
function ValidateNumeric(sender, args) {
    if (isNaN(args.Value)) {
        args.IsValid = false;

    }
    else
        args.IsValid = true;
}

function ResetDefaultFired() {
    __defaultFired = false;
}

function MM_openBrWindow(theURL, winName, features) { //v2.0
    window.open(theURL, winName, features);
}
function CheckLength(){
    with (document.forms[0]) {
        var maxchars = 123;
        chars = ctl00$smsinterface$txtMessaggio.value;
        if (chars.length > maxchars){
            ctl00$smsinterface$txtMessaggio.value = chars.substr(0, maxchars);
            ctl00$smsinterface$txtMessaggio.blur();
        }
//        ctl00$ContentPlaceHolder1$smsinterface$lblCarDisp.value = maxchars - ctl00$ContentPlaceHolder1$smsinterface$txtMessaggio.value.length;
   }
}

function disableEnterKey(sender, args) {
    var key;


    if (window.event) key = window.event.keyCode;     //IE



    if (key == 13)

        args.IsValid = false;
    else
        return true;
}

function enablevalidation(checkid, controlid) {
    if ($get(checkid).checked) $get(controlid).style.display = "none";
    else $get(controlid).style.display = "inline";
}

function noEnterKey(e) {
    if (e.which || e.keyCode) {
        if ((e.which == 13) || (e.keyCode == 13))
        { document.getElementById('key').style.display = 'inline'; return false; }
        else { document.getElementById('key').style.display = 'none'; return true; } 
    }
}