﻿// JScript-Datei

function popupAnfrage(iArt,paid)
{
    window.open('Dialog/AnfrageDLG.aspx?iArt=' + iArt + '&paid=' + paid,'Anfrage','width=410,height=600,menubar=no')
}

function textCounter(field, maxlimit) //countfield, 
{
    if (field.value.length > maxlimit) // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
        // otherwise, update 'characters left' counter
    //else 
    //    countfield.value = maxlimit - field.value.length;
}

// TextArea
function doKeypress(control,maxLength){
    //maxLength = control.attributes["maxLength"].value;
    value = control.value;
     if(maxLength && value.length > maxLength-1){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
     }
}
// Cancel default behavior
function doBeforePaste(control,maxLength){
    //maxLength = control.attributes["maxLength"].value;
     if(maxLength)
     {
          event.returnValue = false;
     }
}
// Cancel default behavior and create a new paste routine
function doPaste(control,maxLength){
    //maxLength = control.attributes["maxLength"].value;
    value = control.value;
     if(maxLength){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
          var oTR = control.document.selection.createRange();
          var iInsertLength = maxLength - value.length + oTR.text.length;
          var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
          oTR.text = sData;
     }
}
