/*
	Custom.js for Ciclón v.2
	-
	Requires jQuery to work out
*/

// Abrir enlaces externos
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}
}
window.onload = externalLinks;

jQuery(document).ready(function(){

	// Eliminar valores en inputs predefinidos
	$('input#s, input#user_email_login, input#user_pass_login').each(function() {
	    var default_value = this.value;
	    $(this).focus(function() {
	        if(this.value == default_value) {
	            this.value = '';
	        }
	    });
	    $(this).blur(function() {
	        if(this.value == '') {
	            this.value = default_value;
	        }
	    });
	})

	// Cambio de foto en Ficha de libro
	$(".gallery ul li a").each(function(i){
		$(this).click(function() {
			$('.sleeve img').attr('src', $(this).attr('href'));
			return false;
		});
	});
	$(".photos").easySlider();
});

Shadowbox.init();
