// JavaScript Document
$(document).ready(function() {
	
	$(".glist li a img").parent().prepend("<span></span>").hover( //tooltip animation
	  function () {
		$(this).parent().find("p.gdescrip").stop(true, true).slideDown(200);
		$(this).parent().find("span").stop(true, true).fadeIn(400);
	  },
	  function () {
		$(this).parent().find("p.gdescrip,span").stop(true, true).hide();
	  }
	);


// contactform
	$(".conterror").hide();
	$("#contactbutton").click(function(e) {
		e.preventDefault();
		$(".conterror").hide();		
			if ($.trim($("#clname").val()).length<4) { //(|| (!$.trim($("#clname").val()).match(/^[a-zA-Z]+$/))) {
				$(".contsend").hide();
				$(".conterror").fadeIn("fast").html("<span>!</span> Debe indicar su nombre");
				$("#clname").focus();
				return false;
			}
			if ($.trim($("#clemail").val()).length<5) {
				$(".contsend").hide();
				$(".conterror").fadeIn("fast").html("<span>!</span> Debe indicar su dirección de correo electrónico");
				$("#clemail").focus();
				return false;
			}
			if(!$("#clemail").val().match(/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i)) {
				    $(".contsend").hide();
					$(".conterror").fadeIn("fast").html("<span>!</span> La dirección de correo electrónico es incorrecta. Por favor verifíquela");
					$("#clemail").focus();
					return false;
				}
			if ($.trim($("#clsubject").val()).length<5) {
				$(".contsend").hide();
				$(".conterror").fadeIn("fast").html("<span>!</span> Debe indicar el asunto de su mensaje");
				$("#clsubject").focus();
				return false;
			}				
			if ($.trim($("#comment").val()).length==0) {
				$(".contsend").hide();
				$(".conterror").fadeIn("fast").html("<span>!</span> Por favor introdúzca su mensaje para nosotros");
				$("#comment").focus();
				return false;
		}		
			
		$("#formcontact").submit();

	});	

	
// end documento ready
});
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("domingo","lunes","martes",
"miércoles","jueves","viernes","sábado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio",
"Julio","Agosto","Septiembre","Octubre",
"Noviembre","Diciembre")
