﻿
var MaxLength = 0;

function ValidateCalContLen(source, args)
{
    MaxLength = 600;
    if (args.Value.length <= MaxLength)
    {
        args.IsValid = true;
    }
    else {
        alert("You have exceeded the maximum field length of " + MaxLength + ".\n\nYou have entered " + args.Value.length + " characters.");
        args.IsValid = false;
    }
}

function forceMaxLenth(Object){
    if(Object.Value.length > MaxLength){
        Object.Value = Object.Value.substring(0, MaxLength);
    }
}


//Enforces max length on textarea objects
function imposeMaxLength(args)
{
    if(value > MaxLength){
        //alert("You have exceeded the maximum field length of " + MaxLength + ".\n \n You have entered " + Object.value.length + " characters");
        forceMaxLenth(source, MaxLength);
        return false;
    }
    return true;
}

function OpenPreview(url){
    var win = window.open(url, "Preview", "resizable=yes,height=300,width=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes");
    win.focus();
}

