// JavaScript Document
	function callFlash(_path,_w,_h){
		var flash = "";		
		flash = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + _w + "' height='" + _h + "'>";
		flash += "<param name='movie' value='" + _path + "' />";
		flash += "<param name='quality' value='high' />";
		flash += "<param name='wmode' value='transparent' />";
		flash += "<embed src='" + _path + "' quality='high' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + _w + "' height='" + _h + "'></embed>";
		flash += "</object>";		
		document.write(flash);		
	}

	function popup(_url,_w,_h,_left,_top) {
		window.open(_url,'', 'width='+_w+', height='+_h+', top='+_top+', left='+_left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}
	
	function newWindow(_id){
		mywindow = window.open ('../popup/popup.asp?id='+_id+'','mywindow','location=0,status=1,scrollbars=0,toolbar=0,menubar=0,width=366,height=461');
	}
	
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
	
	function ampliarImagem(n) {
		URL = "../zoom/zoom.asp?img="+n;
	
	   var width = 200;
	   var height = 200;
	
	   var left = 120;
	   var top = 120;
	
	   window.open(URL,'Zoom','top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=yes, fullscreen=no');
	}
	
	function font(b){
			
			var size = document.getElementById("conteudoNoticia").style.fontSize.replace("px","");
			
			if (b == "+"){
				if(size < 16)
					size ++;
			}else{
				if(size > 10)
					size --;
			}
						
			document.getElementById("conteudoNoticia").style.fontSize = size + "px";
	}
	
	function font2(b){
			
			var size = document.getElementById("conteudoNoticia2").style.fontSize.replace("px","");
			
				
			if (b == "+"){
				if(size < 16)
					size ++;
			}else{
				if(size > 10)
					size --;
			}
						
			document.getElementById("conteudoNoticia2").style.fontSize = size + "px";
	}

	function aNoticia(n){
		
		document.getElementById("tableRegional").style.display = "none";
		document.getElementById("tableParana").style.display = "none";
		document.getElementById("tableBrasil").style.display = "none";
		document.getElementById("tableMundo").style.display = "none";
		
		document.getElementById("btnRegionalIn").style.display = "none";
		document.getElementById("btnParanaIn").style.display = "none";
		document.getElementById("btnBrasilIn").style.display = "none";
		document.getElementById("btnMundoIn").style.display = "none";
		
		document.getElementById("btnRegionalOut").style.display = "block";
		document.getElementById("btnParanaOut").style.display = "block";
		document.getElementById("btnBrasilOut").style.display = "block";
		document.getElementById("btnMundoOut").style.display = "block";

		
		switch(n){
			case 1:
				document.getElementById("tableRegional").style.display = "block";
				document.getElementById("btnRegionalIn").style.display = "block";
				document.getElementById("btnRegionalOut").style.display = "none";

				break;
			case 2:
				document.getElementById("tableParana").style.display = "block";
				document.getElementById("btnParanaIn").style.display = "block";
				document.getElementById("btnParanaOut").style.display = "none";

				break;
			case 3:
				document.getElementById("tableBrasil").style.display = "block";
				document.getElementById("btnBrasilIn").style.display = "block";
				document.getElementById("btnBrasilOut").style.display = "none";

				break;
			case 4:
				document.getElementById("tableMundo").style.display = "block";
				document.getElementById("btnMundoIn").style.display = "block";
				document.getElementById("btnMundoOut").style.display = "none";

				break;
		}
	}
	
	function M(){
		try { xmlhttp = new XMLHttpRequest(); } 
		catch(e) { 	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } 
				catch(ee){	try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} 
							catch(E){xmlhttp = false;}
							}
				} return xmlhttp;
	}
	
	function loadSplash(_path,_width,_height,_top,_left,_url,_acesse){
		
		var msg = document.createElement("div");
		msg.style.width = "" + _width + "";
		
		var corpo =  "<div style='width:" + _width + "; height: " + _height + "' id='msgInst'>";
		
		var exte = _path.substring(_path.lastIndexOf('.')+1).toLowerCase();
		if(exte=="swf"){
			corpo = corpo +  "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + _width + "' height='" + _height + "'>" +
						"<param name='movie' value='" + _path + "' />" +
						"<param name='quality' value='high' />" +
						"<param name='wmode' value='transparent' />" +
						"<embed src='" + _path + "' quality='high' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + _width + "' height='" + _height + "'></embed>" +
						"</object></div>";
		}else{
			
			var Banner = "";
						
			if (_url != ""){
				if(_acesse.toString() == "1"){
					Banner = "<a href='#' onclick='MM_openBrWindow('" + _url + "','','width=600,height=568')'><img src='" + _path + "' width='" + _width + "' height='" + _height + "' border='0' /></a>";
				}else{
					Banner = "<a href='" + _url + "' target='_blank'><img src='" + _path + "' width='" + _width + "' height='" + _height + "' border='0' /></a>";
				}
			}else{
				Banner = " <img src='" + _path + "' width='" + _width + "' height='" + _height + "' border='0' />" ;
			}
			
			corpo = corpo + Banner + "</div>";
		
		}
		
		msg.innerHTML = corpo;
		msg.style.position = "absolute";
		msg.style.top = _top;
		msg.style.left = _left;
		msg.style.backgroundColor = "transparent";
		msg.style.zIndex = 1000;
		msg.style.cursor = "pointer";
		msg.id = "msgInst";
				
		document.body.appendChild(msg);
	}
	
	
	function loadPopup(_width,_height,_top,_left){
		window.open("../popup/popup.asp",'PopUp', 'width='+_width+', height='+_height+', top='+_top+', left='+_left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}
	
	function closeSplash(){
		var msginst = document.getElementById('msgInst');		
		if(msginst) msginst.parentNode.removeChild(msginst);
	}
	
	function Submit(_p,_u, _obj, _msg){
			
			var _params = _p;
			var ajax = M();
			if (ajax){
				ajax.open("POST",_u + ".asp",true);
				ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
				ajax.onreadystatechange = function(){
					
					if (ajax.readyState==4){
						if (ajax.status == 200){
							var temp = ajax.responseText.replace(/\+/g," ");
							if(temp == "true"){
								_obj.innerHTML = _msg;
							}else{
								alert(temp);
							}
								
						}
					}
				}
				ajax.send(_params)
			}else return false;	
					
		}
	
	var Enquete = {
	
		Voto: function(){	
						var opts = document.getElementsByName("Resposta");
						var option = "";							
						for (var i=0;i<opts.length;i++){
							if(opts.item(i).checked)
								option = opts.item(i).value;
						}
						
						if (option != ""){
							var motor = M();
							if (motor){
								motor.open("GET","../includes/exec_enquete.asp?option=" + option,true);
								motor.onreadystatechange = function(){
									if(motor.readyState == 4){
										var text = motor.responseText.replace(/\+/g," ");								
										//document.getElementById(obj).innerHTML = text;	
										
										if (text == 0){
											alert("Enquete não encontrada!");
										}else if(text == 2){
											alert("Seu voto já foi computado!")
										}else{										
											document.getElementById("tdResultado").innerHTML = text;
											document.getElementById("tdResultado").style.display = "";
											document.getElementById("tdEnquete").style.display = "none";
											
											document.getElementById("tdEnqueteOption").style.display = "none";
											document.getElementById("tdEnqueteVoltar").style.display = "none";
										}
									}
								}
								motor.send(null);
							}else return;
						}
						
												
						
				
		},
		Parcial: function(){
				document.getElementById("tdResultado").style.display = "";
				document.getElementById("tdEnquete").style.display = "none";
				document.getElementById("tdEnqueteOption").style.display = "none";
				document.getElementById("tdEnqueteVoltar").style.display = "";
		},
		Voltar: function(){
				document.getElementById("tdResultado").style.display = "none";
				document.getElementById("tdEnquete").style.display = "";
				document.getElementById("tdEnqueteOption").style.display = "";
				document.getElementById("tdEnqueteVoltar").style.display = "none";
		}
	}
	
	
	var delayPromocoes = null;
	var AutodelayPromocoes = null;

	var Promocoes = {		
	
		e : function(_e){
			return document.getElementById(_e);
		},
		control : 0,
		right: function(){				
				if(nrseqPromocoes.length > 1){
					this.control ++;										
					if(this.control > nrseqPromocoes.length - 1) this.control = 0;						
					ctrlA = (this.control == 0) ? nrseqPromocoes.length - 1 : this.control - 1 ;	
					ctrlB = this.control ;									
									
					this.clear();
					this.fedding(this.e(nrseqPromocoes[ctrlA]),this.e(nrseqPromocoes[ctrlB]),0,"-");
				}
		},			
		select : function(s){
				ctrlA = this.control;				
				this.control = s;
				ctrlB = this.control;
				this.clear();
				this.fedding(this.e(nrseqPromocoes[ctrlA]),this.e(nrseqPromocoes[ctrlB]),0,"-");								
		},	
		clear : function(){
				clearTimeout(delayPromocoes);
				for(i = 0; i < nrseqPromocoes.length; i++){
					this.e(nrseqPromocoes[i]).style.display = "none";
				}
				this.autoPlay();
		},
		o: 0,
		fedding : function(a,b,o,k){				
				this.o = parseInt(o) + 1;
				if(this.o <= 100) {						
									
					a.style.display = "";
					a.style.zIndex = (k == "+") ? 1 : 0;				
					b.style.display = "";					
					b.style.zIndex = (k == "+") ? 0 : 1;
								
					a.style.filter = "alpha(opacity=" + (100 - this.o) + ")";
					b.style.filter = "alpha(opacity=" + o + ")";						
				
					a.style.MozOpacity = (100 - this.o/101);
					b.style.MozOpacity = (this.o/101);
					
					a.style.opacity = (100 - this.o/101);
					b.style.opacity = (this.o/101);
					
					a.style.KhtmlOpacity = (100 - this.o/101);
					b.style.KhtmlOpacity=(parseInt(this.o)/101);
					
					delayPromocoes = setTimeout(function(){ Promocoes.fedding(a, b, Promocoes.o, Promocoes.increment) }, this.o * 0.3);
				}																
		},
		start : function(){				
				this.clear();
				this.e(nrseqPromocoes[0]).style.display = "";
		},
		autoPlay : function(){
			clearTimeout(AutodelayPromocoes);
			if(nrseqPromocoes.length > 1) AutodelayPromocoes = setTimeout(function(){Promocoes.right();},5000);
		}
	}