//<![CDATA[
jQuery(function($) {
// extends one gallery class to the other to use the <li> without problems.
// genero un doble de compatibilidad entre las dos galerias
$('.jcarousel-skin-tango').addClass('gallery');	

// make automatically the thumbnails
//genero miniaturas y recuadro de exposición	
var options = {
        insert : '#main_image',
		
        clickNext : true,
        onImage : function(image) {
		image.css('display','none').fadeIn(200);var top = ( $('#contenedor ').height() - $('#contenedor #main_image').height() ) / 2;
    $('#contenedor #main_image').css('margin-top', top);},
        
		onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.9';
				
				// fade in the thumbnail when finished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.6); } // don't fade out if the parent is active
				)
				}
};
$('ul.gallery').galleria(options);
// $("ul.gallery li a").attr("class","noscale");

// how many pictures we have? This is for the gallery to cycle with non black spaces or a few, but not infinit like in a bug.
var cuantas_son = $('ul.gallery li').size();
cuantas_son=Math.round(cuantas_son/2);

// start thumbnails to slide show with Jcarousel
// convierto miniaturas a Jcarousel para tener slide show 
jQuery('#mycarousel').jcarousel({
        	scroll: 5, vertical: true,
			wrap: 'last',
			auto: 40,    // to set time in seconds to automatically scroll up thumbnails
			size: cuantas_son
				    });

 $(".jcarousel-prev-vertical").text('<<..');		
 $(".jcarousel-next-vertical").text('..>>');	
 
 showOffLoading();
//fin 
 }); 
  //]]>
  
  function showOffLoading()
  {
    //alert("alet");
    var CONTROL = document.getElementById("divLoad");
    CONTROL.style.visibility = "hidden";
  }