// JQUERY - SORTABLE

$(function() {

	$(".BOX-TOPO").sortable({ connectWith: '.BOX-MENU' });
	$(".BOX-MENU").sortable({ connectWith: '.BOX-TOPO' });
	$(".BOX-LEFT").sortable({ connectWith: '.BOX-LEFT' });
	$(".BOX-CENTER").sortable({ connectWith: '.BOX-CENTER' });
	$(".BOX-RIGHT").sortable({ connectWith: '.BOX-RIGHT' });
	$(".BOX-DOWN").sortable({ connectWith: '.BOX-DOWN'});

	// INICIO - DEFINIÇÃO DE OPACIDADE AO MOVER A BOX
	var opacity = $('.BOX-LEFT, .BOX-CENTER, .BOX-RIGHT, .BOX-TOPO, .BOX-MENU, .BOX-DOWN').sortable('option', 'opacity');
	$('.BOX-LEFT, .BOX-CENTER, .BOX-RIGHT, .BOX-TOPO, .BOX-MENU, .BOX-DOWN').sortable('option', 'opacity', 0.7);
	// FIM - DEFINIÇÃO DE OPACIDADE AO MOVER A BOX

	$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
		.find(".portlet-header")
			.addClass("ui-widget-header ui-corner-all")
			.prepend('<span class="ui-icon ui-icon-plusthick"></span>')
			.end()
		.find(".portlet-content");

	$(".portlet-header .ui-icon").click(function() {
		$(this).toggleClass("ui-icon-minusthick");
		$(this).parents(".portlet:first").find(".portlet-content").toggle();
	});

	$(".portlet2").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
		.find(".portlet-header2")
			.addClass("ui-widget-header ui-corner-all")
			.prepend('<span class="ui-icon ui-icon-plusthick"></span>')
			.end()
		.find(".portlet-content2");

	$(".portlet-header2 .ui-icon").click(function() {
		$(this).toggleClass("ui-icon-minusthick");
		$(this).parents(".portlet2:first").find(".portlet-content2").toggle();
	});

	$(".BOX-TOPO").disableSelection();
	$(".BOX-MENU").disableSelection();
	$(".BOX-LEFT").disableSelection();
	$(".BOX-CENTER").disableSelection();
	$(".BOX-RIGHT").disableSelection();
	$(".BOX-DOWN").disableSelection();

});

// JQUERY - JCYCLE - [http://malsup.com/jquery/cycle/browser.html]
$(function() { 
$('#IMGs-BOX-I').cycle({ fx: 'turnUp', timeout: 5000 }); 
$('#IMGs-BOX-II').cycle({ fx: 'slideY', timeout: 7000 }); 
});

