function makeToolbar(LEVEL1,LEVEL2){
	
	
	$("li#"+LEVEL1+" > a:first-child").attr("class","tabActive" );
	$("li#"+LEVEL1+" > ul").css({'display':''});	
	$("ul > li#"+LEVEL2+" > a:first-child").attr("class","subActive" );	
}



function image(id){
   eval("$f('"+id+"').style.display = 'none'");    
}

	function $f(id){
		return document.getElementById(id);
	}
	
	// fai di tiscali
	function hp() {
		var error = "Il tuo browser non supporta l'impostazione automatica\n della HomePage. Occorre impostarla manualmente.";
		if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
			fdt.style.behavior = "url('#default#homePage')"
			fdt.setHomePage("http://www.tiscali.it");
			return true;
		}
		else{
		  alert(error);
		}
	}
	
	// target blank
	function target() { 
		for (var i=0; i<document.links.length; i++){
			if(document.links[i].className.indexOf('blank') != -1)document.links[i].target="_blank";
			if(document.links[i].href.indexOf('http://photogallery.tiscali.it') != -1)eval("document.links[i].onclick = function(){SetCookie('hrGal','http://www.tiscali.it/,0','','/','tiscali.it','');}");
		} 
		document.body.onclick = clickDetect;
	}
	
// layer dati societari
function datiSocietari(action){
	if(action == 'show') $f('layerDs').style.display='block';
	else if(action == 'hide') $f('layerDs').style.display='none';
}
	
	



// src
function src(t,w){
	var q=$f('frm_src').key.value;
	if(t == 'news')	setTimeout(document.location.href="http://searchnews.tiscali.it/search.php?q="+q,500);
	else if(t == 'pg') setTimeout(document.location.href="http://search.tiscali.it/?tiscalitype="+t+"&collection="+t+"&cosa="+q+"&dove=",500);
	else setTimeout(document.location.href="http://search.tiscali.it/?engine=hp&tiscalitype="+t+"&collection="+w+"&q="+q,500);
}
	
	
	
	
	function htmlLoad(type,id,urlBox,divTrg){	
	$.ajax({		
		type: "POST",
		url: urlBox,
		data:"",
		dataType: "html",
		beforeSend  :function(){},
		success: function(html){
			$("#"+divTrg).html(html);			
	   	}
	   	
	});	
	}
	
	
	// makeAd
	var TiscaliAdRandomNumber=Math.floor(Math.random()*10000000000);
	var TiscaliAdTileNumber=0;
	function makeAD(canale,area,rich,pos,size,kw) {
	if ($f('banner'+size+pos)) {
	document.write('<scr'+'ipt id="mk'+size+pos+'" src="http://ad.it.doubleclick.net/adj/'+canale+(area?'/'+area:'')+(rich?';dcopt=ist':'')+';pos='+pos+(GetCookie("CLASS")?';class='+
	GetCookie("CLASS"):'')+(kw?';kw='+kw:'')+';tile='+(++TiscaliAdTileNumber)+';sz='+size+';ord='+TiscaliAdRandomNumber+'?"></scr'+'ipt>');
	}
	} 

	// Funzione moveBanner 1.0
	var isOpera = (navigator.userAgent.indexOf('Opera') > -1)?1:0;
	function moveBanner(id) {
		var target = $f('banner'+id);
		var source = $f('banner'+id+'hide');
		if (target && source) {
			source.removeChild($f('mk'+id));
			if (isOpera) {
				target.innerHTML=source.innerHTML;
				source.innerHTML='';
			} else {
				target.innerHTML='';
				target.appendChild(source);
				source.style.display='block';   
			}
		}
	}

	//cookie
	function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}

	function GetCookie(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}return null;}

	function SetCookie(name,value,expires,path,domain,secure){
		var today = new Date();
		var expires_date = new Date();
		if (isFinite(expires)){
			expires_date.setTime(today.getTime() + 3600000*24*expires);
		}else{
			expires_date=expires;
			}
			document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires_date.toGMTString():"")+((path)?"; path="+path:"")+((domain)?";domain="+domain:"")+((secure)?"; secure":"");
	}
	function DeleteCookie(name,path,domain){if(GetCookie(name)){document.cookie=name+"="+((path)?"; path="+path:"")+((domain)?"; domain="+domain:"")+"; expires=Tue, 01-Jan-2002 00:00:01 GMT";}}	

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=550,left = 290,top = 237');");
}
/* MULTIPAGINA 2 LIVELLI */
function multipage(page){
	$("input[name='page']").val(page);
	document.getElementById('multipage').submit();	
}

