// JavaScript Document
    
function Slideshow(slideshow, timeout) {
  this.slides = [];
  var nl = $(slideshow).getElementsByTagName('div');
  for (var i = 0; i < nl.length; i++) {
    if (Element.hasClassName(nl[i], 'slide')) {
      this.slides.push(nl[i]);
    }
  }
  this.timeout = timeout;
  this.current = 0;

  for (var i = 0; i < this.slides.length; i++) {
    this.slides[i].style.zIndex = this.slides.length - i;
  }

  Element.show(slideshow);
  setTimeout((function(){this.next();}).bind(this), this.timeout + 850);
}
Slideshow.prototype = {
  next: function() {
    for (var i = 0; i < this.slides.length; i++) {
      var slide = this.slides[(this.current + i) % this.slides.length];
      slide.style.zIndex = this.slides.length - i;
    }

    Effect.Fade(this.slides[this.current], {
      afterFinish: function(effect) {
        effect.element.style.zIndex = 0;
        Element.show(effect.element);
        Element.setOpacity(effect.element, 1);
      }
    });
    
    this.current = (this.current + 1) % this.slides.length;
    setTimeout((function(){this.next();}).bind(this), this.timeout + 850);
  }
}


 // builds the url ;
 function js_changePage(theNowUrl, theValue)
 {

	var newUrl =theNowUrl + theValue;
	window.location = newUrl;
 }

function js_validarDadosFormCadastro()
{
	
	if($('tx_nome').value=="") {alert('O campo Nome deve ser preenchido.'); $('tx_nome').focus(); return false;}
	if($('tx_email').value=="") {alert('O campo E-mail deve ser preenchido.'); $('tx_email').focus(); return false;}
	if($('tx_remail').value=="") {alert('Por favor, redigite o seu e-mail.'); $('tx_remail').focus(); return false;}
	if($('tx_email').value!=$('tx_remail').value) {alert('Os e-mails não conferem, houve algum erro de digitação.\nPor favor digite novamente o seu e-mail.'); $('tx_email').value=""; $('tx_remail').value=""; $('tx_email').focus(); return false;}
	
	if($('tx_email').value!=$('tx_email').value) {alert('O campo E-mail deve ser preenchido.'); return false;}
	
	//alert("Passei aqui!");
		if (($('tx_email').value.indexOf('@',0)== -1) || 
			($('tx_email').value.indexOf('.',0)== -1))
		{
			alert("Por favor, digite um e-mail válido.");
$('tx_email').focus();

			return false;
		}
	
	
	if((!$('rd_mas').checked) && (!$('rd_fem').checked) ) {alert('Por favor, selecione o sexo.'); $('rd_mas').focus(); return false;}
	
	
	if(($('sl_ano').value=="") || ($('sl_mes').value=="") || ($('sl_dia').value=="")) 
	{
		alert('Selecione sua data de nascimento.'); 
		
		if($('sl_dia').value=="") {$('sl_dia').focus(); return false;}
		if($('sl_mes').value=="") {$('sl_mes').focus(); return false;}
		if($('sl_ano').value=="") {$('sl_ano').focus(); return false;}
		
	}
	
	if($('tx_cidade').value=="") {alert('Por favor, digite a sua cidade.'); $('tx_cidade').focus(); return false;}
	
	//if($('sl_tipo').value=="") {alert('Por favor, selecione uma das opções de classificação.'); $('sl_tipo').focus(); return false;}

	if($('tx_senha').value=="") {alert('Por favor, digite uma senha.'); $('tx_senha').focus(); return false;}
	
	
	return true;

}


function js_validarDadosFormEvento()
{
	if($('tx_nome').value=="") {alert('Por favor, informe o nome do evento.'); $('tx_nome').focus(); return false;}
	if($('tx_local').value=="") {alert('Por favor, informe o local do evento.'); $('tx_local').focus(); return false;}
	if($('tx_cidade').value=="") {alert('Por favor, informe a cidade do evento.'); $('tx_cidade').focus(); return false;}
	if($('tx_promoter').value=="") {alert('Por favor, indique uma pessoa da produção do evento.'); $('tx_promoter').focus(); return false;}
	if($('tx_telefone').value=="") {alert('Por favor, informe um telefone para contato.'); $('tx_telefone').focus(); return false;}
	if($('tx_email').value=="") {alert('Por favor, informe um email para contato.'); $('tx_email').focus(); return false;}

	if (($('tx_email').value.indexOf('@',0)== -1) || 
		($('tx_email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
$('tx_email').focus();
		return false;
	}

	if(($('sl_ano').value=="") || ($('sl_mes').value=="") || ($('sl_dia').value=="")) 
	{
		alert('Por favor, informe a data do evento.'); 
		
		if($('sl_dia').value=="") {$('sl_dia').focus(); return false;}
		if($('sl_mes').value=="") {$('sl_mes').focus(); return false;}
		if($('sl_ano').value=="") {$('sl_ano').focus(); return false;}
		
	}
	
	
	return true;

}

function js_validarDadosFormProposta()
{

	if($('tx_nome').value=="") {alert('Por favor, informe seu nome ou o nome da empresa.'); $('tx_nome').focus(); return false;}
	if($('tx_telefone').value=="") {alert('Por favor, informe um telefone para contato.'); $('tx_telefone').focus(); return false;}
	if($('tx_email').value=="") {alert('Por favor, informe um email para contato.'); $('tx_email').focus(); return false;}

	if (($('tx_email').value.indexOf('@',0)== -1) || 
		($('tx_email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		$('tx_email').focus();
		return false;
	}



}

function js_validarDadosFormContato()
{
	if($('tx_nome').value=="") {alert('Por favor, todos os campos devem ser preenchidos.'); $('tx_nome').focus(); return false;}
	if($('tx_assunto').value=="") {alert('Por favor, todos os campos devem ser preenchidos.'); $('tx_assunto').focus(); return false;}
	if($('tx_email').value=="") {alert('Por favor, todos os campos devem ser preenchidos.'); $('tx_email').focus(); return false;}
	if($('ta_mensagem').value=="") {alert('Por favor, todos os campos devem ser preenchidos.'); $('ta_mensagem').focus(); return false;}

	if (($('tx_email').value.indexOf('@',0)== -1) || 
		($('tx_email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		$('tx_email').focus();
		return false;
	}


}

function loadPlayer()
{ 
window.open('player/player.php','pop','width=190px,height=75px,top=0, left=0, scrollbars=no');
}

function js_adEffect(totalAds)
{
	setInterval("ShowEffect('" + totalAds + "')", 2800);
	
}

function ShowEffect(totalAds){
	//alert(totalAds)
	var rand = "ad_" + Math.floor(Math.random()*(parseInt(totalAds))); 
	var element = $(rand).id;
       new Effect.Appear(element, 
       {duration:1, from:0.1, to:1.0});
   }

function changeTitle(title) { document.title = title; }

