Array.prototype.indexOf = function(o, i) {	for ( var j = this.length, i = i < 0 ? i + j < 0 ? 0 : i + j : i || 0; i < j && this[i] !== o; i++);	return j <= i ? -1 : i}var $arrSlug = new Array('homepage', 'liveenews', 'cantautore', 'autore', 'teatro');$current = $arrSlug.indexOf($current);$(document).ready(function() {	$(".track").each(function(n){		$(this).wrap('<div class="track-Wrapper" />');				$(this).after('<div class=\"loader-player\" style=\"display:none\">carico...</div><div class=\"inline-player\"><a class=\"jp-play\"></a><a class=\"jp-pause\"></a><a class=\"jp-stop\"></a><a class=\"jp-mute\"></a><a class=\"jp-unmute\"></a><span class=\"jp-current-time\"></span></div>');			});	// Local copy of jQuery selectors, for performance.	var my_jPlayer = $("#jquery_jplayer"), my_trackName = $("#jp_container .track-name"), my_playState = $("#jp_container .play-state"), my_extraPlayInfo = $("#jp_container .extra-play-info");	// Some options	var opt_play_first = false,	// If true, will attempt to	// auto-play the default track	// on page loads. No effect on	// mobile devices, like iOS.	opt_auto_play = false, 	// If true, when a track is	// selected, it will auto-play.	opt_text_playing = "In riproduzione", // Text when playing	opt_text_selected = "Traccia selezionata"; // Text when not playing	// A flag to capture the first track	var first_track = true;	// Change the time format	$.jPlayer.timeFormat.padMin = false;	$.jPlayer.timeFormat.padSec = false;	$.jPlayer.timeFormat.sepMin = " min ";	$.jPlayer.timeFormat.sepSec = " sec";	// Initialize the play state text	my_playState.text(opt_text_selected);	// Instance jPlayer	my_jPlayer.jPlayer({		ready : function() {			$("#jp_container .track-default").click();		},		play : function(event) {			$(".current-track").parent().find(".loader-player").hide();			$(".current-track").parent().find(".inline-player").fadeIn("slow");			my_playState.text(opt_text_playing);		},		pause : function(event) {			my_playState.text(opt_text_selected);		},		ended : function(event) {			my_playState.text(opt_text_selected);		},		swfPath : $jplayerSwfpath,		cssSelectorAncestor : "#jp_container",		supplied : "mp3",		wmode : "window"	});	// Create click handlers for the different tracks	$(".track").click(function(e) {		$(".track-Wrapper").find(".inline-player").css("display","none");		$(".track-Wrapper").find(".loader-player").css("display","none");			$(this).parent().find(".loader-player").css("display","block");		my_jPlayer.jPlayer("clearMedia");		my_jPlayer.jPlayer("setMedia", {			mp3 : $(this).attr("href")		});			my_jPlayer.jPlayer("play");			$('.track').removeClass("current-track");			$(this).blur().addClass("current-track");		return false;	});	/* AZIONI PROVVISORIE!!! */	$("#wrapper").after(			"<div class=\"presto-on-line\">&nbsp;</div>");	/* END AZIONI PROVVISORIE!!! */	$(".menu li").each(function(u) {		var f = $(this);		f.css({			"z-index" : u * 2		}).addClass($arrSlug[u]).find('a').empty();		if (u != $current) {			/* AZIONI PROVVISORIE!!! */			f.hover(function() {				if (u < 3) {					f.find("a").css("cursor", "default");					$("body").find(".presto-on-line").css({						top : 0,						left : (u * 50),						"z-index" : (u * 2) + 1					});				}			});			/* END AZIONI PROVVISORIE!!! */			f.click(function(event) {				if (u < 3) {					event.preventDefault();				} else {					event.preventDefault();					var url = $(this).find('a').attr("href");					var target = $(this);					var position = u;					resizeBg();					moveAndLoad(target, url, position);				}				/*				 * CAMBIO PAGINA var url =				 * $(this).find('a').attr("href"); var target =				 * $(this); var position = u; resizeBg();				 * moveAndLoad(target, url, position); FINE				 * CAMBIO PAGINA				 */			});		} else {			f.click(function(event) {				event.preventDefault();			}).find("a").css("cursor", "default");		}	});	resizeBg();	$("#wrapper").css("display", "block");	$("#footer, #main, #branding").css("display", "block");	/* TOOLTIP */	$(".gallery-item, .wp-caption").each(function() {		var e = $(this);		e.find("img").removeAttr("alt").removeAttr("title");		e.find("a").removeAttr("title");		e.hover(function() {			e.find("a").css("cursor", "none");			e.find(".wp-caption-text").css("display", "block");		}, function() {			e.find(".wp-caption-text").css("display", "none");		});		e.mousemove(function(f) {			var mousex = f.pageX - 16;			var mousey = f.pageY + 1;			e.find(".wp-caption-text").css({				top : mousey,				left : mousex			});		});	});	/* END TOOLTIP */});function moveAndLoad($target, $url, $position) {	$("#footer, #main, #branding").css("display", "none");	$("#wrapper").css("background", "none");	if ($position < $current) {		for ( var h = $position + 1; h < ($(".menu li").length); h++) {			$(".menu li:eq(" + h + ")").animate(					{						"left" : document.documentElement.clientWidth - 10 - ($(".menu li").length - h) * 50					}, 1000, "easeInOutQuint")		}		$(".menu li:eq(" + ($current) + ")").css("width", "2000px");		$target.addClass("current-menu-item").css("width", "2000px").animate({			"left" : ($position * 50) - 10		}, 1000, "easeInOutQuint", function() {			window.location.href = $(this).find('a').attr("href")		});	} else if ($position > $current) {		for ( var h = $current; h < $position; h++) {			$(".menu li:eq(" + h + ")").animate({				"left" : (h * 50) - 10			}, 1000, "easeInOutQuint")		}		$target.addClass("current-menu-item").css("width", "2000px").animate({			"left" : ($position * 50) - 10		}, 1000, "easeInOutQuint", function() {			window.location.href = $(this).find('a').attr("href")		});	}}$(window).resize(function() {	resizeBg()});$(window).scroll(function() {	wrapperPosition()});$(window).load(function() {	resizeBg()});function resizeBg() {	wrapperPosition();	$(".menu li").each(			function(u) {				if (u <= $current) {					$(this).css("left", (u * 50) - 10);				} else {					$(this).css("left",	document.documentElement.clientWidth - 10 - ($(".menu li").length - u) * 50);				}			});}function wrapperPosition() {	if(document.documentElement.clientWidth <= 1000){		$("#access ul li.current-menu-item a").hide();	}else{		$("#access ul li.current-menu-item a").show();	}	var scrY = window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;	var wrapperWidth = document.documentElement.clientWidth - (($(".menu li").length - 1) * 50);	var wrapperWidthEhightRatio = wrapperWidth / document.documentElement.clientHeight;	var wrapperBgPosition = (wrapperWidth - (Math.floor(scrY / 7)) - 400) + "px 0";	$("#wrapper").css({		"margin-left" : ($current * 50),		"margin-right" : (($(".menu li").length-1)- $current) * 50,		"width" : wrapperWidth,		"background-position" : wrapperBgPosition	});}
