//document.write("<DIV id='prepage' style='position:absolute; font-family:arial; font-size:16; left:0px; top:0px; background-color:white; layer-background-color:white; height:100%; width:100%;'>Caricamento in corso...</DIV>")
/*
$(function(){
	$('ul.jd_menu').jdMenu({	onShow: loadMenu
								//onHideCheck: onHideCheckMenu,
								//onHide: onHideMenu, 
								//onClick: onClickMenu, 
								//onAnimate: onAnimate
								});
});
*/
function onAnimate(show) {
	//$(this).fadeIn('slow').show();
	if (show) {
		$(this)
			.css('visibility', 'hidden').show()
				.css('width', $(this).innerWidth())
			.hide().css('visibility', 'visible')
		.fadeIn('normal');
	} else {
		$(this).fadeOut('fast');
	}
}

var MENU_COUNTER = 1;
function loadMenu() {
	if (this.id == 'dynamicMenu') {
		$('> ul > li', this).remove();

		var ul = $('<ul></ul>');
		var t = MENU_COUNTER + 10;
		for (; MENU_COUNTER < t; MENU_COUNTER++) {
			$('> ul', this).append('<li>Item ' + MENU_COUNTER + '</li>');
		}
	}
}

function unloadMenu() {
	if (MENU_COUNTER >= 30) {
		MENU_COUNTER = 1;
	}
}

// We're passed a UL
function onHideCheckMenu() {
	return !$(this).parent().is('.LOCKED');
}

// We're passed a LI
function onClickMenu() {
	$(this).toggleClass('LOCKED');
	return true;
}
function startBannerRoll(file){
	$.file = file;
//alert("Siamo in fase di test. Ci scusiamo per l\'inconveniente.\n"+file);
	$().ajaxStop(function(){
		var call="$.timedCount('" + $.file + "')";
		t=setTimeout(call,4000);
	});
}
$.timedCount=function(file){
	//var call="timedCount('" + file + "')";
	//alert("Siamo in fase di test. Ci scusiamo per l\'inconveniente.\n"+file);
	$("#mainBanner").load("components/showBanners.asp?nome_file=" + file + "&" + Math.random(10));
	//t=setTimeout(call,6000)
}
function setSessionLanguage(lang){
	$("#language").load("components/sessionLanguage.asp?language=" + lang);
}
function getSessionLanguage(){
	$.ajax({
		url: "components/sessionLanguagetest.asp",
		cache: false,
		seccess: function(html){
			currentLanguage = html;
		}
	});
}
$(document).ready(function(){
	$('ul.jd_menu').jdMenu({onShow: loadMenu
							//onHideCheck: onHideCheckMenu,
							//onHide: onHideMenu, 
							//onClick: onClickMenu, 
							//onAnimate: onAnimate
							});
	$("#menuInfo").load("components/menu_pagine_new.asp");
	$("#userActions").load("components/user_actions.asp?" + Math.random(10));
	$("#boxRicerca").load("components/ricerca.asp?" + Math.random(10));
	$("#prepage").hide();
	$("#container").removeClass();
});