// JavaScript Document
$(document).bind("ready",function(){

	$("a","#close").bind("click",function(){
		$("#capa_registro").fadeOut("slow");
		$().wkVeloHide();
	
	})
	$("#capa_registro").css({
	
		position : "absolute",
		width : "290px",
		height : "310px",
		top : $(window).height()/2-(310/2),
		left : $(window).width()/2-(280/2),
		zIndex : $().wkVeloDetails.zIndex+1,
		border : "1px solid #000000"
		
	});
	
	$("#capa_contacto").css({
	
		position : "absolute",
		width : "290px",
		height : "220px",
		top : $(window).height()/2-(260/2),
		left : $(window).width()/2-(220/2),
		zIndex : $().wkVeloDetails.zIndex+1,
		border : "1px solid #000000"
		
	});
	
	$("#btn_registro").bind("click",function(){
	
		showRegistro();
		
	})
	$("#btn_contaco").bind("click",function(){
	
		showContacto();
		return false;
		
	})
	$("#aceptar").bind("click",function(){
		enviarRegistro();
	})
	
	$("#btn_contactar").bind("click",function(){
		enviarContacto();
	})
	
	
	

})

function showRegistro(){

	$().wkVelo({
		opacity : 0.5,
		color : "black"
	});
	$("#capa_registro").fadeIn("slow");
	$("#capa_registro").css({
	
		position : "absolute",
		width : "290px",
		height : "310px",
		top : $(window).height()/2-(310/2),
		left : $(window).width()/2-(290/2),
		zIndex : $().wkVeloDetails.zIndex+1,
		border : "1px solid #000000"
		
	})
	return false;

}


function showContacto(){
	
	$().wkVelo({
		opacity : 0.5,
		color : "black"
	});
	$("#capa_contacto").fadeIn("slow");
	$("#capa_contacto").css({
	
		position : "absolute",
		width : "290px",
		height : "220px",
		top : $(window).height()/2-(260/2),
		left : $(window).width()/2-(220/2),
		zIndex : $().wkVeloDetails.zIndex+1,
		border : "1px solid #000000"
		
	})
	return false;

}

function enviarRegistro(){


	urlEnvio="exec_registro.php?";
	urlEnvio+="&str_t01_nombre="+$("#str_t01_nombre").val();
	urlEnvio+="&str_t01_apellido="+$("#str_t01_apellido").val();
	urlEnvio+="&str_t01_email="+$("#str_t01_email").val();
	urlEnvio+="&str_t01_telefono="+$("#str_t01_telefono").val();
	urlEnvio+="&str_t01_movil="+$("#str_t01_movil").val();
	urlEnvio+="&str_t01_compania="+$("#str_t01_compania").val();
	urlEnvio+="&int_t01_info_email=0";
	urlEnvio+="&int_t02_status="+$("#int_t02_status").val();
	
	$.ajax({
	   type: "POST",
	   url: urlEnvio,
	   success: function(msg){
		   
		 $("#capa_registro").fadeOut("slow");
		 $().wkVeloHide();
	   }
	 });



}


function enviarContacto(){


	urlEnvio="exec_contacto.php?";
	urlEnvio+="&str_t02_nombre="+$("#str_t02_nombre").val();
	urlEnvio+="&str_t02_apellido="+$("#str_t02_apellido").val();
	urlEnvio+="&str_t02_email="+$("#str_t02_email").val();
	urlEnvio+="&str_t02_telf="+$("#str_t02_telf").val();
	urlEnvio+="&str_t02_compania="+$("#str_t02_compania").val();
	urlEnvio+="&str_t02_cargo="+$("#str_t02_cargo").val();
	urlEnvio+="&str_t02_comentario="+$("#str_t02_comentario").val();
	urlEnvio+="&int_t02_status="+$("#int_t02_status").val();
	
	$.ajax({
	   type: "POST",
	   url: urlEnvio,
	   success: function(msg){
		   
		 $("#capa_contacto").fadeOut("slow");
		 $().wkVeloHide();
	   }
	 });



}


