//**********************************************************************
//*  FUNÇÃO PARA CABECALHO DO BOX DE MENSAGEM
//**********************************************************************
//*  Definições/Especificações:
//*  
//* Esta funcao recebe tres parametros:
//* 1) Largura
//* 2) Altura
//* 3) Overflow
//*
//**********************************************************************
function BoxAvisoTopo(p1,p2,p3)
{
	var largura = p1;
	var altura = p2;
	var overflow = p3;
	document.write('		<table width='+largura+' border=0 cellspacing=3 cellpadding=3>');
	document.write('			<tr>');
	document.write('			<td>');
	document.write('				<table border=0  width='+largura+' cellpadding=1 cellspacing=1 bgcolor=919B9C>');
	document.write('					<td bgcolor=FFFFFF>');
	document.write('						<table width=100% border=0 cellspacing=0 cellpadding=3>');
	document.write('							<td>');
	document.write('								<table width=100% border=0 cellspacing=3 cellpadding=0 ');
	document.write('									<tr>');
	document.write('										<td width=6>&nbsp;</td>');
	document.write('										<td>&nbsp;</td>');
	document.write('										<td align=right>&nbsp;</td>');
	document.write('									</tr>');
	document.write('									<tr>');
	document.write('										<td valign=top colspan=3>');
	document.write('											<DIV class="TextoBoxAviso" style="{height:'+altura+'px;width:100%;overflow:'+overflow+';}">');

}

//**********************************************************************
//*  FUNÇÃO PARA RODAPE DO BOX DE MENSAGEM
//**********************************************************************
//*  Definições/Especificações:
//*  
//*
//**********************************************************************

function BoxAvisoRodape()
{
	document.write('											</DIV>');
	document.write('										</td>');
	document.write('									</tr>');
	document.write('								</table>');
	document.write('							</td>');
	document.write('						</table>');
	document.write('					</td>');
	document.write('			  </table>');
	document.write('			</td>');
	document.write('			</tr>');
	document.write('		</table>');
}

//**********************************************************************
//*  FUNÇÃO PARA CABECALHO AVANCADO DO BOX DE MENSAGEM
//**********************************************************************
//*  Definições/Especificações:
//*  
//* Esta funcao recebe dez parametros:
//* 1) Largura
//* 2) Altura
//* 3) Overflow
//* 4) Titulo
//* 5) Titulo Link 1
//* 6) URL Link 1
//* 7) Titulo Link 2
//* 8) URL Link 2
//* 9) Titulo Link 3
//* 10) URL Link 3
//*
//**********************************************************************

function BoxAvancadoAvisoTopo(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10)
{
	var largura = p1;
	var altura = p2;
	var overflow = p3;
	var titulo = p4;
	var URLL1 = p5;
	var TITL1 = p6;
	var URLL2 = p7;
	var TITL2 = p8;
	var URLL3 = p9;
	var TITL3 = p10;
	
	document.write('<table width='+largura+' cellpadding=3 cellspacing=3 border=0>');
	document.write('<tr>');
	document.write('<td>');
	document.write('<table width=100% cellpadding=0 cellspacing=0 border=0>');
	document.write('<tr>');
	document.write('<td>');
	document.write('<table width=100% cellpadding=0 cellspacing=0 border=0>');
	document.write('<td width=21 valign=top>');
	document.write('<img src='+pathgeral+'images/box_med_tit_esq.gif><br>');
	document.write('</td>');
	document.write('<td valign=top>');
	document.write('<table width=100% cellpadding=0 cellspacing=0 border=0>');
	document.write('<tr>');
	document.write('<td height=28 background='+pathgeral+'images/box_med_tit_bkg.gif class=titulobox>');
	document.write(titulo);
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');		

	if (TITL1!="" || TITL2!="" || TITL3!="")
	{
	document.write('<table cellpadding=0 cellspacing=0 border=0 align=right  background='+pathgeral+'images/box_med_link_bkg.gif>');
	document.write('<tr>');
	document.write('<td>');
	document.write('<img src='+pathgeral+'images/box_med_link_esq.gif><br>');
	document.write('</td>');

	if (TITL1!="")
	{
	document.write('<td align=center height=20 class=link_box_geral valign=middle>');
	document.write('<a href='+URLL1+'>'+TITL1+'</a>');
	document.write('</td>');
	}

	if (TITL2!="")
	{
	document.write('<td width=1>');
	document.write('<img src='+pathgeral+'images/box_med_link_sep.gif><br>');
	document.write('</td>');
	document.write('<td align=center height=20 class=link_box_geral valign=middle>');
	document.write('<a href='+URLL2+'>'+TITL2+'</a>');
	document.write('</td>');
	}

	if (TITL3!="")
	{
	document.write('<td width=1>');
	document.write('<img src='+pathgeral+'images/box_med_link_sep.gif><br>');
	document.write('</td>');
	document.write('<td align=center height=20 class=link_box_geral valign=middle>');
	document.write('<a href='+URLL3+'>'+TITL3+'</a>');
	document.write('</td>');
	}
	
	document.write('</tr>');
	document.write('</table>');
	document.write('</td>');
	document.write('<td width=21 valign=top>');
	document.write('<img src='+pathgeral+'images/box_med_tit_dir.gif><br>');
	document.write('</td>');
	}
	else
	{
	document.write('<td width=21 valign=top>');
	document.write('<img src='+pathgeral+'images/box_med_tit_dir_off.gif><br>');
	document.write('</td>');
	}

	document.write('</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td style="(border-left:1px solid #91A7B4;border-right:1px solid #91A7B4;padding-left:10px;)" colspan=3 height='+altura+' valign=top class=texto>');

} 

//**********************************************************************
//*  FUNÇÃO PARA RODAPE DO BOX DE MENSAGEM
//**********************************************************************
//*  Definições/Especificações:
//*  
//*
//**********************************************************************

function BoxAvancadoAvisoRodape(p1)
{
	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td>');
	document.write('<table width=100% cellpadding=0 cellspacing=0 border=0>');
	document.write('<td width=20>');
	document.write('<img src='+pathgeral+'images/box_med_rodape_esq.gif><br>');
	document.write('</td>');
	document.write('<td style="(border-bottom:1px solid #91A7B4;)">&nbsp; ');
	document.write('</td>');
	document.write('<td width=20>');
	document.write('<img src='+pathgeral+'images/box_med_rodape_dir.gif><br>');
	document.write('</td>');
	document.write('</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</td>');
	document.write('</table>');
}


//**********************************************************************
//*  FUNÇÃO PARA RODAPE 
//**********************************************************************
//*  Definições/Especificações:
//*  
//* Esta funcao recebe dois parametros:
//* 1) Texto 1
//* 2) Nome
//*  
//*
//**********************************************************************

function Rodape(p1,p2)
{	
	var texto = p1;
	var nome = p2;
	
	document.write('<table width=100%  border=0 cellspacing=0 cellpadding=0>');
	document.write('	<tr>');
	document.write('	<td>');
	document.write('		<table width=100%  border=0 cellspacing=0 cellpadding=0  background='+pathgeral+'images/rodape_n1_bkg.gif>');
	document.write('			<td width=15>');
	document.write('			</td>');	
	document.write('			<td height=22 width=270 class=titulobox>');
	document.write('			'+texto+'');
	document.write('			</td>');
	document.write('			<td>&nbsp;');
	document.write('			</td>');
	document.write('			<td width=35>');
	document.write('			<img src='+pathgeral+'images/rodape_n1_icone.gif>');
	document.write('			</td>');
	document.write('			<td width=25% class=titulobox>');
	document.write('			'+nome+'');
	document.write('			</td>		');					
	document.write('		</table>');
	document.write('    </td>');
	document.write('	</tr>');
	document.write('	<tr>');
	document.write('		<td align=center>');
	document.write('		<table width=100%  border=0 cellspacing=0 cellpadding=0  background='+pathgeral+'images/rodape_n1_bkg.gif>');
	document.write('			<td height=30 bgcolor=D4D4D4>');
	document.write('			<img src='+pathgeral+'images/rodape_n2_intranet.gif hspace=10>');
	document.write('			</td>');		
	document.write('		</table>');
	document.write('    </td>');
	document.write('	</tr>');
	document.write('</table>');
}

//**********************************************************************
//*  FUNÇÃO PARA LINHA SUPERIOR 
//**********************************************************************
//*  Definições/Especificações:
//*  
//* Esta funcao recebe dois parametros:
//* 1) Texto 1
//* 2) Nome
//*  
//*
//**********************************************************************

function LinhaSuperior(p1,p2)
{	
	var texto = p1;
	var nome = p2;
	
	document.write('<table width=100%  border=0 cellspacing=0 cellpadding=0>');
	document.write('	<tr>');
	document.write('		<td>');
	document.write('			<table width=100%  border=0 cellspacing=0 cellpadding=0  background='+pathgeral+'images/rodape_n1_bkg.gif>');
	document.write('				<td width=15>');
	document.write('				</td>');	
	document.write('				<td height=22 width=270 class=titulobox>');
	document.write('					'+texto+'');
	document.write('				</td>');
	document.write('				<td>&nbsp;');
	document.write('				</td>');
	document.write('				<td width=35>');
	document.write('					&nbsp;');
	document.write('				</td>');
	document.write('				<td width=25% class=titulobox>');
	document.write('					'+nome+'');
	document.write('				</td>		');					
	document.write('			</table>');
	document.write('   		</td>');
	document.write('	</tr>');
	document.write('</table>');
}



//**********************************************************************
//*  FUNÇÃO PARA BOTÕES COM ESTILO DO WINDOWS XP
//**********************************************************************
//*  Definições/Especificações:
//*
//**********************************************************************

function button_over(eButton)
	{
	eButton.style.borderBottom = "1px solid #08246B";
	eButton.style.borderLeft = "1px solid #08246B";
	eButton.style.borderRight = "1px solid #08246B";
	eButton.style.borderTop = "1px solid #08246B";
	eButton.style.background = "#B5BED6";
	}

function button_out(eButton)
	{
	eButton.style.borderColor = "";
	eButton.style.background = "";
	}

function button_down(eButton)	
	{
	eButton.style.borderBottom = "buttonhighlight solid 1px";
	eButton.style.borderLeft = "buttonshadow solid 1px";
	eButton.style.borderRight = "buttonhighlight solid 1px";
	eButton.style.borderTop = "buttonshadow solid 1px";
	}

function button_up(eButton)
	{
	eButton.style.borderBottom = "buttonshadow solid 1px";
	eButton.style.borderLeft = "buttonhighlight solid 1px";
	eButton.style.borderRight = "buttonshadow solid 1px";
	eButton.style.borderTop = "buttonhighlight solid 1px";
	eButton = null; 
	}

	

//**********************************************************************
//*  FUNÇÃO PARA EXECUTAR UM COMANDO APÓS ESCOLHA DE LINHA DO GRID
//**********************************************************************
//*  
//**********************************************************************
function ExecutaLinkGrid(StrURL)
{ 

	if (variavel == "") 
	{
		alert ("Por favor, selecione uma das linhas acima antes!");
		return false; 

	}
	else 
	{
		
		window.location.href(StrURL);
	}
} 


function decide(url)  {

if (confirm("Voce tem certeza que deseja excluir este item?"))  {

location.href=url }

{ } 

} 

function decide1(url)  {

if (confirm("Voce tem certeza que deseja inabilitar esse usuario?"))  {

location.href=url }

{ } 

} 

function decide2(url)  {

if (confirm("Voce tem certeza que deseja habilitar esse usuario?"))  {

location.href=url }

{ } 

} 

function decide4(url)  {

if (confirm("Voce tem certeza que deseja zerar a senha?"))  {

location.href=url }

{ } 

} 

function decide5(url)  {

if (confirm("Voce tem certeza que deseja excluir este item e TODOS os relacionados?"))  {

location.href=url }

{ } 

} 

//**********************************************************************
//*  FUNÇÃO PARA FORMATAR MASCARA DE ENTRADA NA DIGITACAO DO TEXT FORM
//**********************************************************************
//*  Definições/Especificações:
//*  
//*  Funcionamento:
//*    O terceiro parâmetro marca as posições que serão delimitadas. No exemplo
//*    abaixo ele coloca o delimitador depois da digitação do segundo e do quinto
//*    caractere. Podem ser adiconados quantos divisores forem necessários.
//*
//*	   IMPORTANTE! O "onKeyUp" e "onBlur" devem ser, exatamente, idênticos!
//*  
//*  Exemplo de formatação de data:
//*  <input name="Field2" value="" type="text" 
//*  onKeyUp="javascript:return mask(this.value,this,'2,5','/');" 
//*	 onBlur="javascript:return mask(this.value,this,'2,5','/');" 
//*	 maxlength="10">
//*  
//**********************************************************************
function FormMask(str,textbox,loc,delim){
var locs = loc.split(',');

for (var i = 0; i <= locs.length; i++){
	for (var k = 0; k <= str.length; k++){
	 if (k == locs[i]){
	  if (str.substring(k, k+1) != delim){
	    str = str.substring(0,k) + delim + str.substring(k,str.length)
	  }
	 }
	}
 }
textbox.value = str
}











function setRowWidth(r){

	var c;
	for (var i=0; i < r.length; i++){
		c = r[i];
		c.width = c.clientWidth - parseInt(c.currentStyle.paddingLeft) - parseInt(c.currentStyle.paddingRight);
	}
}
function makeScrollableTable(tbl,strHeight){

	var pNode, w, hdr,i;

	pNode = tbl.parentNode;
	w = document.createElement('<SPAN style="height:' + strHeight + 'px; overflow: auto;">');
	pNode.insertBefore(w, tbl);
	w.appendChild(tbl);

	for (var i=0; i < tbl.tHead.rows.length; i++) setRowWidth(tbl.tHead.rows[i].cells);	
	
	setRowWidth(tbl.tBodies(0).rows[0].cells);

	hdr = tbl.cloneNode(false);
	hdr.id += 'Header';
	hdr.appendChild(tbl.tHead.cloneNode(true));
	tbl.tHead.style.display = 'none';
	pNode.insertBefore(hdr, w);
	w.style.width = w.clientWidth + 50;

	w2 = document.createElement('<table border=0 cellspacing=0 cellpadding=0 id="' + tbl.id + '">');
	w2.id = tbl.id + 'Wrapper';
	pNode.insertBefore(w2, hdr);

	w2.insertRow().insertCell().appendChild(hdr);
	w2.insertRow().insertCell().appendChild(w);

	w2.align = tbl.align;
	tbl.align = hdr.align = 'left';
	hdr.style.borderBottom = tbl.style.borderTop = 'medium none';
}
function init(strHeight){

	if (document.all){

		makeScrollableTable(document.getElementById('tabela'),strHeight);

	}else{
		document.getElementById("tb").style.overflow = "auto";
		document.getElementById("tb").style.height = "' + strHeight + 'px";
	}
} 



