// JavaScript Document
$(document).ready(
	function(){
	// Todas os links que contêm a classe urlfn abrem em nova janela		
		$("a[@class*=urlfn]").attr("target", "_blank");	 
		$('.imageeventos').cycle({
			 next: '.next',
			 prev: '.previous',
			 easing: 'bouncein',
			 speed:  800,			 
			 timeout:  3000,
			 fx: 'fade'
		});
	}
);


// JavaScript Document


function MM_validateForm() {
//  ---------------------------------------
	if (document.getElementById) {
		var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
		firstField = new Array();
		for (i=0; i<(args.length-2); i+=4) {
			test=args[i+2];
			label = args[i+3];
			val=document.getElementById(args[i]);
			if (val) {
				nm=val.name;
				elInput = val;
				elInput.className = "";
				if ((val=val.value)!="") {
					if (test.indexOf('isEmail')!=-1) {
						p=val.indexOf('@');
						if (p<1 || p==(val.length-1)) {
							errors+='- '+label+' inválido.\n';
							elInput.className = "campoErrado";
							firstField.push(elInput);
						}
					} else if (test!='R') {
						num = parseFloat(val);
						if (isNaN(val)) {
							errors+='- '+label+' deve ser um número válido.\n';
							elInput.className = "campoErrado";
							firstField.push(elInput);
						}
						if (test.indexOf('inRange') != -1) {
							p=test.indexOf(':');
							min=test.substring(8,p);
							max=test.substring(p+1);
							if (num<min || max<num) {
								errors+='- '+label+' deve ser um número entre '+min+' e '+max+'.\n';
								elInput.className = "campoErrado";
								firstField.push(elInput);
							}
						}
					}
				} else if (test.charAt(0) == 'R') {
					errors += '- '+label+' é obrigatório.\n';
					elInput.className = "campoErrado";
					firstField.push(elInput);
				}
			}
		}
		if (errors) {
			alert('Os seguintes erros ocorreram:\n'+errors);
			firstField[0].focus();
		}
		document.MM_returnValue = (errors == '');
	}
}
function addFriend(){
	var fieldsetIndicados = document.getElementById("fieldsetIndicados");
	var campos = fieldsetIndicados.getElementsByTagName("dd");
	var num_campos = campos.length/2;
	var mydl = fieldsetIndicados.getElementsByTagName("dl");
	var dlContent = mydl[0].innerHTML;
	var newdlContent = '<dt><label for="nomeAmigo['+ num_campos +']">Nome do '+ (num_campos + 1) +'<sup>o</sup> indicado:</label></dt>';
	newdlContent += '<dd><input type="text" name="nomeAmigo['+ num_campos +']" id="nomeAmigo['+ num_campos +']" maxlength="50" size="50" title="requerido" /></dd>';
	newdlContent += '<dt><label for="emailAmigo['+ num_campos +']">E-mail do '+ (num_campos + 1) +'<sup>o</sup> indicado:</label></dt>';
	newdlContent += '<dd><input type="text" name="emailAmigo['+ num_campos +']" id="emailAmigo['+ num_campos +']" maxlength="50" size="50"  /></dd>';
	mydl[0].innerHTML = dlContent + newdlContent;
	//alert(mydl[0].innerHTML);
	
}
//AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','name','bg','width','1280','height','1146','id','bg','src','img/swf/bg','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','img/swf/bg','fundo' ); //end AC code
