
<!--

//##### Limpa todos os links da barra de status
function strStatusLinks()
{
    var links = document.getElementsByTagName('a');
    for (var i=0; i<links.length; i++){
        var link = links[i];
        link.onmouseover=function()
        {
            window.status=''; 
            return true;
        }
        link.onfocus=function()
        {
            window.status=''; 
            return true;
        }
    }
}

function AndaScroll2(NScript){
    if (NScript==1) document.getElementById("MScrol1").scrollAmount=0;
    if (NScript==2) document.getElementById("MScrol1").scrollAmount=1;
}

function FechaPopUp(){
	document.getElementById('PopUp').style.visibility="hidden";
}

function PosicaoPopUp(){
    var PopUpHeight=document.getElementById("PopUp").clientHeight+2;
    var PopUpWidth=document.getElementById("PopUp").clientWidth+2;
    if (PopUpHeight==2){
		PopUpHeight=document.getElementById("PopUp").offsetHeight;
		PopUpWidth=document.getElementById("PopUp").offsetWidth;
	}
	var LocalX=document.body.scrollTop+(document.body.clientHeight-(PopUpHeight));
	var LocalY=document.body.scrollLeft+(document.body.clientWidth-(PopUpWidth));
	document.getElementById("PopUp").style.top=LocalX;
	document.getElementById("PopUp").style.left=LocalY;
}

function AbrePopUp(VID,TipoScript){
	var StatusDiv=document.getElementById("PopUp").style.visibility;
	
	// ### Força a exibição do div
	if (TipoScript==0){
		ExibeDiv(VID,1);
		PosicaoPopUp();
		document.getElementById("PopUp").style.visibility="visible";
	}
	else{
	
		// ### Caso o Script seja 1 e o PouUp ja esteje aberto.
		if (((TipoScript==1) || (TipoScript==4)) && (StatusDiv=="visible")){
	
		}
		else
		{
			var TopAtual=(document.body.scrollTop) + 100;
			ExibeDiv(VID,TipoScript);
			PosicaoPopUp();
			document.getElementById("PopUp").style.visibility="visible";
		}
	}
}

function AbrePopUp2(){
	if (document.getElementById('PopUp').style.visibility=="visible"){
		PosicaoPopUp();
	}
}

function OpenUp(pagina) {
	window.open(pagina,'001','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,menubar=no,width=415,height=200,top=0,left=0');
}

function AbreBatePapo(){
	document.getElementById('PopUp').style.height="236px";
	AbrePopUp2();
}
function FechaBatePapo(){
	document.getElementById('PopUp').style.height='60px';
	FechaPopUp();
}

function MinimizaBatePapo(){
    var StatusBatePapo=document.getElementById("JanBatePapo");
    if (StatusBatePapo.style.display=="none")
    {
        document.getElementById('PopUp').style.height="236px";
        document.getElementById('lblMinimizaBatePapo').innerHTML="--";
        StatusBatePapo.style.display="block";
        PosicaoPopUp();
    }
    else
    {
        StatusBatePapo.style.display="none";
        document.getElementById('PopUp').style.height='50px';
        document.getElementById('lblMinimizaBatePapo').innerHTML="#";
        PosicaoPopUp();
    }
}

function inpChat()
{
    var VRolagem;
    document.getElementById("vRol").value=VRolagem;
    document.getElementById("msg").value=document.getElementById("msg2").value;
    document.getElementById("msg2").value="";
}

function inpRolagem()
{
    document.getElementById("Enviar").click();
}

function MudaLabel(strMensagem){
	document.getElementById("txtMensagem").innerHTML=strMensagem;
}

function StrDir(D){
    if (D==1) {return ''}
    if (D==2) {return '../'}
}

//##### Maximiza e restaura o Nova Janela
function MaxMinNovaJanela()
{
    var AlturaTbl, LarguraTbl, AlturaTd, LarguraTd;
    var Altura=document.body.clientHeight-10;
	var Largura=document.body.clientWidth-5;

	var TabelaNovaJanela=document.getElementById("tblNovaJanela");
	var CelulaNovaJanela=document.getElementById("tbltdNovaJanela");
	var DivAtualizaNovaJanela=document.getElementById("AtualizaNovaJanela");
	var lblMaxMin=document.getElementById("lblMaxMinNovaJanela");
	
	if (TabelaNovaJanela.style.width==Largura+"px")
	{
	    AlturaTbl="450px";
	    LarguraTbl="640px";
	    AlturaTd="430px";
	    LarguraTd="630px";
	    lblMaxMin.innerHTML="#";
	}
	else
	{
	    AlturaTbl=Altura+"px";
	    LarguraTbl=Largura+"px";
	    AlturaTd=(parseInt(Altura)-20)+"px";
	    LarguraTd=(parseInt(Largura)-10)+"px";
	    lblMaxMin.innerHTML="_";
	}
	
	TabelaNovaJanela.style.height=AlturaTbl;
	TabelaNovaJanela.style.width=LarguraTbl;
	
	CelulaNovaJanela.style.height=AlturaTd;	
	CelulaNovaJanela.style.width=LarguraTd;
	
	DivAtualizaNovaJanela.style.height=AlturaTd;
	DivAtualizaNovaJanela.style.width=LarguraTd;
}

//##### Functions para execuções de ajax
function VerificaMsg()
	{
	var strExibe="&txtBusca=" + LID;
	VerificaDiv("divCliente",strExibe,StrDir(Diretorio) + "scrVerificaMsg.asp");
	
	LoopVerifica=setTimeout("VerificaMsg()",5000);
}

function VerificaFavoritos()
	{
	var strExibe="&txtBusca=" + LID + "&NDir=" + Diretorio;
	VerificaDiv("divFavoritos",strExibe,StrDir(Diretorio) + "scrVerificaFavoritos.asp");
}

function ExibeDiv(VID,TipoScript)
	{
	document.getElementById("txtMensagem").innerHTML="Aguarde, carregando.";
	
	var strExibe="&msgQual='" + VID + "'&NDir='" + Diretorio + "'&NScr='" + TipoScript + "'";
	VerificaDiv("NomeBatePapo",strExibe,StrDir(Diretorio) + "scrVerificaNome.asp");
}

function VerificaDiv(DivID,scrParametros,scrPagina)
	{
    // ### DivID - ID do Objeto
    // ### scrParametros Parâmetros do div
    // ### Endereço da página
    
	var oHTTPRequest = createXMLHTTP(); 
	oHTTPRequest.open("post", scrPagina, true);
	oHTTPRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	oHTTPRequest.onreadystatechange=function(){
		if (oHTTPRequest.readyState==4){
			document.getElementById(DivID).innerHTML = oHTTPRequest.responseText;
			}
		}
	oHTTPRequest.send("id=" + scrParametros);
}

// ##### Utilizado para o com sinal de mais e menos
function ExibeDivID(DivID,scrParametros,scrPagina){
    // ### DivID - ID do Objeto
    // ### scrParametros Parâmetros do div
    // ### Endereço da página
    
    var EstiloDiv=document.getElementById(DivID).style.display;
    if (EstiloDiv=='block'){
        document.getElementById(DivID).style.display='none';
        document.getElementById("ImgDiv" + scrParametros).src=StrDir(Diretorio) + 'imagens/sinalmais.gif';
    }
    else{
        document.getElementById(DivID).style.display='block';
        document.getElementById("ImgDiv" + scrParametros).src=StrDir(Diretorio) + 'imagens/sinalmenos.gif';
        document.getElementById(DivID).innerHTML="Carregando";
        VerificaDiv(DivID,scrParametros,scrPagina);
    }
}

// ##### utilizado para o div nova janela
function ExibeDivNovaJanela(DivID,NTipo,scrParametros,scrPagina)
{
    var ObjDiv=document.getElementById(DivID);
    if (NTipo==1)
    {
        ObjDiv.style.display="block";
        ObjDiv.style.top=document.body.scrollTop;
        
        ExiOcuSelect(0);
        
        VerificaDiv('AtualizaNovaJanela',scrParametros,scrPagina);
    }
    else
    {
        ObjDiv.style.display="none";
        document.getElementById("AtualizaNovaJanela").innerHTML="Carregando";
        
        ExiOcuSelect(1);
    }
}

//  ##### Função oculta ou exibe todos os selects da página
function ExiOcuSelect(Tipo)
{
    var objSel;
    objSel = document.getElementsByTagName('select');
    for (var i=0; i<objSel.length; i++){
        var link = objSel[i];
        if (Tipo==0) link.style.visibility="hidden";
        if (Tipo==1) link.style.visibility="visible";
    }
}


//-->
