function popupArtistas()
{
	var dialog = new Boxy('<p class="titulogranderojo" style="display:block;width:350px;text-align:center;">Pr&oacute;ximamente disponible</p>',{ title: 'Portafolio de artistas', modal:true,unloadOnHide:true});
	return false;
}

function enviarEvento()
{
	var errorVal = 0;
	var imagenP = $('#archivos').val()
	var nombreEvento = $('#nombreEvento').val()
	var fechaEvento = $('#fechaEvento').val()
	var lugarEvento = $('#lugarEvento').val()
	var detallesEvento = $('#detallesEvento').val()
	var emailEvento = $('#emailEvento').val()
	var nombreEncargado = $('#nombreEncargado').val()
	
	if(nombreEvento=="" || fechaEvento=="" || lugarEvento=="" || imagenP=="" || emailEvento=="" || nombreEncargado==""){
		errorVal = 1;
	}
	if(errorVal==0)
	{
		$("#mensajeEvento").html('<span class="info">Enviando... un momento por favor').show().fadeOut(7000);
		return true;
	}
	else
	{
		 $("#mensajeEvento").html('<span class="error">Verifique los campos marcados con asterisco</span>').show().fadeOut(7000);
		return false;
	}
	
}

function enviarComentario()
{
	$("#mensajeFormComment").hide().fadeOut(1000);
	var errorVal = 0;
	var nombreComment = $('#nombreComment').val()
	var emailComment = $('#emailComment').val()
	var mensaje = $('#mensaje').val()
	
	if(nombreComment=="" || emailComment=="" || mensaje==""){
		errorVal = 1;
	}
	if(errorVal==0)
	{
		$("#mensajeFormComment").html('<span class="info">Enviando... un momento por favor').show().fadeOut(7000);
		return true;
	}
	else
	{
		$("#mensajeFormComment").html('<span class="error">Verifique los campos marcados con asterisco</span>').show().fadeOut(7000);
		return false;
	}
	
}
function validarEmail(valor) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3,4})+$/.test(valor)){
		return true;
	} else {
		return false;
	}
}
// Galeria
var slideshowSpeed = 7000;
$(document).ready(function() {
		
	/*
	// Backwards navigation
	$("#back").click(function() {
		stopAnimation();
		navigate("back");
	});
	
	// Forward navigation
	$("#next").click(function() {
		stopAnimation();
		navigate("next");
	});
	
	var interval;
	$("#control").toggle(function(){
		stopAnimation();
	}, function() {
		// Change the background image to "pause"
		$(this).css({ "background-image" : "url(images/btn_pause.png)" });
		
		// Show the next image
		navigate("next");
		
		// Start playing the animation
		interval = setInterval(function() {
			navigate("next");
		}, slideshowSpeed);
	});
	
	*/
	var activeContainer = 1;	
	var currentImg = 0;
	var animating = false;
	var navigate = function(direction) {
		// Check if no animation is running. If it is, prevent the action
		if(animating) {
			return;
		}
		
		// Check which current image we need to show
		if(direction == "next") {
			currentImg++;
			if(currentImg == photos.length + 1) {
				currentImg = 1;
			}
		} else {
			currentImg--;
			if(currentImg == 0) {
				currentImg = photos.length;
			}
		}
		
		// Check which container we need to use
		var currentContainer = activeContainer;
		if(activeContainer == 1) {
			activeContainer = 2;
		} else {
			activeContainer = 1;
		}
		
		showImage(photos[currentImg - 1], currentContainer, activeContainer);
		
	};
	
	var currentZindex = -1;
	var showImage = function(photoObject, currentContainer, activeContainer) {
		animating = true;
		
		$("#headerimg" + activeContainer).css({
			 "background-image" : "url('" + photoObject.image + "')",
			"display" : "block",
			"cursor": "pointer",
			"z-index" : currentZindex
		});
		
		// Hide the header text
		$("#headertxt").css({"display" : "none"});
		
		// Set the new header text
		//$("#firstline").html(photoObject.firstline);
		//$("#secondline")
		//	.attr("href", photoObject.url)
		//	.html(photoObject.secondline);
		$("#pictureduri")
			.attr("href", photoObject.url)
			.html(photoObject.title);
		$("#pictureduri").css({"display" : "block","height":"310px","text-indent":"-9999px"});
		
		// Fade out the current container
		// and display the header text when animation is complete
		$("#headerimg" + currentContainer).fadeOut(function() {
			setTimeout(function() {
				$("#headertxt").css({"display" : "block"});
				//$("#headertxt" ).show('slide','','700');
				animating = false;
			}, 500);
		});
	};
	
	var stopAnimation = function() {
		// Change the background image to "play"
		//$("#control").css({ "background-image" : "url(images/btn_play.png)" });
		
		// Clear the interval
		clearInterval(interval);
	};
	
	// We should statically set the first image
	navigate("next");
	
	// Start playing the animation
	interval = setInterval(function() {
		navigate("next");
	}, slideshowSpeed);
	
});

window.google_analytics_uacct = "UA-3907660-2";
