//Script para los fondos del menu principal//

jQuery(document).ready(function () {

	jQuery('#navMenu li').append('<div class="hover"><\/div>');
	jQuery('#navMenu li').hover(
		function() {
			jQuery(this).children('div').fadeIn('1000');	
		}, 
		function() {
			jQuery(this).children('div').fadeOut('1000');	
	}).click (function () {
		jQuery(this).addClass('selected');
	});


	//Script para el movimiento del idioma//
	var mouseX = 0;
	var mouseY = 0;		
	var openRedSoc = false	
	//
	function openRed(){
		jQuery('.wpenglish').stop().animate({top: 0},{queue:false, duration:400, easing: 'easeOutExpo'});
		openRedSoc = true
	}
	
	function closeRed(){
		jQuery('.wpenglish').stop().animate({top: -54},{queue:false, duration:400, easing: 'easeOutExpo'});
		openRedSoc = false
	}
	//
	jQuery('.wpenglish, .btnDesp').mouseover(function () {
		if (!openRedSoc)
		{
			openRed()
		}
	});

	jQuery('.wpenglish, .btnDesp').mouseout(function (e) {
		mouseX = e.pageX;
		mouseY = e.pageY;
		if (openRedSoc)
		{
			if (mouseY > 50)
			{
				closeRed()
			}
		}
	});


	//Script para las ampliaciones de las imagenes//
	jQuery("a[rel=grupo_capturas]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	jQuery("a[rel=grupo_capturas_eximius]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	jQuery("a[rel=grupo_capturas_emporika]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	jQuery("a[rel=grupo_capturas_traveltag]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	});
	
//Script para el movimiento de los modulos de productos en index//

	jQuery(document).ready(function(){
	jQuery('.boxprod.fx').hover(function(){
	jQuery(".ribbonEmporika, .ribbonTraveltag, .ribbonEximius", this).stop().animate({top:'155px'},{queue:false,duration:160});
	}, function() {
	jQuery(".ribbonEmporika, .ribbonTraveltag, .ribbonEximius", this).stop().animate({top:'36px'},{queue:false,duration:320});
	}
	);

//Efecto fade de los botones y modulos//

	jQuery('.fadeThis').append('<span class="hover"></span>').each(function () {
	  var jQueryspan = jQuery('> span.hover', this).css('opacity', 0);
	  jQuery(this).hover(function () {
	    jQueryspan.stop().fadeTo(500, 1);
	  }, function () {
	    jQueryspan.stop().fadeTo(500, 0);
	  });
	});
});
