window.name = "GloboOnLine"

function SHL() { //v3.0
  var i,p,v,obj,args=SHL.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

//Abre janela central
b_versao = parseInt(navigator.appVersion);

var win = null;
function NewWindow(mypage,myname,w,h,scroll,size)
{
if (b_versao >= 4)
	{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	}
else
	{
	LeftPosition = 100
	TopPosition = 100
	}
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+size+''
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}

//Abre janela com o resultado das pesquisas
function abreEnquete(clicou_voto, form, num_opcao)  {
	window.open("", "enquete", "directories=no,height=276,width=520,hotkeys=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,copyhistory=no");

  // Se receber o nome do formulário por parâmetro, utiliza-o;
  // caso contrário, usa o nome do formulário padrão (enquete)
  // esta possibilidade está aberta para o caso de termos mais
  // de uma pesquisa na mesma página ao mesmo tempo

  form.voto.value = clicou_voto;
  form.opcao.value = num_opcao;
  form.submit();
 }


//Redireciona para diretorio desejado opcao do form
function Menu(form) {var result=(form.Alvo.options[form.Alvo.selectedIndex].value);location.href=result;}

//Dah refresh em Netscape se a janela for redimensionada
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//Acerta editoria atual no pull down
function acertaeditoria() {document.form1.Alvo.selectedIndex=0;}


function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function show() { //v3.0
  var i,p,v,obj,args=show.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

// Inicio do codigo do menu

var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;


if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}


var menuTop = 45;
var menuLeft = 400;

var domSMenu = null;
var oldDomSMenu = null;
var t = 0;
var lDelay = 3;
var lCount = 0;
var pause = 100;

function popMenu(menuNum){
	if (isDHTML) {
///// Sets the previous menu's visibility to hidden
		t = 2;
		if (oldDomSMenu) {
			oldDomSMenu.visibility = 'hidden'; 
			oldDomSMenu.zIndex = '0'; 
			t = 2; 
			lCount = 0;
		}

///// Defines the DOMs	of the menu objects
		var idMenu = 'menuHead';
		var domMenu = findDOM(idMenu,0);

		var idMenuOpt = 'menuHead' + menuNum;
		var domMenuOpt = findDOM(idMenuOpt,0);		

		var idSMenu = 'menu' + menuNum;
		var domSMenu = findDOM(idSMenu,1);

///// Defines the positions of the sub-menus
	if (isID || isAll) { 	
				var menuLeft = 100;
				var menuTop = (domMenu.offsetTop) + (domMenu.offsetHeight) + 176;
			}
		if (isLayers) {
				var menuLeft = 100;
				var menuTop = 359 + 102;
		}
///// Positions and shows the menu
		if (oldDomSMenu != domSMenu) {	
			domSMenu.left = menuLeft; 
			domSMenu.top = menuTop;
			domSMenu.visibility = 'visible';
			domSMenu.zIndex = '100';
			oldDomSMenu = domSMenu;
		}

///// Resets oldDom if it is the same as the current DOM
		else { oldDomSMenu = null; }
	}

////// Returns a 'null' value for non-DHTML Browsers 
	else { return null; }
}

function delayHide() {
///// Checks to see if there is a menu showing and whether 
///// the global variable 't' has been set to 0
    if ((oldDomSMenu) && (t == 0)) {

///// Hides the old menu, resets menu conditions, 
///// and stops the function running
        oldDomSMenu.visibility = 'hidden'; 
        oldDomSMenu.zIndex = '0';
        oldDomSMenu = null;
        lCount = 0; 
        return false;
    }

///// Interupts the function if another menu is opened
    if (t == 2) { lCount = 0; return false; }

///// Repeats the function adding 1 to lCount each time until 
///// lCount is equal to lDelay and then sets 't' to 0 so that 
///// the menu will hide when it runs again
    if (t == 1) { 
        lCount = lCount + 1;
        if (lDelay <= lCount) { t = 0; }
        if (lDelay >= lCount) { setTimeout('delayHide(' + t + ')',pause); }
    }
}




// Rotinas de leitura e gravação de cookies  (usadas pela barra de navegação do globo on line).

function setCookie() 
{
 
  document.cookie =  setCookie.arguments[0] + "=" + 
	        escape(setCookie.arguments[1]) +
	  ((setCookie.arguments[2]) ? "; expires=" + arguments[2].toGMTString() : "") +
	  ((setCookie.arguments[3]) ? "; path=" + setCookie.arguments[3] : "") +
	  ((setCookie.arguments[4]) ? "; domain=" + setCookie.arguments[4] : "") +
	  ((setCookie.arguments[5]) ? "; secure=" + setCookie.arguments[5] : "");

}

function getCookie(name) 
{
var cooklen = document.cookie.length;
var namearg = name + "=";
var namelen = namearg.length;

  if (document.cookie.indexOf(namearg)>-1) 
  {
	endcook = document.cookie.substring(document.cookie.indexOf(namearg)+namelen);
	cookievalue = endcook.substring(0,((endcook.indexOf(";") > -1) ? endcook.indexOf(";") : cooklen))
        return unescape(cookievalue)
  }
  else
        return ""
}

function leChave (valcookie, nomechave) 
{
	chaves = (unescape(valcookie)).split("&")
	for (i = 0; i < chaves.length; i++) {
		chaves[i] = chaves[i].split("=");
		if (chaves[i][0] == nomechave) return (chaves[i][1]);
	}
	return ""
}

// Fim das rotinas de cookie