function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

$(document).ready(function(){
	/* colorbox */
	$("a[rel='lightbox']").colorbox();
	
	$(".lightbox").colorbox();
	
	$(".popup600").colorbox({iframe:true, innerWidth:600, innerHeight:400});
	$(".popup").colorbox({iframe:true, innerWidth:800, innerHeight:600});
	$(".popupinline").colorbox({innerWidth:800, innerHeight:600, inline:true});


	$(".vidyt").colorbox({iframe:true, innerWidth:560, innerHeight:345});

    /* efecto over */
    $('.lightover').each(function() {
       $(this).hover(function() {
             $(this).stop().animate({ opacity: 0.8 }, 200);
       },
       function() {
            $(this).stop().animate({ opacity: 1.0 }, 200);
       });
    });
				

    $('a > img').each(function() {
       $(this).hover(function() {
             $(this).stop().animate({ opacity: 0.8 }, 200);
       },
       function() {
            $(this).stop().animate({ opacity: 1.0 }, 200);
       });
    });



	
	
});


	// SLIDESWITCH	
	function slideSwitch() {
	
		var $active = $('.galeria_two DIV.active');	
		if ( $active.length == 0 ) $active = $('.galeria_two DIV:last');	
		// los divs se muestran en el orden que esten en el codigo
		var $next =  $active.next().length ? $active.next() : $('.galeria_two DIV:first');
		// descomentar para que los divs se muestren aleatoriamente		
		// var $sibs  = $active.siblings();
		// var rndNum = Math.floor(Math.random() * $sibs.length );
		// var $next  = $( $sibs[ rndNum ] );	
		$active.addClass('last-active');	
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {	
				$active.removeClass('active last-active');	
			});	
	}
		
	
	$(function() {	
		setInterval( "slideSwitch()", 3000 );	
	});
	
