﻿function Cover(bottom, top, ignoreSize) 
{
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = '50px';
    top.style.left = '20px';
    top.style.width = '400px';
    top.style.height = '120px';
}
function openModal(pUrl) 
{
	if (window.showModalDialog) {
		return window.showModalDialog(pUrl, "Impressão de Documentos",
		  "toolbar=yes,scrollbars=yes,fullscreen=yes,location=no,status=no,resizable=yes");
	} else {
		try {
			netscape.security.PrivilegeManager.enablePrivilege(
			  "UniversalBrowserWrite");
			window.open(pUrl, "Impressão de Documentos", "toolbar=yes,scrollbars=yes,fullscreen=yes,location=no,status=no,resizable=yes,modal=yes");
			return true;
		}
		catch (e) {
			alert("Script não confiável, não é possível abrir janela modal.");
			return false;
		}
	}
}
function doKeypress(control){
    maxLength = control.attributes["maxLength"].value;
    value = control.value;
     if(maxLength && value.length > maxLength-1){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
     }
}
function doBeforePaste(control){
    maxLength = control.attributes["maxLength"].value;
     if(maxLength)
     {
          event.returnValue = false;
     }
}
function doPaste(control){
    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;
     }
}

