$(document).ready(function() {
$(".header .down li.selected a h3").css({color:"#FFFFFF"});
$("a.link_one").hover(function(){	
						$("a.link_one h3").css({color:"#FFFFFF"});
					},function(){
						$("a.link_one h3").css({color:"#7A1401"});
						$(".header .down li.selected a.link_one h3").css({color:"#FFFFFF"});
					});
$("a.link_two").hover(function(){									
						$("a.link_two h3").css({color:"#FFFFFF"});
					},function(){
						$("a.link_two h3").css({color:"#7A1401"});
						$(".header .down li.selected a.link_two h3").css({color:"#FFFFFF"});
					});
$(".pointInMap").hover(function(){
	
		$(".detailLeft").css("display","none");
		$(".detailRight").css("display","none");
		$(".resaltar").css("display","none");
		$(".pointInMap").css("z-index","0");
		$(this).children().slideDown();
		$(this).css("z-index","2");
	},function(){
	
		$(this).children().css("display","none");
	});
	
	
	
	
	
	$(".coor").hover(function(){
	
		$(this).children(".ver").css("display","block");
	
	},function(){
	
		$(this).children(".ver").css("display","none");
	
	});
	
	

	//FORM CONTACTOS ETIQUETAS EN LOS INPUTS
	//Cuando enfoca
	$(".mission #FormsMessagesExtrafield0Firstname").focus(function(){
		if ($(this).attr('value')=="Your first name") {$(this).val('');} 
		if ($(this).attr('value')=="Nombre") {$(this).val('');} 
	});
	$(".mission #FormsMessagesExtrafield1Lastname").focus(function(){
		if ($(this).attr('value')=="Your last name") {$(this).val('');} 
		if ($(this).attr('value')=="Apellido") {$(this).val('');} 
	});
	$(".mission #FormsMessagesExtrafield2Email").focus(function(){
		if ($(this).attr('value')=="Your email") {$(this).val('');} 
		if ($(this).attr('value')=="Tu email") {$(this).val('');} 
	});
	$(".mission #FormsMessagesExtrafield4Repeatemail").focus(function(){
		if ($(this).attr('value')=="Confirm your email") {$(this).val('');} 
		if ($(this).attr('value')=="Repetir email") {$(this).val('');} 
	});
	$(".mission #FormsMessagesExtrafield3Message").focus(function(){
		if ($(this).text()=="Your message") {$(this).text('');} 
		if ($(this).text()=="Tu mensaje") {$(this).text('');} 
	});
	
	
	//Cuando Desenfoca
	$(".mission #FormsMessagesExtrafield0Firstname").blur(function(){
		if ($(this).attr('value')=='' && $('.mision').length==0) {$(this).val('Your first name');} 
		if ($(this).attr('value')=='' && $('.mision').length==1) {$(this).val('Nombre');} 
	});
	$(".mission #FormsMessagesExtrafield1Lastname").blur(function(){
		if ($(this).attr('value')=="" && $('.mision').length==0) {$(this).val('Your last name');} 
		if ($(this).attr('value')=='' && $('.mision').length==1) {$(this).val('Apellido');} 
	});
	$(".mission #FormsMessagesExtrafield2Email").blur(function(){
		if ($(this).attr('value')=="" && $('.mision').length==0) {$(this).val('Your email');} 
		if ($(this).attr('value')=='' && $('.mision').length==1) {$(this).val('Tu email');} 
	});
	$(".mission #FormsMessagesExtrafield4Repeatemail").blur(function(){
		if ($(this).attr('value')=="" && $('.mision').length==0) {$(this).val('Confirm your email');} 
		if ($(this).attr('value')=='' && $('.mision').length==1) {$(this).val('Repetir email');} 
	});
	$(".mission #FormsMessagesExtrafield3Message").blur(function(){
		if ($(this).text()=='' && $('.mision').length==0) {$(this).text('Your message');} 
		if ($(this).text()=='' && $('.mision').length==1) {$(this).text('Tu mensaje');} 
	});
	
	
	////////////////////////////////////////
	
	
	
	
	
	
	
	///////////VALIDACION
	
/*---VALIDACIÓN-DE-CAMPOS-VICIOS-DE-UN-FORMULARIO----------------------------------------------------------------------------
	
	$("form").find(".required").not(".email").each(function(){
		$(this).keyup(function(){
			if(IsBlank($(this).val())) // si el valor del input está vacío…
			{		
				if($(this).siblings("span.error").length == 0 ){ 
					//$(this).siblings("span.error").remove();
					$(this).css("border","1px solid #f00");
					$(this).after('<span class="error">This is a required field.</span>');
					$(this).siblings("span.error").css("display","block");
				}
			}
			else    // si no está vacío el campo . . . 
			{
				$(this).css("border","1px solid #969696");
				$(this).siblings("span.error").remove();
			}
		});
		
	});


	$("form").find(".email").filter(".required").each(function(){
		$(this).keyup(function(){
			if(!isValidEmail($(this).val())){ // este input es pasado por la función ‘valid_email()’ … si no es correcto…				
				
				if($(this).siblings("span.error").length == 0 ){ 
					$(this).siblings("span.error").remove();
					$(this).css("border","1px solid #f00");
					$(this).after('<span class="error">Email is invalid.</span>');
					$(this).siblings("span.error").css("display","block");
				}
				
			}else{
				$(this).css("border","1px solid #969696");
				$(this).siblings("span.error").remove();
				
			}
		});
	});

	/*---END-VALIDACIÓN-DE-CAMPOS-VICIOS-DE-UN-FORMULARIO---*/
	
	
	//////////////////////
	
	
	


	if($('.resaltar').length==1) {
		HidePoints();
		
	}
	
	
	
	

});



	function HidePoints() {
		$(".showp").attr("class","showp");
		$(".hidep").attr("class","hidep active");
		$(".pointInMap").css("display","none");
		$(".pointResaltar").css("display","block");
		$(".resaltar").css("display","block");
		document.location.href = "#"+$("a#ancla").attr("name");
		return false;

	}
	
	function ShowPoints() {
		$(".showp").attr("class","showp active");
		$(".hidep").attr("class","hidep");
		$(".pointInMap").css("display","block");
	}


	
	/*---VALIDACIÓN-DE-FORMULARIO-(ONSUBMIT)---

	function validate(formId)
	{
		//var form = document.form;
		var ok = true;
		
		$("form#"+formId).find(".required").not(".email").each(function(){
			if(IsBlank($(this).val())) // si el valor del input está vacío…
			{		
				ok = false;
				if($(this).siblings("span.error").length == 0 ){ 
					$(this).siblings("span.error").remove();
					$(this).css("border","1px solid #f00");
					$(this).after('<span class="error">This is a required field.</span>');
					$(this).siblings("span.error").css("display","block");
				}
			}
			else    // si no está vacío el campo . . . 
			{
				$(this).css("border","1px solid #969696");
				$(this).siblings("span.error").remove();
			}
		});
	
	
		$("form#"+formId).find(".email").filter(".required").each(function(){ 
			if(!isValidEmail($(this).val())){ // este input es pasado por la función ‘valid_email()’ … si no es correcto…
				ok = false; // el ok sera ‘false’
				if($(this).siblings("span.error").length == 0 ){ 
					$(this).siblings("span.error").remove();
					$(this).css("border","1px solid #f00");
					$(this).after('<span class="error">Email is invalid.</span>');
					$(this).siblings("span.error").css("display","block");
				}
				
			}else{
			
				$(this).css("border","1px solid #969696");
				$(this).siblings("span.error").remove();
				
			}			
		});
		
		return ok;
	}
	
	/*---END-VALIDACIÓN-DE-FORMULARIO-(ONSUBMIT)---*/
	
	/*---FUNCIONES-DE-VALIDACIÓN-DE-FORMULARIO---*/
	
	function validnum(s)
	{
		 // Check for number
		 num = new RegExp(/^(?:\+|-)?\d+$/);
		 if (!num.test(s)) {
			  return false;
		 }
		return true;
	}
	
	function IsBlank (strString)
	{
		if (strString.length == 0)
			return true;
	
		for (i = 0; i < strString.length; i++)
		{
			strChar = strString.charAt(i);
			if (strChar != " ")
				return false;
		}
		return true;
	}
	
	function isValidEmail(email){
	
		if (email.length < 5)
			return false;
	
		subEmail=email.split('@'); //subEmail is a string array (contains strings splitted by '@')
		if (subEmail.length != 2)
			return false;
	
		dotStr=subEmail[1].split('.'); //dotStr is a string array (contains strings splitted by '.')
	
		if(dotStr.length<2)
			return false;
	
		for(i=1;i<dotStr.length;i++){
			if((dotStr[i].length!=2)&&(dotStr[i].length!=3))
				return false;
		}
	return true;
	}// End isValidEmail

	/*---END-FUNCIONES-DE-VALIDACIÓN-DE-FORMULARIO---*/