// JavaScript Document

$(document).ready(function() {
	
	$('#slide ul')
	.cycle({ 
		fx:     'fade', 
		speed:  'slow', 
		timeout: 3000, 
		next:   '#next', 
		prev:   '#prev'
	});	
	
	$(".show_webcam[rel=example_group]").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
	
	/* InicializaciÃ³n en espaÃ±ol para la extensiÃ³n 'UI date picker' para jQuery. */
	/* Traducido por Vester (xvester@gmail.com). */
	jQuery(function($){
		$.datepicker.regional['es'] = {
			closeText: 'Cerrar',
			prevText: '&#x3c;Ant',
			nextText: 'Sig&#x3e;',
			currentText: 'Hoy',
			monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
			'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
			monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
			'Jul','Ago','Sep','Oct','Nov','Dic'],
			dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
			dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
			dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
			weekHeader: 'Sm',
			dateFormat: 'dd/mm/yy',
			firstDay: 1,
			isRTL: false,
			showMonthAfterYear: false,
			yearSuffix: ''};
		$.datepicker.setDefaults($.datepicker.regional['es']);
	});
	
	$(".datepicker").datepicker();		
	
	$(".ampliar").bind("change",function(){
		if (($(this).is(':checked'))){
			$(this).parent().parent().next().css('display','block');
		} else {
			$(this).parent().parent().next().css('display','none');
			}
		});
	
	$("#paso1").click(function() {
	
		var ID = $('#ID').val();
		var nombre = $('#nombre').val();
		var apellidos = $('#apellidos').val();
		var mail = $('#email').val();
		var telefono = $('#telefono').val();

		
		if (nombre == "") {
			
			$('#nombre').css("color","red");
			$('#nombre').attr('value', 'Indique un Nombre');
			return false;
			
		} else if (apellidos == "") {
			
			$('#apellidos').css("color","red");
			$('#apellidos').attr('value', 'Indique su apellido');
			return false;
			
		} else if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
			
			$('#email').css("color","red");
			$('#email').attr('value', 'Indique un E-mail');
			return false;
		
		} else if (telefono == "") {
			
			$('#telefono').css("color","red");
			$('#telefono').attr('value', 'Indique un TLF');
			return false;
		}
		
	  	$(".step_one div.step_cont").css('display','none');
	  	$(".step_two div.step_cont").css('display','block');
		$(".step_one span").addClass("check");
	  	$(".step_two span").addClass("active");
	});
	
	$("#paso2").click(function() {
	  $(".step_two div.step_cont").css('display','none');
	  $(".step_three div.step_cont").css('display','block');
	  $(".step_two span").removeClass("active");
	  $(".step_two span").addClass("check");
	  $(".step_three span").addClass("active");
	});
	
	$("#volverpaso1").click(function() {
	   $(".step_one div.step_cont").css('display','block');
	   $(".step_two div.step_cont").css('display','none');
	  $(".step_two div.step_cont").css('display','none');
	  $(".step_two span").removeClass("active");
	  $(".step_one span").removeClass("check");
	  $(".step_one span").addClass("active");
	});
	$("#volverpaso2").click(function() {
	   $(".step_two div.step_cont").css('display','block');
	   $(".step_three div.step_cont").css('display','none');
	  $(".step_threee div.step_cont").css('display','none');
	  $(".step_three span").removeClass("active");
	  $(".step_two span").removeClass("check");
	  $(".step_two span").addClass("active");
	});

	
		
});

function positionFlashOver() {
   //alert("This function was successfully triggered via the flash movie.");
   $('.estado-right').css("z-index",1000);
	}
	
	function positionFlashOut() {
   //alert("This function was successfully triggered via the flash movie.");
   $('.estado-right').css("z-index",0);
	}/**/
