// seta largura do conteudo da direita
function setMaxHeight() {
	document.getElementById("conteudo2Niveis").style.maxWidth="565px";
}


//cores TR
	function Move(obj, cor){
		//obj.style.backgroundColor = '#1a743b';
		obj.style.backgroundColor = cor;
	}
	function Mout(obj, cor){
		obj.style.backgroundColor = cor;
	}
// -------------------------------------------------------------------

// writeObj : embed,object ±â¼ú
function CompilaFlash(arq,largura,altura) {
    document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+largura+"' height='"+ altura +"' id='flash' align='middle' VIEWASTEXT>"+
	 "<param name='allowScriptAccess' value='always' />"+
	 "<param name='movie' value='"+ arq +"' />"+
	 "<param name='quality' value='high' />"+
	 "<param name='wmode' value='transparent' />"+
	 "<param name='menu' value='false' />"+
	 "<embed src='"+ arq +"' quality='high' wmode='transparent' menu='false' width='"+largura+"' height='"+ altura +"' name='flash' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>");
}
// tempo relogio
function tempo_decorrido(){
	now = new Date();
	the_timer = new Date(now.getTime());
	hora = the_timer.getHours();
	minutos = the_timer.getMinutes();
	segundos = the_timer.getSeconds();
	if ( minutos <= 9 ) minutos = "0" + minutos;
	if ( segundos <= 9 ) segundos = "0" + segundos;
	display_timer = hora + ":" + minutos + ":" + segundos;
	document.all.tempo.value = display_timer;
	var temp = setTimeout("tempo_decorrido()", 1000);
}

//-------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function SemLetras(){
	if (window.event.keyCode != 13){//enter do teclado
		if ((window.event.keyCode < 48) | (window.event.keyCode > 57)){//teclas alfabeticas
			window.event.keyCode = 0
		}
	}
}

function Pula(f){
	if(f.value.length==f.maxLength){
	for(var i=0;i<f.form.length;i++){
		if(f.form[i]==f){f.form[i+1].focus();break}
		}
	}
}

function ValidaBusca(form) {
	if (form.palavra.value=='') {
		alert('Informe e palavra desejada para a busca!');
			form.palavra.style.background = "#FFFFCC";
			form.palavra.focus();
		return false;
	}
}

function ValidaLogin(form) {
	if ((form.usuario.value=='')||(form.senha.value=='')) {
		alert('Username and Password incorect!');
			form.usuario.style.background = "#FFFFCC";
			form.usuario.focus();
		return false;
	}
}

function selecionoucheck(checkitem){
    selecionou = false;
	if (isNaN(checkitem.length)){
		selecionou = checkitem.checked;
	} else {
		i = 0;
		while ( (i <= (checkitem.length -1)) && (!selecionou) ){
	selecionou = checkitem[i].checked;
    	i++;
		}
	}
    return selecionou;
}
function validaform(chk){
	try {
		if (!selecionoucheck(chk)){
	alert('Selecione um ítem antes de excluir!');
		return false;
	}
		else return true;
	}
	catch(e) {
		alert('Não há nada a ser excluído!');
		return false;
	}
}
//selcionar todos checbox
var marked_row = new Array;

function markAllRows( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            if ( checkbox.disabled == false ) {
                checkbox.checked = true;
                if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
                    rows[i].className += ' marked';
                    marked_row[unique_id] = true;
                }
            }
        }
    }

    return true;
}

function unMarkAllRows( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            checkbox.checked = false;
            rows[i].className = rows[i].className.replace(' marked', '');
            marked_row[unique_id] = false;
        }
    }

    return true;
}
//fim seleção

function hidelightbox(){
        document.getElementById('overlay').style.display = 'none';
        document.getElementById('lightbox').style.display = 'none';
        if('display' != 'display') this.loadInfo();
    }

//mascaras para campos
function Mascara(campo, sMask, evtKeyPress) {
var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

if(document.all) { // Internet Explorer
nTecla = evtKeyPress.keyCode;
} else if(document.layers) { // Nestcape
nTecla = evtKeyPress.which;
} else {
nTecla = evtKeyPress.which;
if (nTecla == 8) {
return true;
}
}

sValue = campo.value;
// Limpa todos os caracteres de formatação que
// já estiverem no campo.
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( "-", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( ".", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "/", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( "(", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( ")", "" );
sValue = sValue.toString().replace( " ", "" );
sValue = sValue.toString().replace( " ", "" );
fldLen = sValue.length;
mskLen = sMask.length;

i = 0;
nCount = 0;
sCod = "";
mskLen = fldLen;

while (i <= mskLen) {
bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ":") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

if (bolMask) {
sCod += sMask.charAt(i);
mskLen++;
} else {
sCod += sValue.charAt(nCount);
nCount++;
}
i++;
}

campo.value = sCod;
if (nTecla != 8) { // backspace
if (sMask.charAt(i-1) == "9") { // apenas números...
return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
else { // qualquer caracter...
return true;
}
} else {
return true;
}
}

//Fim da Função Máscaras Gerais


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.

{

   var arVersion = navigator.appVersion.split("MSIE")

   var version = parseFloat(arVersion[1])

   if ((version >= 5.5) && (document.body.filters)) 

   {

      for(var i=0; i<document.images.length; i++)

      {

         var img = document.images[i]

         var imgName = img.src.toUpperCase()

         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")

         {

            var imgID = (img.id) ? "id='" + img.id + "' " : ""

            var imgClass = (img.className) ? "class='" + img.className + "' " : ""

            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "

            var imgStyle = "display:inline-block;" + img.style.cssText 

            if (img.align == "left") imgStyle = "float:left;" + imgStyle

            if (img.align == "right") imgStyle = "float:right;" + imgStyle

            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle

            var strNewHTML = "<span " + imgID + imgClass + imgTitle

            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"

            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"

            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 

            img.outerHTML = strNewHTML

            i = i-1

         }

      }

   }    

}

window.attachEvent("onload", correctPNG);

<!--
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->


//-----------------------------------------------------
//Funcao: MascaraMoeda
//Parametro:
//   objTextBox : Objeto (TextBox)
//   SeparadorMilesimo : Caracter separador de milésimos
//   SeparadorDecimal : Caracter separador de decimais
//   e : Evento
//Retorno: Booleano
//Autor: Jucemar Vaccaro
//Data Criação: 15/02/2005
//-----------------------------------------------------
function Limpar(valor, validos) {
	// retira caracteres invalidos da string
	var result = "";
	var aux;
	for (var i=0; i < valor.length; i++) {
	aux = validos.indexOf(valor.substring(i, i+1));
	if (aux>=0) {
	result += aux;
	}
	}
	return result;
}

//Formata número tipo moeda usando o evento onKeyDown

function FormataMoeda(campo,tammax,teclapres,decimal) {
	var tecla = teclapres.keyCode;
	vr = Limpar(campo.value,"0123456789");
	tam = vr.length;
	dec=decimal
	
	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
	
	if (tecla == 8 )
	{ tam = tam - 1 ; }
	
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
	{
	
	if ( tam <= dec )
	{ campo.value = vr ; }
	
	if ( (tam > dec) && (tam <= 5) ){
	campo.value = vr.substr( 0, tam - 2 ) + "," + vr.substr( tam - dec, tam ) ; }
	if ( (tam >= 6) && (tam <= 8) ){
	campo.value = vr.substr( 0, tam - 5 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; 
	}
	if ( (tam >= 9) && (tam <= 11) ){
	campo.value = vr.substr( 0, tam - 8 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; }
	if ( (tam >= 12) && (tam <= 14) ){
	campo.value = vr.substr( 0, tam - 11 ) + "." + vr.substr( tam - 11, 3 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - dec, tam ) ; }
	if ( (tam >= 15) && (tam <= 17) ){
	campo.value = vr.substr( 0, tam - 14 ) + "." + vr.substr( tam - 14, 3 ) + "." + vr.substr( tam - 11, 3 ) + "." + vr.substr( tam - 8, 3 ) + "." + vr.substr( tam - 5, 3 ) + "," + vr.substr( tam - 2, tam ) ;}
	} 
	
}
//fim moeda=------------------------------------------------------------------------


