



// VARIAVES DO COMPARILHE

var addthis_pub="pedrotv1";
var addthis_header_color = "#ffffff";
var addthis_header_background = "#309CDC";
var addthis_options="email, facebook, twitter, orkut, delicious, stumbleupon, digg, buzzup, blogger, tumblr, wordpress, myspace, friendfeed, netvibes, reddit, technorati, google, googlebuzz, buzz, live, aim, gmail, yahoomail, hotmail, aolmail, linkedin, domelhor, linkninja";
var addthis_localize = {
        		share_caption: "Compartilhe / Envie",
		        email_caption: "Enviar para amigo",
				email: "Email",        
				favorites: "Favoritos",         
				more: "mais..." 
				};

// LISTAGEM POR ESTADO
function mudaEstado(p_URL)
{
	var oLoading = document.getElementById('appLoading');
	oLoading.style.display = "block";
    if (p_URL == "")
    {
		oLoading.style.display = "none";
        return;
    }    
    
    var objIFrame = document.getElementById('iFrame_0');
    objIFrame.src = p_URL;
    objIFrame.style.display = 'block';
}

//REDIMENSIONA IFRAME DE DENTRO
function resizeIFrameInside()
{
    var oIframe = parent.document.getElementById('iFrame_0');
	var oDoc = null;

	try
	{	    
	    var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
		if (oDoc.document) oDoc = oDoc.document;

		oIframe.style.height = oDoc.body.scrollHeight + 20;
		oIframe.height = oDoc.body.scrollHeight + 20;
	}
	catch(err)
	{
	}
}

// FECHA O ÍTEM
function fechaItens()
{
    var obj = document.getElementsByTagName('div');
    for(var x = 0; x < obj.length; x++)
    {
        if (obj[x].id = ("resp_beneficios" + x))
        {
            obj[x].style.display == "none";
        }
    }
}

// CARREGA A DESCRIÇÃO DO ÍTEM DO ESTADO
function carregaItem(p_Indice, p_URL)
{
    //fechaItens();
    new Ajax.Updater('resp_beneficios' + p_Indice, p_URL, { method: 'get' });
    //document.getElementById('resp_beneficios' + p_Indice).style.display = "block";
    return;
}


// ********** FUNÇÕES PARA TRATAMENTO DE IFRAME ********** //

//Adiciona um evento ao iFrame
function addIFrameEvent(controle,evento,funcao)
{
    if (controle.addEventListener)
    {
        controle.addEventListener(evento, funcao, true);
    }
    else if (controle.attachEvent)
    {
        controle.attachEvent("on" + evento, funcao);
    }
    else
    {
        controle["on" + evento] = funcao;
    }
}

//Seta o Id para os iFrames da página com o prefixo iFrame_[x]
function setIFramesId()
{
    var iframes = document.getElementsByTagName('iframe');
    for(var x=0; x<iframes.length; x++)
    {
		if(iframes[x].id != "frmMapasRotas")
			iframes[x].id = 'iFrame_' + x;
    }
}

//Carrega o iFrame
function iFrameLoad()
{
    setIFramesId();
    var objIFrame = document.getElementById('iFrame_0');
    
    if (typeof(objIFrame) == 'object' && objIFrame != null)
    {
        objIFrame.style.visibility = 'hidden';
        addIFrameEvent(objIFrame, 'load', function() {resizeIFrameRef(objIFrame)});
    }
}

//Redimensiona o iFrame com o tamanho dop seu conteúdo
var resizeIFrameRef = function resizeIFrame(controle)
{
    var oLoading = document.getElementById('appLoading');
	var oIframe = controle;
	var oDoc = null;

	try
	{	    
	    var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
		if (oDoc.document) oDoc = oDoc.document;

		oIframe.style.height = oDoc.body.scrollHeight + 20;
		oIframe.height = oDoc.body.scrollHeight + 20;
	}
	catch(err)
	{
	}
	
	if (typeof(oLoading) == 'object' && oLoading != null)
	{
        oLoading.style.display = "none";
    }
	oIframe.style.visibility = "visible";
	return true;
}

//Seta transparência para todos os iFrames da página
function iFrameTransparency()
{
    var iframes = document.getElementsByTagName('iframe');
    for(var x=0; x<iframes.length; x++)
    {
        iframes[x].allowTransparency = true;
    }
}


// ********** FUNÇÕES ExpandCollapse ********** //
function collapse (intId)
{
	var objResposta = document.getElementById ('resp_' + intId);
	var objImage = document.getElementById ('ico_mais_' + intId);
    
    if(objResposta != null)
    {
	    objResposta.style.display = 'none';
	    objImage.src = '/custom/client/Images/Site2008/Bullet/Seta2.gif';
	}
}

function expand (intId)
{
	var objResposta = document.getElementById ('resp_' + intId);
	var objImage = document.getElementById ('ico_mais_' + intId);

	objResposta.style.display = 'block';
	objImage.src = '/custom/client/Images/Site2008/Bullet/Seta2_on.gif';	
}

function expandCollapse(intId)
{
	var objResposta = document.getElementById ('resp_' + intId);
	var objImage = document.getElementById ('ico_mais_' + intId);

	if (objResposta.style.display == 'none' || objResposta.style.display == '' )
	{
		expand (intId);
	}
	else
	{
		collapse (intId);
	}
}
/*
function collapseAll()
{
	var totalItens = document.getElementsByTagName("dd").length;
	for (var i=1; i<=totalItens; i++)
	{
		collapse (i)
	}
}
*/
function expandCollapseSwitchImages(intId)
{
	expandCollapse(intId);
}



/****************** MENU PRINCIPAL****************/
function MostraUl(p_Ul){
	if(p_Ul != ""){
		var prefixo = "item_";
		var o_uls = document.getElementsByTagName("ul"); //Pega todas as Uls da página
		for(i = 0; i < o_uls.length; i ++ ){ //Faz um looping nas ULs
			if(o_uls[i].id.indexOf(prefixo) == 0){ // Checa se o ID da UL tem "_ul" no nome
				o_uls[i].style.display = "none"; //Seta o display para "none"
			}
		}
		
		document.getElementById(prefixo + p_Ul).style.display = "";
	}
}

function MostraDiv(p_Div){
	if(p_Div != ""){
		var prefixo = "item_";
		var o_divs = document.getElementsByTagName("div"); //Pega todas as DISs da página
		for(i = 0; i < o_divs.length; i ++ ){ //Faz um looping nas DIVs
			if(o_divs[i].id.indexOf(prefixo) == 0){ // Checa se o ID da DIV tem "_div" no nome
				o_divs[i].style.display = "none"; //Seta o display para "none"
			}
		}
		
		document.getElementById(prefixo + p_Div).style.display = "";
	}
}



		
		function mostraOPSelect(ind)
		{
			document.getElementById('item_'+ind).style.display = 'block';
		
		}
		
		function escondeOPSelect(ind)
		{
			document.getElementById('item_'+ind).style.display = 'none';
		
		}


function mostraAba(ind)
{
	document.getElementById('Abas_'+ind).style.display = 'block';

}


function escondeAba(ind)
{
	var objDiv;
	var i = 0;
	do
	{
		i++;
		objDiv = document.getElementById('Abas_'+i);
		if(objDiv != null && i != ind)
		{
			objDiv.style.display = 'none';
		}
	}while(objDiv != null);
}


	function bg_offAba1()
	{
		document.getElementById('aba1').style.background = 'url(custom/client/Images/Site2008/abas/bg_cotacao_aba_01_off.gif) no-repeat';
		document.getElementById('aba1').style.color = '#fff';
	
	}
	
	function bg_offAba2()
	{
		document.getElementById('aba2').style.background = 'url(custom/client/Images/Site2008/abas/bg_cotacao_aba_01_off.gif) no-repeat';
		document.getElementById('aba2').style.color = '#fff';
	
	}
	
	function bg_offAba3()
	{
		document.getElementById('aba3').style.background = 'url(custom/client/Images/Site2008/abas/bg_cotacao_aba_02_off.gif) no-repeat';
		document.getElementById('aba3').style.color = '#fff';
	
	}


	function bg_onAba1()
	{
		document.getElementById('aba1').style.background = 'url(custom/client/Images/Site2008/abas/bg_cotacao_aba_01_on.gif) no-repeat';
	
	}
	
	function bg_onAba2()
	{
		document.getElementById('aba2').style.background = 'url(custom/client/Images/Site2008/abas/bg_cotacao_aba_01_on.gif) no-repeat';
	
	}
	
	function bg_onAba3()
	{
		document.getElementById('aba3').style.background = 'url(custom/client/Images/Site2008/abas/bg_cotacao_aba_02_on.gif) no-repeat';
	
	}



function menuAbre(ind)
{
	document.getElementById('mostraSubMenu_'+ind).style.display = 'block';
}

function menuEsconde(ind)
{
	document.getElementById('mostraSubMenu_'+ind).style.display = 'none';
}

function menuEscondeSub(ind)
{
	document.getElementById('mostraSubMenu2_'+ind).style.display = "none";
}

function mostraSubServicosAbre(ind)
{
	document.getElementById('mostraSubMenu2_'+ind).style.display = 'block';
}

/****************** MENU PRINCIPAL****************/

function getURLParam(objId){
	var strId = "";
  	var strHref = window.location.href;
	alert(strHref);

	if ( strHref.indexOf("?") > -1 ){
    	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    	var aQueryString = strQueryString.split("&");
    	    	
		//Pega Id do produto
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
    		if (aQueryString[iParam].indexOf(objId.toLowerCase() + "=") > -1 ){
        		var aParam = aQueryString[iParam].split("=");
        		strId = aParam[1];
        		break;
      		}
    	}
    }
	document.getElementById("caminho").innerHTML = strId;

	}


function hover(el) {
	if(el.className != 'on') {
		el.className = 'on hover';
	}
}

function hide(el) {
	if(el.className == 'on hover') {
		el.className = 'off';	
	}
}


/*************** cob***************

// JavaScript Document

// Link Absoluto
var URLAbsoluta = "/"

//galeria de fotos 

function trocaFoto(qualFoto,qualLegenda,qualCaminho) {
	document.getElementById('aFoto').src = qualCaminho + qualFoto;
	document.getElementById('aFoto').name = qualFoto;
	document.getElementById('aFoto').alt = qualLegenda;
		
}

function abreFoto(qualFoto,qualLegenda,qualCaminho,qualArquivoAlta,textoFechar) {
	var oCaminho = qualCaminho 
	var ScrollTop;

	document.getElementById('aFotoAmp').src = oCaminho + qualFoto;	
	document.getElementById('lbxLegenda').innerHTML = qualLegenda;
	document.getElementById('spnFechar').innerHTML = textoFechar;
	document.getElementById('divLightbox').style.display = 'block';
	document.getElementById('divLightbox').style.position = 'absolute';
	
	if(qualArquivoAlta != '')
	{
	    document.getElementById('imgDownload').style.display = 'block';
	    document.getElementById('lnkDownload').style.display = 'block';
	    document.getElementById('lnkDownload').href = oCaminho + qualArquivoAlta;
	    document.getElementById('lnkDownload1').href = oCaminho + qualArquivoAlta;
	     document.getElementById('lnkDownload1').style.display = 'block';
	}
	else
	{
	    document.getElementById('imgDownload').style.display = 'none';
	    document.getElementById('lnkDownload').style.display = 'none';
        document.getElementById('lnkDownload1').style.display = 'none';
	}

	if (navigator.userAgent.indexOf('Firefox')!=-1){
	    // FIREFOX
        ScrollTop = window.pageYOffset;
        ScrollLeft = window.innerWidth;
        WindowHeight = document.documentElement.clientHeight;
	    document.getElementById('divLightbox').style.top = (ScrollTop + (WindowHeight/2)).toString() + 'px'; ;
	    document.getElementById('divLightbox').style.left =  ((ScrollLeft)/2).toString() + 'px';
    }
    else if (navigator.userAgent.indexOf('MSIE 6.0')!=-1){
	    // IE 6.0
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
        ScrollLeft = window.innerWidth;
        WindowHeight = document.documentElement.clientHeight;
	    document.getElementById('divLightbox').style.top = ScrollTop + (WindowHeight/2);
	    //document.getElementById('divLightbox').style.left =  (ScrollLeft)/2;
    }
    else {
        // IE
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
        ScrollLeft = document.body.offsetWidth;
        WindowHeight = document.documentElement.clientHeight;
	    document.getElementById('divLightbox').style.top = ScrollTop + (WindowHeight/2);
	    document.getElementById('divLightbox').style.left =  (ScrollLeft)/2;
    }
}

function abreFotoMiniGal(qualFoto,qualLegenda,qualAutor,qualCaminho,qualArquivoAlta,textoFechar) {
	var oCaminho = qualCaminho 
	var ScrollTop;

	document.getElementById('aFotoAmp').src = oCaminho + qualFoto;	
	document.getElementById('lbxAutorMiniGal').innerHTML = qualAutor;
	document.getElementById('lbxLegendaMiniGal').innerHTML = qualLegenda;
	document.getElementById('spnFechar').innerHTML = textoFechar;
	document.getElementById('divLightbox').style.display = 'block';
	document.getElementById('divLightbox').style.position = 'absolute';
	
	if(qualArquivoAlta != '')
	{
	    document.getElementById('imgDownload').style.display = 'block';
	    document.getElementById('lnkDownload').style.display = 'block';
	    document.getElementById('lnkDownload').href = oCaminho + qualArquivoAlta;
	    document.getElementById('lnkDownload1').href = oCaminho + qualArquivoAlta;
	     document.getElementById('lnkDownload1').style.display = 'block';
	}
	else
	{
	    document.getElementById('imgDownload').style.display = 'none';
	    document.getElementById('lnkDownload').style.display = 'none';
        document.getElementById('lnkDownload1').style.display = 'none';
	}

	if (navigator.userAgent.indexOf('Firefox')!=-1){
	    // FIREFOX
        ScrollTop = window.pageYOffset;
        ScrollLeft = window.innerWidth;
        WindowHeight = document.documentElement.clientHeight;
	    document.getElementById('divLightbox').style.top = (ScrollTop + (WindowHeight/2)).toString() + 'px'; ;
	    document.getElementById('divLightbox').style.left =  ((ScrollLeft)/2).toString() + 'px';
    }
    else if (navigator.userAgent.indexOf('MSIE 6.0')!=-1){
	    // IE 6.0
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
        ScrollLeft = window.innerWidth;
        WindowHeight = document.documentElement.clientHeight;
	    document.getElementById('divLightbox').style.top = ScrollTop + (WindowHeight/2);
	    //document.getElementById('divLightbox').style.left =  (ScrollLeft)/2;
    }
    else {
        // IE
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
        ScrollLeft = document.body.offsetWidth;
        WindowHeight = document.documentElement.clientHeight;
	    document.getElementById('divLightbox').style.top = ScrollTop + (WindowHeight/2);
	    document.getElementById('divLightbox').style.left =  (ScrollLeft)/2;
    }
}

function fechaLightbox() {
	document.getElementById('aFotoAmp').src = "/util/img/loader.gif"
	document.getElementById('divLightbox').style.display = 'none';
}



function popup(URL,largura,altura) {
	var width = largura;
	var height = altura;
	var left = 100;
	var top = 100;
	window.open(URL,'popup', 'width='+width+', height='+height+', top='+top+', left='+left+', toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, fullscreen=no');
}


/* GALERA DE VIDEOS */

//Lê idioma
function getURLParamLanguage(objId){
	var strLang;
  	var strHref = window.location.href;

	if ( strHref.indexOf("?") > -1 ){
    	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    	var aQueryString = strQueryString.split("&");
    	
		//Idioma
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
    		if (aQueryString[iParam].indexOf(objId.toLowerCase() + "=") > -1 ){
        		var aParam = aQueryString[iParam].split("=");
        		strLang = aParam[1];
        		break;
      		}
    	}
		return strLang
	}
}

function getURLParamSubtitle(objId){
	var strLang;
  	var strHref = window.location.href;

	if ( strHref.indexOf("?") > -1 ){
    	var strQueryString = strHref.substr(strHref.indexOf("?"));
    	var aQueryString = strQueryString.split("&");
    	
		//Idioma
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
    		if (aQueryString[iParam].indexOf(objId + "=") > -1 ){
        		var aParam = aQueryString[iParam].split("=");
        		strLang = aParam[1];
        		break;
      		}
    	}
		return strLang
	}
}

function getURLParamFile(objFile){
	var strFile = "";
  	var strHref = window.location.href;

	if ( strHref.indexOf("?") > -1 ){
    	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    	var aQueryString = strQueryString.split("&");
    	
	
		//Arquivo
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
    		if (aQueryString[iParam].indexOf(objFile.toLowerCase() + "=") > -1 ){
        		var aParam = aQueryString[iParam].split("=");
        		strFile = aParam[1];
        		break;
      		}
    	}
		
		return strFile
	}
}




//APOIE A CAMPANHA 

function trocaWallpaper(idObj, locale) {
	
	var pasta = URLAbsoluta + 'util/downloads/' + locale + '/';
	
	//Troca a imagem grande
	document.getElementById("thumbWall").src = pasta + 'thumbs/wallpapers/182x136/' + idObj + '.jpg';
	
	//Altera os links
	document.getElementById("linkWall800").href = pasta + 'wallpaper/computador/800x600/' + idObj + '.jpg';
	document.getElementById("linkWall1024").href = pasta + 'wallpaper/computador/1024x768/' + idObj + '.jpg';


}

function trocaScreensaver(idObj, locale) {
	
	var pasta = URLAbsoluta + 'util/downloads/' + locale + '/';
	
	//Troca a imagem grande
	document.getElementById("thumbScreen").src = pasta + 'thumbs/screensavers/182x136/'+idObj+'.jpg';
	
	//Altera os links
	document.getElementById("linkScreen").href = pasta + 'screensaver/'+idObj+'.zip';

}



//RIO 2016 HOME - AJUSTAR ALTURA DOS BOXES

 function boxHeightSet() {
 	
		for(var ind=1;ind<=3;ind++) {
			
			var boxEsq = document.getElementById("boxLinha"+ind+"_Esq").offsetHeight;
			var boxDir  = document.getElementById("boxLinha"+ind+"_Dir").offsetHeight;
	
			if (boxEsq > boxDir) {
				document.getElementById("boxLinha"+ind+"_Dir").style.height = boxEsq;
			} else if (boxEsq < boxDir) {
				document.getElementById("boxLinha"+ind+"_Esq").style.height = boxDir;
			}
		}
}

//flash


function montaSWF(url,width,height,FlashVars)
{
    var ret = '';
    ret += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="MemoConteudo" width="' + width + '" height="' + height + '" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">';
    ret += '<param name="movie" value="' + url + '" />';
    ret += '<param name="quality" value="high" />';
    ret += '<param name="bgcolor" value="#FFFFFF" />';
    ret += '<param name="wmode" value="opaque" />';
    ret += '<param name="allowScriptAccess" value="always" />';
    ret += '<param name="FlashVars" value="' + FlashVars + '" />';
    ret += '<embed src="' + url + '" wmode="opaque" quality="high" bgcolor="#FFFFFF" width="' + width + '" height="' + height + '" name="MemoConteudo" id="MemoConteudo" align="middle" play="true" loop="false" FlashVars="' + FlashVars + '" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">';
    ret += '</embed>';
    ret += '</object>';
    document.write(ret);
}

function aplicaFlash(swf, width, height, wmode, cache, flashvars) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";
	monta_swf += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='flashvars' value='"+ flashvars +"'>";	
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<embed src='"+ swf +"' flashvars='"+ flashvars +"' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";
	//document.write('<textarea rows=40 cols=80>' + monta_swf + '</textarea>');
	document.write(monta_swf);
}

function adicionaFavoritos(title,url) 
{
    if (window.sidebar) 
    { 
        window.sidebar.addPanel(title, url,""); 
    } 
    else if( document.all ) 
    {
        window.external.AddFavorite( url, title);
    } 
    else if( window.opera && window.print ) 
    {
        return true;
    }
}





//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div' );

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;
sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 6 ) sz = 6;
startSz = sz;
if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0; i < tgs.length; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0; j < cTags.length; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->





function mostraabaHeader(num)
{
	document.getElementById('headerList_' + num).style.display="block";
}
function ocultaAbaHeader()
{
	for(var i = 0; i <= 2; i++)
	{
		document.getElementById('headerList_' + i).style.display="none";
	}
}
function mostraabaHeader2(num)
{
	document.getElementById('headerList_' + num).style.display="block";
	document.getElementById('img_Tes').style.display="none";
	document.getElementById('img_Tes2').style.display="block";
}
function ocultaAbaHeader2(num)
{
	for(var i = 0; i <= 2; i++)
	{
		document.getElementById('headerList_' + i).style.display="none";
	}
	document.getElementById('img_Tes').style.display="block";
	document.getElementById('img_Tes2').style.display="none";
}


function tvflash(){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="393" height="212">');
	document.write('  <param name="movie" value="custom/client/Flash/Site2008base_tvFlash.swf" />');
	document.write('  <param name="quality" value="high" />');
	document.write('  <param name="wmode" value="transparent" />');
	document.write('  <embed src="custom/client/Flash/Site2008base_tvFlash.swf" wmode="transparent" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="393" height="212"></embed>');
	document.write('</object>');
}

function bannerParceiros(){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="150" height="101">');
document.write('  <param name="movie" value="custom/client/Flash/Site2008bannerParceiros.swf" />');
document.write('  <param name="quality" value="high" />');
document.write('  <param name="wmode" value="transparent" />');
document.write('  <embed src="custom/client/Flash/Site2008bannerParceiros.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="150" height="101"></embed>');
document.write('</object>');
}

function toggle(oElemento) {
		if(document.getElementById(oElemento).style.display != 'block') document.getElementById(oElemento).style.display = 'block';
		else document.getElementById(oElemento).style.display = 'none'; 
}
function showMsgBox(e,i) {
	var popup = document.getElementById("boxMensagem"+i);
	var home = document.getElementsByTagName("html")[0];
	var barra = home.scrollTop;
	x = e.clientX;
  	y = e.clientY;
	popup.style.left = (x + 20)+'px';
	popup.style.top = (y + 5 + barra)+'px';
	popup.style.display='block';
}

function hover(el) {
	if(el.className=='off')
	el.className='on hover';
}

function hide (el) {
	if((el.className).indexOf('hover') > 0)
	el.className='off';
}

function showSuuub(li) {
	li.className='on';
}

function hideSuuub(li) {
	li.className='';
}

function openWindow(url, name)
{ var winWidth = 488;
  var winHeight = 450;
  var winTop = parseInt((screen.availHeight - winHeight) / 2);
  var winLeft = parseInt((screen.availWidth - winWidth) / 2);
			  
  popupWin = window.open(url,name,"width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft + ",resizable=no,scrollbars=no,statusbar=no");
  if (popupWin.opener == null) popupWin.opener = self;
}


function AbrePopUpCentro(url, name, width, height)
{ var winWidth = width;
  var winHeight = height;
  var winTop = parseInt((screen.availHeight - winHeight) / 2);
  var winLeft = parseInt((screen.availWidth - winWidth) / 2);
			  
  popupWin = window.open(url,name,"width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft + ",resizable=no,scrollbars=no,statusbar=no");
  if (popupWin.opener == null) popupWin.opener = self;
}

function MostraEsconde(divMostra)
{
	td = document.getElementById("tdContainer");
	elems = td.getElementsByTagName("li");
	
	if(document.getElementById(divMostra).style.visibility=='hidden')
	{
		document.getElementById(divMostra).style.display = "block";
		document.getElementById(divMostra).style.visibility = "visible";
	}
	else
	{
		document.getElementById(divMostra).style.display = "none";
		document.getElementById(divMostra).style.visibility = "hidden";
	}
	
	for (i = 0; i < elems.length; i++)
	{
		if (elems[i].id != "" && elems[i].id != divMostra)
		{
			elems[i].style.display = "none";
			elems[i].style.visibility = "hidden";
		}
	}
}
			
function TrocaCampoTxt(src, numCaracter, dest)
{
	
	if (src.value.length==numCaracter) 
		document.getElementById(dest).focus();
	
}
function TrocaCampoCombo(src, dest)
{
	
	if (src.selectedIndex>0) 
	{	
		document.getElementById(dest).disabled = false;
		document.getElementById(dest).focus();
	}
}


function FormatarMascara(src, mask, event){
	//Para usar onkeypress="FormatarMascara(this, '(##)####-####', event);"
  var i = src.value.length;
  var saida = '#';
  var texto = mask.substring(i);
  var Tecla = event.charCode;
  var ie = event.keyCode;
  
  if (!event) 
    event = window.event;
  var code;
  if (event.keyCode) 
    code = event.keyCode; // IE
  else if (event.which) 
    code = event.which; // Netscape 4.?


  if (code < 48 || code > 58 ){
    event.returnValue = false;
    if (event.which){
       event.preventDefault();
     }
     if (texto.substring(0,1) != saida){
        src.value += texto.substring(0,1);
        return true;
      }
    return false;
  }
  else{
    if (texto.substring(0,1) != saida){
         src.value += texto.substring(0,1);
     }
    event.returnValue = true;
    return true;
  }
  
  
}

