//*****************************************************************************
//Objetivo:				Encapsular funcionalidades do PIP
//Autor:				Cristiane Habiro 7COMm
//Data:					28/07/2006
//Autor:					
//Data Ultima alteração:	
//Motivo:					
//*****************************************************************************

//*****************************************************************************
// DECLARAÇÃO DAS VARIÁVEIS
//*****************************************************************************
//var objIE; //objeto IE
//var objNS6; //objeto Nscape
objIE = document.all;
objNS6 = (document.getElementById && !document.all);

var intPosx; //posição x na tela
var intPosy; //posição y na tela
var strAtiva = 0; //id de timeout

//============================================================================================
// objetivo........: Função para movimentação do DIV junto ao cursor
// Premissas.......: 
// Entradas........: 
// Retorno.........: 
//============================================================================================
function moveMouse(objE){
	if(objIE){
		intPosx = event.clientX;
		intPosy = event.clientY;
	} else if (objNS6){
		intPosx = objE.clientX;
		intPosy = objE.clientY;
	}
}

//============================================================================================
// objetivo........: Função que atrela os textos à movimentação
// Premissas.......: 
// Entradas........: 
// Retorno.........: 
//============================================================================================
function ExibirAjuda(intNum){
	// Inserir um IF para cada mensagem de ajuda trocando o ID
	var strTexto; //variavel para texto da mensagem
	var intAngle; //posicionamento
	
	if (intNum == "t1"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t1"].style.visibility = 'visible';
			strTexto = document.all["t1"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t1").style.visibility = 'visible';
			strTexto = document.getElementById("t1").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+30;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t1")',10);
	}
	// Inserir um IF para cada mensagem de ajuda trocando o ID
	if (intNum == "t2"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t2"].style.visibility = 'visible';
			strTexto = document.all["t2"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t2").style.visibility = 'visible';
			strTexto = document.getElementById("t2").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t2")',10);
	}
if (intNum == "t3"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t3"].style.visibility = 'visible';
			strTexto = document.all["t3"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t3").style.visibility = 'visible';
			strTexto = document.getElementById("t3").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t3")',10);
	}
if (intNum == "t4"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t4"].style.visibility = 'visible';
			strTexto = document.all["t4"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t4").style.visibility = 'visible';
			strTexto = document.getElementById("t4").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t4")',10);
	}
if (intNum == "t5"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t5"].style.visibility = 'visible';
			strTexto = document.all["t5"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t5").style.visibility = 'visible';
			strTexto = document.getElementById("t5").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t5")',10);
	}
if (intNum == "t6"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t6"].style.visibility = 'visible';
			strTexto = document.all["t6"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t6").style.visibility = 'visible';
			strTexto = document.getElementById("t6").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t6")',10);
	}
if (intNum == "t7"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t7"].style.visibility = 'visible';
			strTexto = document.all["t7"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t7").style.visibility = 'visible';
			strTexto = document.getElementById("t7").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t7")',10);
	}
if (intNum == "t8"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t8"].style.visibility = 'visible';
			strTexto = document.all["t8"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t8").style.visibility = 'visible';
			strTexto = document.getElementById("t8").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t8")',10);
	}
if (intNum == "t9"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t9"].style.visibility = 'visible';
			strTexto = document.all["t9"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t9").style.visibility = 'visible';
			strTexto = document.getElementById("t9").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t9")',10);
	}
if (intNum == "t10"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t10"].style.visibility = 'visible';
			strTexto = document.all["t10"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t10").style.visibility = 'visible';
			strTexto = document.getElementById("t10").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t10")',10);
	}
if (intNum == "t11"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t11"].style.visibility = 'visible';
			strTexto = document.all["t11"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t11").style.visibility = 'visible';
			strTexto = document.getElementById("t11").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t11")',10);
	}
if (intNum == "t12"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t12"].style.visibility = 'visible';
			strTexto = document.all["t12"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t12").style.visibility = 'visible';
			strTexto = document.getElementById("t12").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t12")',10);
	}
if (intNum == "t13"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t13"].style.visibility = 'visible';
			strTexto = document.all["t13"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t13").style.visibility = 'visible';
			strTexto = document.getElementById("t13").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t13")',10);
	}
if (intNum == "t14"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t14"].style.visibility = 'visible';
			strTexto = document.all["t14"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t14").style.visibility = 'visible';
			strTexto = document.getElementById("t14").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t14")',10);
	}
if (intNum == "t15"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t15"].style.visibility = 'visible';
			strTexto = document.all["t15"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t15").style.visibility = 'visible';
			strTexto = document.getElementById("t15").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t15")',10);
	}
if (intNum == "t16"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t16"].style.visibility = 'visible';
			strTexto = document.all["t16"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t16").style.visibility = 'visible';
			strTexto = document.getElementById("t16").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t16")',10);
	}
if (intNum == "t17"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t17"].style.visibility = 'visible';
			strTexto = document.all["t17"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t17").style.visibility = 'visible';
			strTexto = document.getElementById("t17").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t17")',10);
	}
if (intNum == "t18"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t18"].style.visibility = 'visible';
			strTexto = document.all["t18"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t18").style.visibility = 'visible';
			strTexto = document.getElementById("t18").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t18")',10);
	}
if (intNum == "t19"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t19"].style.visibility = 'visible';
			strTexto = document.all["t19"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t19").style.visibility = 'visible';
			strTexto = document.getElementById("t19").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t19")',10);
	}
if (intNum == "t20"){
		if(objIE) {
			// Alterar os IDs das duas linhas
			document.all["t20"].style.visibility = 'visible';
			strTexto = document.all["t20"].style;
		}
		if(objNS6) {
			// Alterar os IDs das duas linhas
			document.getElementById("t20").style.visibility = 'visible';
			strTexto = document.getElementById("t20").style;
		}
		intAngle=0;
		intAngle+=5;
		if(typeof intPosx == "undefined") intPosx = 0;
		if(typeof intPosy == "undefined") intPosy = 0;
		strTexto.left = intPosx+10;
		strTexto.top = intPosy+10;
		document.frmPosicao.txtValorX.value = intPosx;
		document.frmPosicao.txtValorY.value = intPosy;
		// Alterar o ID 
		strAtiva = setTimeout('ExibirAjuda("t20")',10);
	}
	// Em todos os mouseout os DIVs são excondidos e o recarregamento da função é desligado
	else if (intNum == "end"){
		clearTimeout(strAtiva);
		apaga();
		
	}
}

//============================================================================================
// objetivo........: Função para esconder as DIVs
// Premissas.......: 
// Entradas........: 
// Retorno.........: 
//============================================================================================
function apaga(){

		if(objIE) {
			// Alterar/Acrescentar o ID em cada uma das linhas abaixo 
			document.all["t1"].style.visibility = 'hidden';
			document.all["t2"].style.visibility = 'hidden';
			document.all["t3"].style.visibility = 'hidden';
			document.all["t4"].style.visibility = 'hidden';
			document.all["t5"].style.visibility = 'hidden';
			document.all["t6"].style.visibility = 'hidden';
			document.all["t7"].style.visibility = 'hidden';
			document.all["t8"].style.visibility = 'hidden';
			document.all["t9"].style.visibility = 'hidden';
			document.all["t10"].style.visibility = 'hidden';
			document.all["t11"].style.visibility = 'hidden';
			document.all["t12"].style.visibility = 'hidden';
			document.all["t13"].style.visibility = 'hidden';
			document.all["t14"].style.visibility = 'hidden';
			document.all["t15"].style.visibility = 'hidden';
			document.all["t16"].style.visibility = 'hidden';
			document.all["t17"].style.visibility = 'hidden';
			document.all["t18"].style.visibility = 'hidden';
			document.all["t19"].style.visibility = 'hidden';
			document.all["t20"].style.visibility = 'hidden';
		}
		if(objNS6) {
			// Alterar/Acrescentar o ID em cada uma das linhas abaixo 
			document.getElementById("t1").style.visibility = 'hidden';
			document.getElementById("t2").style.visibility = 'hidden';
			document.getElementById("t3").style.visibility = 'hidden';
			document.getElementById("t4").style.visibility = 'hidden';
			document.getElementById("t5").style.visibility = 'hidden';
			document.getElementById("t6").style.visibility = 'hidden';
			document.getElementById("t7").style.visibility = 'hidden';
			document.getElementById("t8").style.visibility = 'hidden';
			document.getElementById("t9").style.visibility = 'hidden';
			document.getElementById("t10").style.visibility = 'hidden';
			document.getElementById("t11").style.visibility = 'hidden';
			document.getElementById("t12").style.visibility = 'hidden';
			document.getElementById("t13").style.visibility = 'hidden';
			document.getElementById("t14").style.visibility = 'hidden';
			document.getElementById("t15").style.visibility = 'hidden';
			document.getElementById("t16").style.visibility = 'hidden';
			document.getElementById("t17").style.visibility = 'hidden';
			document.getElementById("t18").style.visibility = 'hidden';
			document.getElementById("t19").style.visibility = 'hidden';
			document.getElementById("t20").style.visibility = 'hidden';
		}
}

// Ativação da função de movimentação do mouse
document.onmousemove = moveMouse;


//============================================================================================
// objetivo........: Abrir pop up da Cotação rápida
// Premissas.......: 
// Entradas........: 
// Retorno.........: 
//============================================================================================		
function Cotacao(){	
	window.open('http://www.bovespa.com.br/Cotacoes2000/CotacaoRapidaHome.Asp?PaginaReferente=PosicaoGeralPregao.Asp&txtCodigo=petr4','CotacaoRapida','width=310,height=310,directories=0,toolbar=0,status=0,location=0,resizable=1,scrollbars=0')
}

//============================================================================================
// objetivo........: Abrir pop up do PIP Escolhido
// Premissas.......: 
// Entradas........: 
// Retorno.........: 
//============================================================================================		
function PIP(){	
	window.open('FormConsultaAcaoObjPIP.asp','PIP','width=454,height=183,directories=0,toolbar=0,status=0,location=0,resizable=1,scrollbars=0')
}

//============================================================================================
// objetivo........: Fecha pop up e carrega o PIP Escolhido
// Premissas.......: 
// Entradas........: 
// Retorno.........: 
//============================================================================================		
function DefinirValor(txtValor, strIdObj) {
	opener.document.getElementById(strIdObj).value = txtValor;
	window.close();
}


