			function f_scrollTop() {
				return f_filterResults (
					window.pageYOffset ? window.pageYOffset : 0,
					document.documentElement ? document.documentElement.scrollTop : 0,
					document.body ? document.body.scrollTop : 0
				);
			}
			function f_filterResults(n_win, n_docel, n_body) {
				var n_result = n_win ? n_win : 0;
				if (n_docel && (!n_result || (n_result > n_docel)))
					n_result = n_docel;
				return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
			}

jQuery(document).ready(function($){

		
			$(".revista, .imglibro").fancybox( {
				transitionIn : "fade",
				transitionOut : "fade",
				speedIn: 500,
				speedOut: 500,
				overlayShow: true,
				overlayColor : "#666",
				overlayOpacity: 0.7,
				hideOnContentClick: true,
				autoScale : true,
				centerOnScroll : false,
				titleShow : true,
				titlePosition : "outside"				
			});
			
			$(".videointro").fancybox( {
				transitionIn : "fade",
				transitionOut : "fade",
				speedIn: 500,
				speedOut: 500,
				overlayShow: true,
				overlayColor : "#666",
				overlayOpacity: 0.7,
				hideOnContentClick: true,
				autoScale : true,
				centerOnScroll : false,
				titleShow : true,
				titlePosition : "outside",
				width: 640,
				height: 360			
			});
	
		
			$(".formpop").fancybox( {
				transitionIn : "fade",
				transitionOut : "fade",
				speedIn: 500,
				speedOut: 500,
				overlayShow: true,
				overlayColor : "#666",
				overlayOpacity: 0.7,
				hideOnContentClick: true,
				autoScale : true,
				centerOnScroll : false,
				titleShow : true,
				titlePosition : "outside",
				width: 700,
				height: 600
			});
			
			$(".mapalumnos").fancybox( {
				transitionIn : "fade",
				transitionOut : "fade",
				speedIn: 500,
				speedOut: 500,
				overlayShow: true,
				overlayColor : "#666",
				overlayOpacity: 0.7,
				hideOnContentClick: true,
				autoScale : true,
				centerOnScroll : false,
				titleShow : true,
				titlePosition : "outside",
				width: 1200,
				height: 700
			});
			$(".issuulink").fancybox( {
				transitionIn : "fade",
				transitionOut : "fade",
				speedIn: 800,
				speedOut: 500,
				overlayShow: true,
				overlayColor : "#666",
				overlayOpacity: 0.7,
				hideOnContentClick: true,
				autoScale : false,
				scrolling : 'no',
				centerOnScroll : false,
				titleShow : true,
				titlePosition : "outside",
				width: 840,
				height: 550
			});


			jQuery('.verapertura').click(function() {
			  jQuery(this).next().toggle('slow', function() {
				  //complete
			  });
			});
			
			jQuery('.online').prepend('<div class="etiqueta-online"></div>');
			jQuery('.reserva').prepend('<div class="etiqueta-reserva"></div>');
			jQuery('.agotado').prepend('<div class="etiqueta-agotado"></div>');
				
			
			jQuery(window).scroll(function () { 
					if (f_scrollTop() > 186) {
						jQuery('#ja-inset2xxx').css('position', 'fixed'); 
						jQuery('#ja-inset2xxx').css('top', '5px');
					} else {
						jQuery('#ja-inset2xxx').css('position', 'absolute'); 
					  jQuery('#ja-inset2xxx').css('top', '0px');
					}
			});
			
			jQuery('#lateral_curso').css({position: 'absolute',top:(jQuery(window).scrollTop()+jQuery(window).height()-jQuery('#lateral_curso').height()-186)+'px'});
			
			jQuery(window).scroll(function () {
					if (f_scrollTop() > 186) {
						jQuery('.ja_socialbeforecontent').css({position: 'fixed', top: '5px'});
						jQuery('#lateral_curso').css({position: 'absolute',top:(jQuery(window).scrollTop()+jQuery(window).height()-jQuery('#lateral_curso').height()-186)+'px'});
					} else {
						jQuery('.ja_socialbeforecontent').css({position: 'absolute', top: '0px'});
						jQuery('#lateral_curso').css({position: 'absolute',top:(jQuery(window).scrollTop()+jQuery(window).height()-jQuery('#lateral_curso').height()-186)+'px'});
						
					}
			});
});
