var sessao ='home';
var menu;
function menuprim(menu){
	menuprimlimpa();
	document.getElementById(menu).style.display='block';
}
			
			
function menuprimlimpa(){
	document.getElementById("subrelatorios").style.display = 'none';
	document.getElementById("subservico").style.display = 'none';
	document.getElementById("subsuporte").style.display = 'none';
	/*document.getElementById("subhome_broker").style.display = 'none';
	document.getElementById("subwebtrading").style.display = 'none';*/
	document.getElementById("subTransNegociacao").style.display = 'none';	
	/*document.getElementById("subTransNegociacaoWT").style.display = 'none';*/
	document.getElementById("subTransServicos").style.display = 'none';
	document.getElementById("subTransConteudo").style.display = 'none';
	document.getElementById("subTransInformacoes").style.display = 'none';
}

function menuindice(menu){
	if (menu==""){
		menu="conteudo_mercado";
	}
	document.getElementById("conteudo_mercado").style.display = 'none';
	document.getElementById("conteudo_dolar").style.display = 'none';
	document.getElementById("conteudo_altas").style.display = 'none';
	document.getElementById(menu).style.display='block';
	document.getElementById('menu_abas_indices').style.backgroundPosition="0px 0px";
	switch (menu){
	case 'conteudo_mercado':
		document.getElementById('menu_abas_indices').style.backgroundPosition="0px 0px";
		break;
	case 'conteudo_dolar':
		document.getElementById('menu_abas_indices').style.backgroundPosition="0px 52px";
		break;
	case 'conteudo_altas':
		document.getElementById('menu_abas_indices').style.backgroundPosition="0px 26px";
		break;
	}
}


function menulateral(menu) {
	if (menu==""){
		menu="avisos";
	}
	document.getElementById("avisos").style.display = 'none';
	document.getElementById("noticias").style.display = 'none';
	document.getElementById(menu).style.display='block';
	switch (menu){
	case 'avisos':
		document.getElementById('abaesquerda').style.backgroundPosition="0px 26px";
		break;
	case 'noticias':
		document.getElementById('abaesquerda').style.backgroundPosition="0px 0px";
		break;
	}
}
	
	
function menusessao(psessao){
	if ((psessao == "")||(psessao == null))psessao = sessao;
	menuprimlimpa();
	switch (psessao){
			case 'abrasuaconta':
			document.getElementById("bgabra").style.display = 'block';
			break;
			case 'institucional' :
			document.getElementById("bginstitucional").style.display = 'block';
			break;
			
			case 'acompanheomercado' :
			document.getElementById("bgacompanhe").style.display = 'block';
			break;
			
			case 'relatorios' :
			document.getElementById("bgrelatorios").style.display = 'block';
			document.getElementById("subrelatorios").style.display = 'block';
			break;
			
			case 'servico' :
			document.getElementById("bgservico").style.display = 'block';
			document.getElementById("subservico").style.display = 'block';
			break;
			
			/*case 'homebroker' :
			document.getElementById("bghomebroker").style.display = 'block';
			break;
			
			case 'webtrading' :
			document.getElementById("bgwebtrading").style.display = 'block';
			break;
			*/
			case 'suporte' :
			document.getElementById("bgsuporte").style.display = 'block';
			document.getElementById("subsuporte").style.display = 'block';			
			break; 
			
			case 'seguranca' :
			document.getElementById("bgseguranca").style.display = 'block';
			break;
			
			case 'faleconosco' :
			document.getElementById("bgfaleconosco").style.display = 'block';
			break;
			
	}
}


function CarregaImagem() { 

 var d=document; if(d.images){ if(!d.MM_p) d.Carregador=new Array();

   var i,j=d.Carregador.length,a=CarregaImagem.arguments; for(i=0; i<a.length; i++)

   if (a[i].indexOf("#")!=0){ d.Carregador[j]=new Image; d.Carregador[j++].src=a[i];}}

}

function Valida_Usuario(){

			usuario = document.getElementById("login").value;
			senha = document.getElementById("senha").value;
			
			if (usuario == "")
			{
					alert("Preencha o seu nome de usuário!");
					document.getElementById("login").focus();
					return false;
			}
			
			if (senha == "")
			{
					alert("Preencha sua senha!");
					document.getElementById("senha").focus();
					return false;
			}
			//window.open('/transacional/cc.shtml?login=' + usuario + '&senha=' + senha, '_blank', 'toolbar=0, width=667, height=550, scrollbars=0');
			//window.open('https://homebroker.schahinccvm.com.br/invest/LoginInvestidor/', '_blank', 'toolbar=0, width=667, height=550, scrollbars=0');
			
			return true;
}

function AbrirCotacao() {
CodAcao=document.getElementById("ccotacoes").value;
 if( CodAcao != "" ) {
		//var documento = "http://www.schahinccvm.com.br/invest/ConsultarCotacao?CodPapel=";
		var documento = "http://homebroker.schahinccvm.com.br/invest/ConsultarCotacao?CodPapel=";
		documento = documento + CodAcao;
		AbrirPopUp(documento,"Cotações","width=230,height=500,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no");
		 }
		else{
		alert("Digite a cotação desejada");
		document.getElementById("ccotacoes").focus();
}

}

function AbrirPopUp(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function destacamenu(arquivo){
document.getElementById(arquivo).style.fontWeight='bold';
}

function BannerSchahin(){
	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="440" height="66" id="menu_novo" align="middle" VIEWASTEXT style="border:1px solid black">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="/images/banner_schahin.swf" />\n'); 
	document.write('<param name="quality" value="high" />\n'); 
	document.write('<param name="bgcolor" value="#ffffff" />\n'); 
	document.write('<embed src="/images/banner_schahin.swf" quality="high" bgcolor="#ffffff" width="440" height="66" name="menu_novo" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n'); 
	document.write('</object>\n');
}

function BannerOin(){
	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="306" height="60" id="menu_novo" align="middle" VIEWASTEXT>\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="/images/banner_novo2.swf" />\n'); 
	document.write('<param name="quality" value="high" />\n'); 
	document.write('<param name="bgcolor" value="#ffffff" />\n'); 
	document.write('<embed src="/images/banner_novo2.swf" quality="high" bgcolor="#ffffff" width="306" height="60" name="menu_novo" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n'); 
	document.write('</object>\n');
}