
function $id(_id){
	return document.getElementById(_id)	
}
function startAjax(){
	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;
}


var pos = 0;
var x = 0;

function loadBanner(){			// BANNER GRANDE ROTATIVO	
	var xhr = startAjax();
	var url = "../includes/inc_bannergrande.asp";
	xhr.open("GET",url,true)
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4){
			if(xhr.status == 200){
				var conteudo = xhr.responseText;
				var banner = new Array();
				conteudo = conteudo.split("|")
				for (i = 0; i < (conteudo.length - 1); i++) {
				    banner.push(conteudo[i])
				}
				teste(banner);
			} 
		}
	}
	xhr.send(null);
}
setTimeout("loadBanner()",1000);

function teste(banner) {
    pos = banner.length;
	$id("bannerCentro").innerHTML = banner[x];
	x++;
	if (x==pos){
		x = 0;
	}
	window.setTimeout(function(){teste(banner);},7000);	
}



function popup(_url,_w,_h,_left,_top) {
   window.open(_url,'', 'width='+_w+', height='+_h+', top='+_top+', left='+_left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function popup2(_url,_w,_h,_left,_top) {
   window.open(_url,'RadioOnline', 'width='+_w+', height='+_h+', top='+_top+', left='+_left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

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 openEnquete(st){
	if(st==1){
		var valida = false;
		var valor
		var el = document.getElementsByTagName("input") // Selecionando todos os inputs ta pagina
			
		for(i=0; i < el.length; i++){		
			if(el[i].className == "validaenquete"){		// Percorrendo todos os inputs e procurando os que tem a classe validaenquete
				if(el[i].checked==true){		// verifica se esses inputs (radios) estão checados
					valor = el[i].value;		
					valida = true;				// se algum estiver retorna true
				}
			}
		}
		
		if (valida!=true){
			alert("Vote em alguma resposta.")
			return false;
		}else{
			var id_per = document.getElementById("id_perguntaEnquete").value;
			window.open("../includes/resultado_enquete.asp?id_pergunta="+id_per+"&id_resposta="+valor,'', 'width=350, height=400, top=250, left=250, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
		}

	} else {
		var id_per = document.getElementById("id_perguntaEnquete").value;
		window.open("../includes/resultado_enquete.asp?id_pergunta="+id_per, '', 'width=350, height=400, top=250, left=250, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}
   return false;
}

function indique(){
	var email = document.getElementById("txtIndiqueAmigo");
	
	if (email.value.length < 3 || email.value.indexOf("@")==-1 || email.value.indexOf(".")== -1 ){
		alert("Informe um email válido")
		email.focus();
		return false;
	} else {
		window.open("../indique/default.asp?email="+email.value,'', 'width=270, height=380, top=250, left=250, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}
		return false;
}


function abrirPop() {

    window.open('../player/default3.asp', 'popup2', 'width=580,height=180', 'true');
}

function abrirPop2() {

    window.open('../player/default4.asp', 'popup2', 'width=580,height=180', 'true');
}