
 // LRsolucao - Portal PA::..
 // E-mail : romulo_dk18@hotmail
 
 
 
 // Newsletter
  function atribui_valor(id_v,valor,nome,metodo){ document.getElementById(id_v).innerHTML = ""+nome+"";  if(metodo=='_blank'){ 
 window.open(valor);}else{window.location.replace(valor);};}
 
 
 //Enquete

function makePOSTRequest(url, parameters, id_div) {  campo=id_div;http_request = false;     
 if (window.XMLHttpRequest) { // Mozilla, Safari,.
 http_request = new XMLHttpRequest();
  if (http_request.overrideMimeType) {// set type accordinglyto anticipated content type.  
   //http_request.overrideMimeType('text/xml');        
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) 
  {alert('Cannot create XMLHTTP instance'); return false;      }
 http_request.onreadystatechange = alertContents;  
http_request.open( 'POST' , url, true ); 
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);  http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);}

  function alertContents() {     if (http_request.readyState == 4) {  if (http_request.status== 200) {    
//alert(http_request.responseText);
result = http_request.responseText;document.getElementById(campo).innerHTML = result;              } else {      
 alert('There  was a problem with the request.'); } } else {
  document.getElementById(campo).innerHTML = '<br><center><span class=\"nome_enquete_resposta\"> Processando ...</span> </center>'; }}


   function valor(testev){
  document.myform.resposta.value= testev;
   return true;
   }
   
    function getenquete(obj) 
	  
	  { if(document.myform.resposta.value!=""){
	var poststr = "id=" + encodeURI( document.getElementById("id").value )
	+ "&modo="+encodeURI(document.getElementById("modo").value)
	+"&t =" + encodeURI(document.getElementById("t").value) 
	+"&resp=" + encodeURI(document.myform.resposta.value);
	 makePOSTRequest('enquete/apgresu.php', poststr,'myspan');
	 
	 document.getElementById('atencao').innerHTML=""; }else{ document.getElementById('atencao').innerHTML = '<spanclass=\"nome_enquete_resposta\"> Marque uma opção !</span> </center>'; 
	 
}}



	function SHL() { //v9.0
	  var i,p,v,obj,args=SHL.arguments;
	  for (i=0; i<(args.length-2); i+=3) 
	  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
		obj.visibility=v; }
	}
	
	function setClassName(objId, fundo) {
			document.getElementById(objId).style.background= fundo;
	
	
	}

	function mostra(bi) {
		if (bi == 1) {SHL('img_dh1','','show');SHL('img_dh2','','hide');SHL('img_dh3','','hide');SHL('img_dh4','','hide');SHL('img_dh5','','hide');SHL('img_dh6','','hide');setClassName('dh1','#212C3D');setClassName('dh2','#415778');setClassName('dh3','#415778');setClassName('dh4','#415778');setClassName('dh5','#415778');setClassName('dh6','#415778');}
		
		if (bi == 2) {SHL('img_dh1','','hide');SHL('img_dh2','','show');SHL('img_dh3','','hide');SHL('img_dh4','','hide');SHL('img_dh5','','hide');SHL('img_dh6','','hide');setClassName('dh1','#415778');setClassName('dh2','#212C3D');setClassName('dh3','#415778');setClassName('dh4','#415778');setClassName('dh5','#415778');setClassName('dh6','#415778');}
		
		if (bi == 3) {SHL('img_dh1','','hide');SHL('img_dh2','','hide');SHL('img_dh3','','show');SHL('img_dh4','','hide');SHL('img_dh5','','hide');SHL('img_dh6','','hide');setClassName('dh1','#415778');setClassName('dh2','#415778');setClassName('dh3','#212C3D');setClassName('dh4','#415778');setClassName('dh5','#415778');setClassName('dh6','#415778');}
		
		if (bi == 4) {SHL('img_dh1','','hide');SHL('img_dh2','','hide');SHL('img_dh3','','hide');SHL('img_dh4','','show');SHL('img_dh5','','hide');SHL('img_dh6','','hide');setClassName('dh1','#415778');setClassName('dh2','#415778');setClassName('dh3','#415778');setClassName('dh4','#212C3D');setClassName('dh5','#415778');setClassName('dh6','#415778');}
		
		if (bi == 5) {SHL('img_dh1','','hide');SHL('img_dh2','','hide');SHL('img_dh3','','hide');SHL('img_dh4','','hide');SHL('img_dh5','','show');SHL('img_dh6','','hide');setClassName('dh1','#415778');setClassName('dh2','#415778');setClassName('dh3','#415778');setClassName('dh4','#415778');setClassName('dh5','#212C3D');setClassName('dh6','#415778');}

		if (bi == 6) {SHL('img_dh1','','hide');SHL('img_dh2','','hide');SHL('img_dh3','','hide');SHL('img_dh4','','hide');SHL('img_dh5','','hide');SHL('img_dh6','','show');setClassName('dh1','#415778');setClassName('dh2','#415778');setClassName('dh3','#415778');setClassName('dh4','#415778');setClassName('dh5','#415778');setClassName('dh6','#212C3D');}
	}
	
	var gira = 1;
	var trocador = 0;
	
	function troca() {
		gira = gira + 1; 
		if (gira == 7) {gira = 1;}	
		mostra(gira);
	}	
	

	var timerval;
	timerval = setInterval("troca()",5000);
	

	function timeroff(){
		clearInterval(timerval);
	}
	

	function timeron(){
		clearInterval(timerval);
		timerval = setInterval("troca()",5000);
	} 
	
	function faixa() {
		SHL('faixa','','hide');
	}
	
	
	
	function SHL2() { //v9.0
	  var i,p,v,obj,args=SHL2.arguments;
	  for (i=0; i<(args.length-2); i+=6) 
	  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show2')?'visible':(v=='hide2')?'hidden':v; }
		obj.visibility=v; }
	}
	
	function setClassName2(objId, color) {
			document.getElementById(objId).style.backgroundColor = color;
	}	
	
	function mostra2(bi2) {
		if (bi2 == 21) {SHL2('img_dh21','','show2');SHL2('img_dh22','','hide2');SHL2('img_dh23','','hide2');SHL2('img_dh24','','hide2');SHL2('img_dh25','','hide2');setClassName2('dh21','#526C00');setClassName2('dh22','#79A100');setClassName2('dh23','#79A100');}
		
		if (bi2 == 22) {SHL2('img_dh21','','hide2');SHL2('img_dh22','','show2');SHL2('img_dh23','','hide2');SHL2('img_dh24','','hide2');SHL2('img_dh25','','hide2');setClassName2('dh21','#79A100');setClassName2('dh22','#526C00');setClassName2('dh23','#79A100');}
		
		if (bi2 == 23) {SHL2('img_dh21','','hide2');SHL2('img_dh22','','hide2');SHL2('img_dh23','','show2');SHL2('img_dh24','','hide2');SHL2('img_dh25','','hide2');setClassName2('dh21','#79A100');setClassName2('dh22','#79A100');setClassName2('dh23','#526C00');}
		
	}
	
	var gira2 = 21;
	var trocador2 = 0;
	
	function troca2() {
		gira2 = gira2 + 1; 
		if (gira2 == 24) {gira2 = 21;}	
		mostra2(gira2);
	}
	

	var timerval2;
	timerval2 = setInterval("troca2()",5000);
	

	function timeroff2(){
		clearInterval(timerval2);
	}
	

	function timeron2(){
		clearInterval(timerval2);
		timerval2 = setInterval("troca2()",5000);
	} 
	
	function faixa2() {
		SHL2('faixa2','','hide2');
	}

function $(id){return document.getElementById(id);}
function loadJSON(url) {
	var headID = document.getElementsByTagName("head")[0];         
	var newScript = document.createElement('script');
	newScript.type = 'text/javascript';
	newScript.src = url;
	headID.appendChild(newScript);
}
function utf8_decode(str_data){ 
	var tmp_arr=[],i=0,ac=0,c1=0,c2=0,c3=0;str_data+='';while(i<str_data.length){c1=str_data.charCodeAt(i);if(c1<128){tmp_arr[ac++]=String.fromCharCode(c1);i++;}else if((c1>191)&&(c1<224)){c2=str_data.charCodeAt(i+1);tmp_arr[ac++]=String.fromCharCode(((c1&31)<<6)|(c2&63));i+=2;}else{c2=str_data.charCodeAt(i+1);c3=str_data.charCodeAt(i+2);tmp_arr[ac++]=String.fromCharCode(((c1&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
	return tmp_arr.join('');
}
if(location.href.indexOf('ibest')>-1){
	var _oferURL = "ibest";
}else if(location.href.indexOf('brturbo')>-1){
	var _oferURL = "brturbo";
}else{
	var _oferURL = "homepage";
}
  


   
/////////////////////////////////
// File Name: mBanner.js       //
// By: Manish Kumar Namdeo     //
/////////////////////////////////

// BANNER OBJECT
function Banner(objName){
	this.obj = objName;
	this.aNodes = [];
	this.currentBanner = 0;
	
};

// ADD NEW BANNER
Banner.prototype.add = function(bannerType, bannerPath, bannerDuration, height, width, hyperlink) {
	this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerType, bannerPath, bannerDuration, height, width, hyperlink);
};

// Node object
function Node(name, bannerType, bannerPath, bannerDuration, height, width, hyperlink) {
	this.name = name;
	this.bannerType = bannerType;
	this.bannerPath = bannerPath;
	this.bannerDuration = bannerDuration;
	this.height = height
	this.width = width;
	this.hyperlink= hyperlink;
//	alert (name +"|" + bannerType +"|" + bannerPath +"|" + bannerDuration +"|" + height +"|" + width + "|" + hyperlink);
};

// Outputs the banner to the page
Banner.prototype.toString = function() {
	var str = ""
	for (var iCtr=0; iCtr < this.aNodes.length; iCtr++){
		str = str + '<span name="'+this.aNodes[iCtr].name+'" '
		str = str + 'id="'+this.aNodes[iCtr].name+'" ';
		str = str + 'class="m_banner_hide" ';
		str = str + 'bgcolor="#666" ';	// carregue a cor do banner aqui.
		str = str + 'align="center" ';
		str = str + 'valign="top" >\n';
		if (this.aNodes[iCtr].hyperlink != ""){
			str = str + '<a href="'+this.aNodes[iCtr].hyperlink+'">';
		}
			
		if ( this.aNodes[iCtr].bannerType == "FLASH" ){
			str = str + '<OBJECT '
			str = str + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
			str = str + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '
			str = str + 'WIDTH="'+this.aNodes[iCtr].width+'" '
			str = str + 'HEIGHT="'+this.aNodes[iCtr].height+'" '
			str = str + 'id="bnr_'+this.aNodes[iCtr].name+'" '
			str = str + 'ALIGN="" '
			str = str + 'VIEWASTEXT>'
			str = str + '<PARAM NAME=movie VALUE="'+ this.aNodes[iCtr].bannerPath + '">'
			str = str + '<PARAM NAME=quality VALUE=high>'
			str = str + '<PARAM NAME=bgcolor VALUE="#666">'
			str = str + '<EMBED ';
			str = str + 'src="'+this.aNodes[iCtr].bannerPath+'" '
			str = str + 'quality=high '
			str = str + 'bgcolor="#666"' //no caso de querer que seu
			// banner apresente as cores originais, desabilite esta string.
			str = str + 'WIDTH="'+this.aNodes[iCtr].width+'" '
			str = str + 'HEIGHT="'+this.aNodes[iCtr].height+'" '
			str = str + 'NAME="bnr_'+this.aNodes[iCtr].name+'" '
			str = str + 'ALIGN="center" '
			str = str + 'TYPE="application/x-shockwave-flash" '
			str = str + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
			str = str + '</EMBED>'
			str = str + '</OBJECT>'
		}else if ( this.aNodes[iCtr].bannerType == "IMAGE" ){
			str = str + '<img src="'+this.aNodes[iCtr].bannerPath+'" ';
			str = str + 'border="0" ';
			str = str + 'height="'+this.aNodes[iCtr].height+'" ';
			str = str + 'width="'+this.aNodes[iCtr].width+'">';
		}

		if (this.aNodes[iCtr].hyperlink != ""){
			str = str + '</a>';
		}

		str += '</span>';
	}
	return str;
};

// START THE BANNER ROTATION
Banner.prototype.start = function(){
	this.changeBanner();
	var thisBannerObj = this.obj;
	// CURRENT BANNER IS ALREADY INCREMENTED IN cahngeBanner() FUNCTION
	setTimeout(thisBannerObj+".start()", this.aNodes[this.currentBanner].bannerDuration * 1000);
}

// CHANGE BANNER
Banner.prototype.changeBanner = function(){
	var thisBanner;
	var prevBanner = -1;
	if (this.currentBanner < this.aNodes.length ){
		thisBanner = this.currentBanner;
		if (this.aNodes.length > 1){
			if ( thisBanner > 0 ){
				prevBanner = thisBanner - 1;
			}else{
				prevBanner = this.aNodes.length-1;
			}
		}
		if (this.currentBanner < this.aNodes.length - 1){
			this.currentBanner = this.currentBanner + 1;
		}else{
			this.currentBanner = 0;
		}
	}
	

	if (prevBanner >= 0){
		document.getElementById(this.aNodes[prevBanner].name).className = "m_banner_hide";
	}
	document.getElementById(this.aNodes[thisBanner].name).className = "m_banner_show";
}


// Newsletter.


var http_request = false;var campo;  function newsletter(url, parameters, id_div) {  campo=id_div;http_request = false;     
 if (window.XMLHttpRequest) { // Mozilla, Safari,.
 http_request = new XMLHttpRequest();
  if (http_request.overrideMimeType) {// set type accordinglyto anticipated content type.  
   //http_request.overrideMimeType('text/xml');        
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) 
  {alert('Cannot create XMLHTTP instance'); return false;      }
 http_request.onreadystatechange = alertContents;  
http_request.open( 'POST' , url, true ); 
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);  http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);}

  function alertContents() {     if (http_request.readyState == 4) {  if (http_request.status== 200) {    
//alert(http_request.responseText);
result = http_request.responseText;document.getElementById(campo).innerHTML = result;              } else {      
 } } else {
  document.getElementById(campo).innerHTML = '<br><center><span class=\"nome_enquete_resposta\"> Processando ...</span> </center>'; }}


 function get(id_g,pg) {   var poststr = "nome=" + encodeURI( document.getElementById("nome").value) + "&email=" + encodeURI( 
 document.getElementById("email").value) + "&opcao=" + encodeURI( document.getElementById("opcao").value) ;     
newsletter(pg,poststr,id_g);};

function 
limpar(id_obj){  if(id_obj=='Digite seu nome'){
document.newletter.nome.value = '';
document.newletter.nome.style.color='#333'; }
 if(id_obj=='Digite seu E-mail'){document.newletter.email.value = ''; document.newletter.email.style.color=' #333';}}
 
 function validar(){var nome=document.newletter.nome.value;
 
 var email=document.newletter.email.value;
 
 if(nome.value==""||nome.length<1||nome.value=="Digite seu nome"){document.newletter.nome.focus() ;
	 document.newletter.nome.value = 'Digite seu nome';
	 document.newletter.nome.style.color='#ccc';
	 return false;
	 }
	 
	 if(email.value==""||email.indexOf('@')=="-1"||email.indexOf('.')=="-1"||email.value=="Digite seu E-mail"){
	document.newletter.email.focus();
	 document.newletter.email.value = 'Digite seu E-mail';
	 document.newletter.email.style.color='#ccc';
	 
	 return false;}
	 get('newsletter','newletter/email.php');};  
	 



