	//GOOGLE ANALYTICS
	_uacct = "UA-1282213-1";

	function analytics(page){
		if (page==null || page==""){
			urchinTracker();
		}else{
			urchinTracker(page);
		}
	}

	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				oldonload();
				if (func!=undefined)
					func();
			}
		}
	}

	function exibeDiv(objeto){
		try{
			if ($(objeto).className.indexOf('hidden')!=-1){
				$(objeto).className = $(objeto).className.replace("hidden","visible");
			}else{
				$(objeto).style.display = 'block';
				$(objeto).style.overflow = 'visible';
			}
		}catch(e){}
	}

	function tiraDiv(objeto){
		try{
			if ($(objeto).className.indexOf('visible')!=-1){
				$(objeto).className = $(objeto).className.replace("visible","hidden");
			}else{
				$(objeto).style.display = 'none';
				$(objeto).style.overflow = 'hidden';
			}
		}catch(e){}
	}


	function retorno_fimServicos(ret, obj){
		$(obj).innerHTML = ret;
	}

	function retorno_iniciaServicos(retorno, arr){
		if (retorno==""){
			if (arr[1]!=""){
				if (arr[2]!=""){
					requestHTTP(arr[2], retorno_fimServicos,arr[1]);
				}else{
					$(arr[1]).parentNode.removeChild($(arr[1]));
				}
			}else{
				if (arr[2]!=""){
					requestHTTP(arr[2], retorno_fimServicos,arr[0]);
				}else{
					$(arr[0]).parentNode.removeChild($(arr[0]));
				}
			}
		}else{
			if ( $(arr[0]) !=null){
				$(arr[0]).innerHTML = retorno;
			}
		}
	}
	
	function iniciaServicos(canal, local, div_pai, load_template){
		var arr = new Array(local,div_pai,load_template);
		requestHTTP('inc_servicos.aspx?canal='+encodeURIComponentNew(canal), retorno_iniciaServicos,arr )
	}

	addLoadEvent(
		function() {
			var l = new String(location);
			if (l.indexOf('conteudo.aspx')!=-1 || l.indexOf('busca_topico.aspx')!=-1){
				menu_hover(((queryScript('tipo')=='passoapasso')?'tab2':'tab1'));
			}
		}
	);
	
	
	function validaBuscaSimples(campo, busca)
	{
        var str = '';
		if ($(campo).value==''){
			alert("Digite uma palavra antes de fazer a busca.");
			return false;
		}else{
			str = '&searchfor='+$(campo).value;
		}
        
		window.location = 'resultado_busca.aspx?searchterm='+$(campo).value;
		return true;
	}
	
	
	function mostraMenu(){
		//if ($('conteudo_interno')!=null)
		//exibeDiv('conteudo_interno');
	}

	function escondeMenu(){
		//if ($('conteudo_interno')!=null)
		//tiraDiv('conteudo_interno');
	}

	function $(quem){
		return document.getElementById(quem);
	}

	function popImprimir(id,excluir,incluir){
		var doc = $(id).innerHTML;
		//status=yes,menubar=yes,scrollbars=yes,resizable=yes
		var	abc = window.open('http://bbel.uol.com.br/imprimir.html?arrayExc='+excluir+'&arrayInc='+incluir,'imprimir','');
	}

	function URL(complemento){
		var e = new String(location).toLowerCase().replace('http://','');
		var _u = "http://bbel.uol.com.br/"+complemento;
		var array = e.split('/');
		if (array.length > 1 && array[1] == "sos"){ //INTERNO
			_u = array[0]+"/"+array[1];
		}else{
			_u = e.substring(0,e.indexOf('/'));
		}
		return 'http://'+_u+'/'+complemento;
	}
	
	function VerificaURL(pagina){
		var e = new String(location);
		if (e.indexOf(pagina)>-1)
			return  true;
		return 	false;
	}


	function getCookie(c_name){
		if (document.cookie.length>0){
			c_start=document.cookie.indexOf(c_name + "=")
			if (c_start!=-1){ 
				c_start=c_start + c_name.length+1 
				c_end=document.cookie.indexOf(";",c_start)
				if (c_end==-1) c_end=document.cookie.length
					return unescape(document.cookie.substring(c_start,c_end))
			} 
		}
		return null
	}

	String.prototype.trim = function(c, t){
		return c = "[" + (c == undefined ? " " : c.replace(/([\^\]\\-])/g, "\\\$1")) + "]+",
		this.replace(new RegExp((t != 2 ? "^" : "") + c + (t != 1 ? "|" + c + "$" : ""), "g"), "");
	};	

	function setCookie(c_name,value,expiredays){
		var exdate=new Date()
		exdate.setDate(expiredays)
		document.cookie=c_name+ "=" +escape(value)+
		((expiredays==null) ? "" : ";expires="+exdate)
	}

	function removeCookie(c_name){
		document.cookie=c_name+ "= '';expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}

	function addCookieRadio(quem){
		var str_temp = getCookie("podCasts");
	//	alert("1 = "+str_temp);
		var popUp = false;
		if (str_temp==null || str_temp=="null"){
			str_temp = "";
			popUp = true;
		}

		var str_pks = new String();
		if (str_temp==null || str_temp=="null" || str_temp=="")
			str_pks = quem;
		else
			str_pks = str_temp+";"+quem;


		//alert("2 = "+str_pks);
		setCookie("podCasts",str_pks, 300);
		if (popUp==true){
			abreRadio('');
		}
	}

	function abreRadio(todos){
		//setCookie("popRadioAberto",true, 300);
		window.open('http://www.bbel.com.br/radio.aspx'+((todos!="")?"?all=s":""),'pop_radio','width=468,height=420');
	}
	
	function Mes(quem){
		var m = new Array();
			m[0] = "Janeiro";
			m[1] = "Fevereiro";
			m[2] = "Marco";
			m[3] = "Abril";
			m[4] = "Maio";
			m[5] = "Junho";
			m[6] = "Julho";
			m[7] = "Agosto";
			m[8] = "Setembro";
			m[9] = "Outubro";
			m[10] = "Novembro";
			m[11] = "Dezembro";
			return m[quem];
	}

	function recuperaArrys(local){
		var objs;
		try{
			objs = $(local).getElementsByTagName('li');
		}catch(e){}
		var _tm = new Array();
		for (i = 0;i<objs.length;i++){
			if (objs[i].id!="")
			_tm[_tm.length] = objs[i].id;
		}
		return _tm;
	}

	function removeEstilosLink(quem, local){
		var arrayTabs = recuperaArrys(local);
		var atual;
		for (i = 0; i<arrayTabs.length;i++){
			atual = new String(arrayTabs[i]).replace('lnk_','').replace('tab_','');
			if (atual!=quem){
				try{
					$('lnk_'+atual).className = '';
					$('tab_'+atual).className = 'hidden';
					verificaSubCategorias($('lnk_'+atual),'hidden');
				}catch(e){
					alert("ERRO = "+atual);
				}
			}
		}
		
		$('lnk_'+quem).className = 'active';
		$('tab_'+quem).className = 'visible';
		verificaSubCategorias($('lnk_'+quem),'visible');
	}

	function verificaSubCategorias(obj, _class){
		var _r = obj.getElementsByTagName('ul')[0];
		if (_r!=null){
			if (_r.className!=null){
				if (new String(_r.className).indexOf(((_class=='visible')?'hidden':'visible'))!=-1){
					_r.className = new String(_r.className).replace(((_class=='visible')?'hidden':'visible'),_class);
				}else{
					_r.className = _r.className+' '+_class;
				}
			}else{
				_r.className = _class;
			}
		}
	}

	function Enter(e,quem){
		if(e.keyCode==13){
			eval(quem);
		}
	}
	
	function exibe_flash(swf,id,width,height) {
		var flash = new String();
		flash = '<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" name="'+id+'" id="'+id+'">';
		flash += '<param name="movie" value="'+swf+'" />';
		flash += '<param name="wmode" value="transparent" />';
		flash += '<param name="quality" value="high" />';
		flash += '<embed src="'+swf+'" swliveconnect="true" name="'+id+'"  id="'+id+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>';
		flash += '</object>';
		document.write(flash);
	}

	function opacity(id, opacStart, opacEnd, millisec) {
		//speed for each frame
		var speed = Math.round(millisec / 100);
		var timer = 0;

		//determine the direction for the blending, if start and end are the same nothing happens
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++)
				{
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	}
	
	//change the opacity for different browsers
	function changeOpac(opacity, id) {
		var obj = $(id).style;
			obj.filter = "alpha(opacity=" + opacity + ");";
			obj.opacity = (opacity / 100);
			obj.MozOpacity = (opacity / 100);
			obj.KhtmlOpacity = (opacity / 100);
	} 	

	function queryScript(quem){
		var loc = new String();
			loc = location+"";
			loc = loc.replace(loc.split('?')[0],'');
		if (loc==undefined)
			return null;
		var retorno = null;
		if (loc.indexOf(quem)> -1){
			valorAtual = loc.substring(loc.indexOf(quem)+(quem.length+1),loc.length);
			if (valorAtual.indexOf("&")> -1){
				retorno = valorAtual.substring(0,valorAtual.indexOf("&"));
			}else{
				retorno = valorAtual;
			}
		}
		return retorno;
	}
	
	
	function mudaMenu(lnk, pai, filho, estilo_pai, estilo_filho){
		esquerda.SalvaValores(pai, filho, estilo_pai, estilo_filho);
		location = lnk;
	}

	function utf8(wide) {
	  var c, s;
	  var enc = "";
	  var i = 0;
	  while(i<wide.length) {
		c= wide.charCodeAt(i++);
		// handle UTF-16 surrogates
		if (c>=0xDC00 && c<0xE000) continue;
		if (c>=0xD800 && c<0xDC00) {
		  if (i>=wide.length) continue;
		  s= wide.charCodeAt(i++);
		  if (s<0xDC00 || c>=0xDE00) continue;
		  c= ((c-0xD800)<<10)+(s-0xDC00)+0x10000;
		}
		// output value
		if (c<0x80) enc += String.fromCharCode(c);
		else if (c<0x800) enc += String.fromCharCode(0xC0+(c>>6),0x80+(c&0x3F));
		else if (c<0x10000) enc += String.fromCharCode(0xE0+(c>>12),0x80+(c>>6&0x3F),0x80+(c&0x3F));
		else enc += String.fromCharCode(0xF0+(c>>18),0x80+(c>>12&0x3F),0x80+(c>>6&0x3F),0x80+(c&0x3F));
	  }
	  return enc;
	}

	var hexchars = "0123456789ABCDEF";

	function toHex(n) {
	  return hexchars.charAt(n>>4)+hexchars.charAt(n & 0xF);
	}

	var okURIchars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";

	function encodeURIComponentNew(s) {
	  var s = utf8(s);
	  var c;
	  var enc = "";
	  for (var i= 0; i<s.length; i++) {
		if (okURIchars.indexOf(s.charAt(i))==-1)
		  enc += "%"+toHex(s.charCodeAt(i));
		else
		  enc += s.charAt(i);
	  }
	  return enc;
	}

	function buildURL(fld){
		if (fld == "") return false;
		var encodedField = "";
		var s = fld;
		if (typeof encodeURIComponent == "function")
		{
			// Use JavaScript built-in function
			// IE 5.5+ and Netscape 6+ and Mozilla
			encodedField = encodeURIComponent(s);
		}
		else 
		{
			// Need to mimic the JavaScript version
			// Netscape 4 and IE 4 and IE 5.0
			encodedField = encodeURIComponentNew(s);
		}
		alert ("New encoding: " + encodeURIComponentNew(fld) +
			 "\n           escape(): " + escape(fld));
		return true;
	}
	
	var arrayTime = new Array();
	function set_arrayTime(name, tempo){
		if (arrayTime.length==0){
			var temp = new Array();
				temp[0] = 'timeDestaque_'+name;
				temp[1] = setTimeout("changeReceita('proxima','"+name+"')", tempo);
				arrayTime[0] = temp;
		}else{
			var posi = -1;
			for (i = 0;i<arrayTime.length;i++){
				if ('timeDestaque_'+name == arrayTime[i][0]){
					posi = i;
					break;
				}
			}
			if (posi==-1) posi = arrayTime.length;
			var temp = new Array();
				temp[0] = 'timeDestaque_'+name;
				temp[1] = setTimeout("changeReceita('proxima','"+name+"')", tempo);
				arrayTime[0] = temp;
		}
	}
	
	function clear_arrayTime(name){
		for (i = 0;i<arrayTime.length;i++){
			if (name == arrayTime[i][0]){
				clearTimeout(arrayTime[i][1]);
				break;
			}
		}
	}

	function retorno_iniciaRequestDestaques(xml, obj){
		var ni = $(obj.local_retorno);
			if (ni.className!=null){
				ni.className = ni.className+' destaques_chamadas';
			}else{
				ni.className = 'destaques_chamadas';
			}
			ni.innerHTML = xml;

		arrayTabs = recuperaArrys(obj.local_array);
		if (arrayTabs!=undefined && arrayTabs.length==1){
			try{
			$(obj.local_retorno).removeChild($("barra_controle"));
			}catch(e){}
		}

		if (arrayTabs!=null && arrayTabs!=undefined && arrayTabs.length>1){
			set_arrayTime(obj.local_array, 10000);
		}
	}

	function changeReceita(passo, local){
		var arrys = recuperaArrys(local);
		if (arrys.length!=0){
			for (i=0;i<arrys.length;i++){
				if ($(arrys[i]).className=='active'){
					if (i==((passo=='proxima')?arrys.length-1:0)){
						removeEstilosLink($(arrys[((passo=='proxima')?0:arrys.length-1)]).id.replace('lnk_',''), local);
					}else{
						removeEstilosLink($(arrys[((passo=='proxima')?i+1:i-1)]).id.replace('lnk_',''), local);
					}
				}
			}
			set_arrayTime(local, 10000);
		}
	}

	Date.prototype.addday= function(n,boo){ 
		if(!n) n= 1; 
		n*=(86400000); 
		var x= (this.getTime()+n); 
		x= new Date(x); 
		if(boo)x= x.toUTCString(); 
			return x; 
	} 


	function changeImage(passo, quem){
		if (arrayImagens==null || arrayImagens.length==0){
			alert("Array de imagens não definido");
		}else{
			for (i=0;i<arrayImagens.length;i++){
				if (arrayImagens[i]+""==$(quem).src+""){
					if (passo=='proxima' && i==arrayImagens.length-1){
						$(quem).src = arrayImagens[0];
					}else if (passo=='anterior' && i==0){
						$(quem).src = arrayImagens[arrayImagens.length-1];
					}else{
						$(quem).src = ((passo=='proxima')?arrayImagens[i+1]:arrayImagens[i-1]);
					}
					break;
				}
			}
		}
	}

	function iniciaRequestDestaques_Array(quem, dados, local){
		if ($(quem)!=null)
			$(quem).innerHTML = "<img class=\"preloader\" src=\"imagens/loading.gif\" />";
		iniciaRequestDestaques(quem, dados, local);
	}

	function iniciaRequestDestaques(quem, dados, obj){
		var o = new Array();
			o.local_retorno = quem;
			o.local_array = obj;
		requestHTTP(dados, retorno_iniciaRequestDestaques, o);
	}

	function requestHTTP(url, fn_retorno, obj_extra){
		url = URL(url);
		var http_request = false;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType) {
				http_request.overrideMimeType('text/html');
			}
		} else if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		if (!http_request) {
			return false;
		}
		
		http_request.onreadystatechange = function() {
			if (http_request.readyState == 4) {
				if (http_request.status == 200) {
					if (obj_extra!=null){
						eval('fn_retorno(http_request.responseText,obj_extra)');
					}else{
						eval('fn_retorno(http_request.responseText)');
					}
				} else {
					//alert('Erro ao recuperar o XML : ' + http_request.status);
				}
			}
		}
		http_request.open('GET', url, true);
		//http_request.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" );
		
		
		http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
		
		http_request.send(null);
		
	}

	
	function menu_hover(quem){
		/*if (quem=='tab1'){
			$('tab1').style.overflow	= 'visible';
			$('tab1').style.display		= 'block';

			$('tab2').style.overflow	= 'hidden';
			$('tab2').style.display		= 'none';
		} else {
			$('tab2').style.overflow	= 'visible';
			$('tab2').style.display		= 'block';

			$('tab1').style.overflow	= 'hidden';
			$('tab1').style.display		= 'none';
		}*/
	}
	
	function EmptyField(field) {
 	   var fieldValue = field.value.replace(/ /g, '');
	    if (fieldValue.length == 0) {
	        return true;
	    } else {
	        return false;
	    }
	}

	function colorRows() {
		var objTABLE = document.getElementsByTagName("table");
			if (objTABLE.length>0){
				for (i = 0;i<objTABLE.length;i++){
					var _c = ((document.all)? objTABLE[i].className : objTABLE[i].getAttribute('class'));
					if (new String(objTABLE[i].className).indexOf('zebra')!=-1){
						var obj = objTABLE[i].getElementsByTagName('tr');
						if (obj!=null && obj.length>0){
							obj[0].className = 'rowTint';
							for (var y=1;y<obj.length;y++){
								if (y%2) obj[y].className = 'rowTint2';
					    	}
						}
					}
				}
			}
	}
	addLoadEvent(colorRows);

//..................Função Javascrip chamada no Footer das páginas para setar o ano atual....
function AnoAtualFooter()
{
	var dt =  new Date();
	var  aux = document.getElementById('anoAtualFooter');
	aux.innerHTML = 	dt.getFullYear();
	//return dt.getYear();
}
//.............................................................................................