﻿var DefaultId = "1"; //skin

// Function library for the system
var Netscape4 = navigator.appName!="Netscape";
var PText = new Array("", "");
var pChangeField = "";
var basePath = "";
var PathHelp = "";
var bExcel = false;

function setChangeField(value){
    pChangeField = value;
}
function getChangeField(){
    return pChangeField;
}

function ShowHelp() {
    parent.open (PathHelp);
}

function SetHelp(value) {
    PathHelp = value;
}


function OpenPopup(url, altura, comprimento) {    
             
    var features = 'width=' + comprimento + ',height=' + altura;
    window.open(url, '', 'scrollbars=yes, resizable=yes' + features);

    return false;
}

function OpenPopupParametro(url, controle, altura, comprimento) {

    url += controle.value;
    OpenPopup(url, altura, comprimento);

    return false;
}

function GetRowValue(Controle, valControle, hiddenField, valHidden) {
    GetRowValue(Controle, valControle, hiddenField, valHidden, "false");
}

function GetRowValue(Controle, valControle, hiddenField, valHidden, postback) {
    window.opener.document.getElementById(Controle).value = valControle;
    window.opener.document.getElementById(hiddenField).value = valHidden;
    if (postback == "true")
        window.opener.parent.document.forms(0).submit();
    window.close();            
}

function FecharJanelaPopup() {
    window.close(); 
}

function isMaxLength(txtBox, max) {
    if (txtBox) {
        return (txtBox.value.length <= max - 1);
    }
}

function ApenasNumeros() {
    var key = window.event.keyCode;

    if (key < 48 || key > 57)
        window.event.returnValue = false;
}

function limpa_textfield(campo) {
    var element = document.getElementById(campo);
    element.value = "";
}

function getElement(id) { 
return document.getElementById ? document.getElementById(id) : 
document.all ? document.all(id) : null; 
}
/*----------------------------------------------------------------------------
Formatação para qualquer mascara
-----------------------------------------------------------------------------*/
function formatar(src, mask) {
    var i = src.value.length;
    var saida = mask.substring(0, 1);
    var texto = mask.substring(i)
    if (texto.substring(0, 1) != saida) {
        src.value += texto.substring(0, 1);
    }
}