// Fix para links externos (rel)

function checkMail(email) {
	var filtro = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@+([_a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]{2,200}\.[a-zA-Z]{2,6}$/;
	return filtro.test(email);
}

function clickEmailThis() {
	//evento.preventDefault();
	testMail = checkMail($('#etTo').val());
	if ((testMail) && ($('#etFrom').val()!="") && ($('#etComments').val()!="")) {
		//$('#frm-feedback').attr('method', 'post').submit();
		$.post("ah_emailthis.php", { To: $('#etTo').val(), From: $('#etFrom').val(), Address: $('#etAddress').val(), Comments: $('#etComments').val(), Subject: $('#etSubject').val() }, function (datos) {
			alert("The email was sent succefully.");
			tb_remove();					
		});
	} else {
		alert("Please provide all the information required and a valid email address.");	
	}
};



function fix_external_links() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("rel") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
	}
}
window.onload = fix_external_links;
	
$(document).ready( function() {

	//Fancybox Gallery
	$("a[rel=gallery]").fancybox({
		'transitionIn':'fade',
		'transitionOut':'fade',
		'overlayColor':'#000',
		'showNavArrows':'true',
		'hideOnContentClick': true
	});
	
	//Fancybox Photos
	$("a[rel=photos]").fancybox({
		'transitionIn':'fade',
		'transitionOut':'fade',
		'overlayColor':'#000',
		'showNavArrows':'true',
		'hideOnContentClick': true
	});
	
	//Rollover for Submit button
	$("#btnsubmit").hover(
  		function () {
    		$(this).addClass("hover");
  		},
  		function () {
    		$(this).removeClass("hover");
  		}
	);
	$("#btnsubmit").unbind('mouseenter mouseleave');

});

