function movediv(div)
{
	stereoteca=document.getElementById(div);
	stereoteca.style.top = document.body.scrollTop;
}

function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function abrePopup(pg,nome,w,h){//popUp Unico Central
		var x; 	
		var y;
		x = (screen.width-w)/2;
		y = (screen.height-h)/2;
	    window.open(pg,nome,'scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width='+w+',height='+h+',left='+x+',top='+y+'');
}

/* ----------------------------------------- AGENDA --------------------------------------------- */

function gete(xid) { 
	return document.getElementById(xid); 
}

function abre_xml(link,funcao,extra) {
	var xmlhttp=0; 
	var texto='';
	var erro=false;
	try { 
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	catch (e) { 
		try {
				xmlhttp=new XMLHttpRequest(); 
			}
		catch (e) {
			erro=true;
			alert("Devido a versao do seu browser ser antiga, voce nao conseguirá realizar esta operação");
		} 
	}
	if (!erro) { 
		var rd=new Date();
		xmlhttp.open("GET",link+((link.indexOf('?')>0)?'&':'?')+'rd='+rd.getTime(),true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				var txt=xmlhttp.responseText.replace(/[\r\t\n]/g,'');
				eval(funcao+"('"+txt+((extra!='')?"','"+extra:"")+"')");
			}
		} //function
		xmlhttp.send(null);
	}
}


		var x;
		i=0;
		
		function agenda_retorna(retorno)
		{
			var eventos=retorno.split('<EVENTO>');
			x=new Array(eventos.length-2);
			for (var xc=1;xc<eventos.length;xc++)
			{
				x[xc-1]=new Array(2);
				var alink=eventos[xc].split('<LINK>');
				x[xc-1]=alink;
			}
			display();
		}
		
		function display()
		{
			titulo=x[i][0];
			link=x[i][1];
			txt="<a href=\""+link+"\">"+titulo+"</a>";
			document.getElementById("show").innerHTML=txt;
		}
		
		function next()
		{
			if (i<x.length)
			  {
			  i++;
			  display();
			  }
		}
		function previous()
		{
			if (i>0)
			  {
				  i--;
				  display();
			  }
		}
		function reseta()
		{
			i=0;
			display();
		}
		
		
		
		function envia_newsletter()
		{
			regexp_email=/^[a-z0-9\-](\.?\w)*(\-?\w)*@[a-z0-9\-]+(\.[a-z0-9]+)*(\.[a-z0-9]{2,4})$/i;
			var d=document.newsletter;
			if (!regexp_email.test(d.email.value)) {alert("Por favor, informe um e-mail válido.");d.email.focus();return false;}
			else {
				abre_xml('newsletter.php?email='+d.email.value,'retorna_newsletter','');
				d.email.value='aguarde...';
			}
			return false;
		}
		function retorna_newsletter(retorno)
		{
			if (retorno=='sucesso')
				alert('Seu e-mail foi cadastrado com sucesso.');
			else
				alert(retorno);

			var d=document.newsletter;
			d.email.value='';
		}

				
		function clearInput(e){
		e.value="";
		}
	
/* ---------------------------------------- PARTICIPE --------------------------------------- */
		function valida_post(form){
		
		
		if(form.tempo.value==""){
			alert("Por favor, responda a pergunta de número 1.");
			form.tempo.focus();
			return false;
		}
		
		if(form.show.value==""){
			alert("Por favor, responda a pergunta de número 2.");
			form.show.focus();
			return false;
		}
		
		
		if(form.arte1.checked==false && form.arte2.checked==false && form.arte3.checked==false){
			alert("Por favor, responda a pergunta de número 3.");
			
			return false;
		}
		
		
		if(form.artistas.value==""){
			alert("Por favor, responda a pergunta de número 4.");
			form.artistas.focus();
			return false;
		}
		if(form.palco.value==""){
			alert("Por favor, responda a pergunta de número 5.");
			form.palco.focus();
			return false;
		}
		
		if(form.segmento.value=="Selecione o seguimento"){
			alert("Por favor, escolha um segmento.");
			form.segmento.focus();
			return false;
		}
		
		if(form.artistasegmento.value==""){
			alert("Por favor, reponda qual artista você gostaria de ver em determinado segmento.");
			form.artistasegmento.focus();
			return false;
		}
		
		if(form.nome.value==""){
			alert("Por favor, preencha seu nome.");
			form.nome.focus();
			return false;
		}
		
		if(form.email.value==""){
			alert("Por favor, preencha seu email.");
			form.email.focus();
			return false;
		}
		
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!(filter.test(form.email.value))) {
			 alert("Por favor, preencha um email válido.");
			 form.email.focus();
			 return false;
		}
		
		
		return true;
	}
	
	function marca1(){
	document.getElementById("arte2").checked=false;
	document.getElementById("arte3").checked=false;	
	}
	function marca2(){
	document.getElementById("arte1").checked=false;
	document.getElementById("arte3").checked=false;	
	}
	function marca3(){
	document.getElementById("arte1").checked=false;
	document.getElementById("arte2").checked=false;	
	}
/*
	GALERIAS DE FOTOS
*/
function troca_foto(img,leg)
{
	$("#foto_grande").fadeTo('slow',0.05,function () {document.getElementById('foto_grande').innerHTML="<img src='../"+img+"' onload='$(\"#foto_grande\").fadeTo(\"slow\",1);' />"; } );
	document.getElementById('legenda').innerHTML="<p>"+leg+"</p>";
}
function monta_fotos(posx)
{
	var cont=1;
	var time=400;
	var posmaior=0;
	if ((pos_inicial+3)>afotos.length)
		posmaior=afotos.length;
	else
		posmaior=(pos_inicial+3);
		
	cont=posx+cont;

/*	for (var xc=pos_inicial;xc<posmaior;xc++)
	{ */
//		alert($("#foto"+cont).html());
		var xc=posx+pos_inicial;
		$("#foto"+cont).fadeTo(time,0.5);
		
		window.setTimeout('monta_suporte('+cont+','+time+','+xc+','+posmaior+')', (time+50));
		if (cont<posmaior)
			window.setTimeout('monta_fotos('+cont+')',(time*0.6));
/*	} */
}
function monta_suporte(cont,time,xc,posmaior)
{
	gete('foto'+cont).innerHTML='<a href="javascript:void(0)" onclick="troca_foto(\''+afotos[xc][0]+'\',\''+afotos[xc][2]+'\');"><img src="../'+afotos[xc][1]+'" width="130" height="98" /></a>'; 
	$("#foto"+cont).fadeTo(time,1);
}
function foto_anterior()
{
	if (pos_inicial>0)
	{
		pos_inicial--;
		monta_fotos(0);
	}
}
function foto_proxima()
{
	if ((pos_inicial+3)<afotos.length)
	{
		pos_inicial++;
		monta_fotos(0);
	}
}
function pre_loader()
{
	if (afotos.length>3)
	{
		var image1=new Image();
		var image2=new Image();
		for (var xc=3;xc<afotos.length;xc++)
		{
			image1.src=afotos[xc][0];
			image2.src=afotos[xc][1];
		}
	}
}