$(document).ready(function() { 
						   
	if ($("#mainBanner").find(".item").length != 1) {
		$("#mainBanner").scrollable({ items: "> .items", next: "#mainBanner .next", prev: "#mainBanner .prev", circular: true}).autoscroll(7000,{autoplay: true}).navigator({navi: ".navi.banner"});
	} else {
		$("#mainBanner").find(".browse").addClass("disabled");
	} 
	
	$("#containerDestaques.scrollable").scrollable({ items: "> .items", next: "> .next", prev: "> .prev", circular: true}).autoscroll(4000,{autoplay: true}).navigator({ navi: ".navi.destaqueBox"});
	
	$(".scrollable.pub1").scrollable({ items: "> .items", next: "> .next", prev: "> .prev", circular: true}).autoscroll(3000,{autoplay: true});
	$(".scrollable.pub2").scrollable({ items: "> .items", next: "> .next", prev: "> .prev", circular: true}).autoscroll(4000,{autoplay: true}).navigator({ navi: ".navi.pub2"});
	
	$("ul.tabs").tabs("> div.pane");
	
	
	$(function() {

	$(".scrollableGaleriaDeFotos").scrollable({ next: ".galeriaDeFotos .next", prev: ".galeriaDeFotos .prev", circular: true}).autoscroll(5000,{autoplay: true, steps: 1});
	
	$(".itemsGaleriaDeFotos img").click(function() {
	
	    // see if same thumb is being clicked
	    if ($(this).hasClass("active")) { return; }
	
	    // calclulate large image's URL based on the thumbnail URL (flickr specific)
	    var url = $(this).attr("src").replace("_t", "");
	
	    // get handle to element that wraps the image and make it semi-transparent
	    var wrap = $("#image_wrapGaleriaDeFotos").fadeTo("medium", 0.5);
	
	    // the large image from www.flickr.com
	    var img = new Image();
	
	
	    // call this function after it's loaded
	    img.onload = function() {
	
	        // make wrapper fully visible
	        wrap.fadeTo("fast", 1);
	
	        // change the image
	        wrap.find("img").attr("src", url);
	
	    };
	
	    // begin loading the image from www.flickr.com
	    img.src = url;
	
	    // activate item
	    $(".itemsGaleriaDeFotos img").removeClass("active");
	    $(this).addClass("active");
	
	// when page loads simulate a "click" on the first image
	}).filter(":first").click();
	});


});  

