// What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready

$(function() {

	// thumbnail scrollable
	$("#thumbnails").scrollable({size: 3, circular:true, clickable: false}).autoscroll({interval:8000}).find("img").each(function(index) {

		// thumbnail images trigger the overlay
		$(this).overlay({

			effect: 'apple',
			target: '#box',
			mask: { maskId: 'mask', color:'#000' },

			// when box is opened, scroll to correct position (in 0 seconds)
			onLoad: function() {
				$("#images").data("scrollable").seekTo(index, 0);
			}
		});
	});
	

	// scrollable inside the box.
	$("#images").scrollable();

	
	// enable tooltips for the images
	$("#images img").tooltip({
		position: "bottom center",
		offset: [-75, -30],
		opacity: 0.7,
		effect: 'fade',

		// position tooltips relative to the parent scrollable
		relative: true
	});

	$("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});

});

$(function() {
		   
	// thumbnail scrollable
	$("#scrolling").scrollable({size: 3, circular:true, clickable: false}).autoscroll({interval:8000})

});
	


$(function() {


	$(".ScrollBox").scrollable();
	$(".Thumbnails").each(function(index) {
	
		$(this).find("a[rel]").each(function(index) {
			// thumbnail images trigger the overlay
			$(this).overlay({
				effect: 'apple',
				target: $(this).attr("rel"),
				mask: { maskId: 'mask', color:'#000' },

				// when box is opened, scroll to correct position (in 0 seconds)
				onLoad: function() {
					selector = this.getTrigger().attr("rel") + " .ScrollBox";
					$(selector).data("scrollable").seekTo(index, 0);
				}
			});
		});
	});
	/*$("a[rel]").overlay({

		mask: '#000000',
		effect: 'apple',

		onBeforeLoad: function() {

			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");

			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
		}

	});*/
});


// TOGGLE BUTTON
// By Aleare

function showDiv(d, s, f) {
	if(document.getElementById(d).style.display == "none"){
	document.getElementById(d).style.display = "block";
	document.getElementById(f).src="boton_cerrar.png"
	}
	else {
	document.getElementById(d).style.display = "none";
	document.getElementById(f).src="boton_abrir.png"
	}
 }

function showDiv1(d, s) {
	if(document.getElementById(d).style.display == "none"){
	document.getElementById(d).style.display = "block";
	}
	else {
	document.getElementById(d).style.display = "none";
	}
 }
