	/* SHOWREEL
- - - - - - - - - - - - - - - - - - - - */
$.fn.showreel = function() {
	return this.each(function() {
		var $this = $(this);
		var li = $this.find("li a");
		var interval;
		var i = 0;
		li.eq(0).addClass("on");
		li.mouseover(function(){
			var indx = li.index($(this));
			clearTimeout(interval);
			li.filter(".on").removeClass("on");
			$(this).addClass("on");
			$this.find(".label").stop().animate({"top": (11+ (indx * 20)) + "px"},800,"easeOutExpo");
			$this.find(".flower").stop().animate({"top": "-" + ((indx * 360)) + "px"},800,"easeOutExpo");
		});
		li.mouseout(function(){
			i = li.index($(this));
			looppa();
		});
		function looppa(){
			if (i > li.size() - 1) {
				i = 0;
			}
			li.eq(i++).mouseover();
			interval = setTimeout(looppa,3000);
		}
		looppa();
	});
}


if(typeof($)=="function"){
	$(document).ready (init);
}



function init(){
	
				// showreel
	if ($("#showreel_home").size()) {
		$("#showreel_home").showreel();
	}
	
	var tmp;
	$("#masterdivSX ul li").not(".on").find("ul").hide();
	$("#masterdivSX ul li a").click(function() {
		var the_ul;
		the_ul=$(this).parent().find("ul");
		the_ul.slideToggle("fast");
		/* Se si vogliono lasciare aperti gli altri UL commentare la seguente riga */
//		$("#masterdivSX ul li").find("ul").not(the_ul).slideUp("fast");
	
	});
	
	curr_url=location.href.split('/')[3];
	
	$("ul li a[href='"+curr_url+"']").addClass("on");
	$("ul li a[href='"+curr_url+"']").attr("title",location.href);
}
