// Definimos variables globales.
var DOMAIN = "http://" + String(window.location).split("://")[1].split("/")[0];
var temp;

// ONLOAD
$(document).ready(function (){

// CREACION DE EVENTOS.

	// Validar envio de formulario.
	$("#submit_envio_formulario").click(function() {
		Valida();
		return false;
	});
	
	// Cambio de pestanas dentro de las fichas de curso
	if ( !$.browser.msie || ( parseInt($.browser.version) >= 7 )  ){
		$("#pestanas > li > a").click(function(){
			var all_a = $(this).parent().parent().find("a");
			all_a.attr("class","");
			$(this).attr("class","selected");
			temp = $( $(this).attr("href") );
			$("#objetivos,#dirigido,#metodo,#programa,#campusv,#extra").fadeOut( 500 );
			setTimeout(function() {	temp.fadeIn("fast"); },500);
			return false;						  
		});
	}else{
		$("#pestanas > li > a").click(function(){
			var all_a = $(this).parent().parent().find("a");
			all_a.attr("class","");
			$(this).attr("class","selected");
			$("#objetivos,#dirigido,#metodo,#programa,#campusv,#extra").hide();
			$( $(this).attr("href") ).show();
			return false;						  
		});
	}
	$(".openInNewWindow").click(function () {
		thelink = $(this).attr("href");
		window.open( thelink, "_aviso" , 'width=600,height=540,top=0,left=0' );
		return false;							  
	});
}); // Fin de document.ready


function gravar_estara(fechacupon,campanya,cursos,nombre,apellidos,telefono,telefono2,email,estado){
	var sURL='estara.asp?ajax=true';
	jQuery.post( sURL, {
		fechacupon :  fechacupon,
		cursos : cursos,
		nombre : nombre,
		apellidos : apellidos,
		telefono : telefono,
		telefono2 : telefono2,
		email : email,
		campanya : campanya,
		estado : 0
	} , function (data) {
		$("#result").html(data);
	});
}
