function $f(id){
	return document.getElementById(id);
}


// 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";
	} 
}
window.onload = target;


function makeToolbar(LEVEL1,LEVEL2){
	if((LEVEL2 != '') && (LEVEL2 != 'generico') && (LEVEL2 != null)){
		$('#site img:first-child').replaceWith('<img src="http://webcenter.tiscali.it/distribuzione/_loghi/v002/'+LEVEL2+'.gif" alt="Tiscali '+LEVEL2+'"/>');
		var urlSection = LEVEL2;
		if (LEVEL2 == 'scienze'){urlSection = 'scienza';}
		if (LEVEL2 == 'rubriche'){urlSection = 'opinioni';}
		if (LEVEL2 == 'curiosita'){urlSection = 'stranomavero';}
		$('#site').attr('href','http://notizie.tiscali.it/'+urlSection+'/');
	}
	
	$("li#"+LEVEL1+" > a:first-child").attr("class","tabActive" );
	$("li#"+LEVEL1+" > ul").css({'display':''});	
	$("ul > li#"+LEVEL2+" > a:first-child").attr("class","subActive" );	
}
/* MULTIPAGINA 2 LIVELLI */
function multipage(page){
	$("input[name='page']").val(page);
	document.getElementById('multipage').submit();	
}

	function cLabel(id,css,tot,label,callaback,callbackParam){
		var labelVideo   = new Array ('video','gallery','tv','radio');
		for(i=0; i<tot; i++){
			if(id == i){
				if(css != 'v'){
					$f(''+label+''+id+'').className = css+'-active';
				}
				else{
					if(id < 3) $f(''+label+''+id+'').className = css+'-active';
					else $f(''+label+''+id+'').className = css+'-active-dx';
				}
			}
			else{
				if(css != 'v')	$f(''+label+''+i+'').className = css+'-n-active';
				else{
					if(i < 3) $f(''+label+''+i+'').className = css+'-n-active';
					else $f(''+label+''+i+'').className = css+'-n-active-dx';
				}
			}
		}
		var urlBox = '/FEED2/homepage/video-multi/'+labelVideo[id]+'.v002.html';
		var divTrg = 'videoLoad';	
		eval(callaback)(callbackParam,id,urlBox,divTrg);  		
	}
	
	function htmlLoad(type,id,urlBox,divTrg){
	$.ajax({		
		type: "POST",
		url: urlBox,
		data:"",
		dataType: "html",
		beforeSend  :function(){},
		success: function(html){
			$("#"+divTrg).html(html);	
	   	}
	   	
	});	
}



