// JavaScript Documentvar x;
jQuery(document).ready (function(){
								 
		$(document).ready(function(){
				//Examples of how to assign the ColorBox event to elements
				$(".example7").colorbox({width:"670px", height:"530px", iframe:true});
				//Example of preserving a JavaScript event for inline calls.
				$("#click").click(function(){ 
					$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
					return false;
				});
		});
		
		jQuery("#email").click(function(){
			jQuery("#email").css("color","#808080");
		});
								 
		jQuery("#btn1").click(function(){
		jQuery("#uno").hide("fast");
		jQuery('#dos').show("fast");
		return false;
    	});
		
		jQuery("#nombre").click(function(){
			jQuery("#nombre").css("color","#808080");
		});	
		
		//Validar correo
		jQuery.fn.correo=function()
		{
			if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($(this).val()))
			{
				return true;
			}
			else
			{
				jQuery('#dos').hide("fast");
				jQuery('#error').show("fast");	
				return false;
			}
		}
		
		$("#informacion").submit(function()
		{			
			if($("#email").correo())
			{
				var email=$("#email").attr("value");
				var nombre=$("#nombre").attr("value");
				$.post("enviar.php",{vemail:email, vnombre:nombre},llegadaDatos); 
				return false;
			}
			else return false;
		});
		
		function llegadaDatos(datos)
		{
		  	jQuery('#dos').hide("fast");
			jQuery('#tres').show("fast");
			var x=$("#gracias");
 			x.text("\u00A1Gracias por contactarnos!");
		}
});

/*function inicializarEventos()
{
  var x;
  x=$("#boton");
  x.click(cambiarTexto);
}

function cambiarTexto()
{
  valor_email = $("#email").attr("value");
  var x =$("#email");
  x.val("Danos tu nombre");
  var x =$("#boton");
  x.val("Enviar"); 
  x=$("#boton");
  x.click(enviarDatos);   
}

function enviarDatos()
{
   alert(valor_email);
   valor_nombre = $("#email").attr("value");
   var x=$("#email");
   x.val("Gracias por contactarnos");
   alert ("Email:" + valor_email + " Nombre:" + valor_nombre);
}*/