<!-- hide show listino !-->
function show_listino() {
	document.getElementById("div_listino").style.display="block";
}
function hide_listino() {
	document.getElementById("div_listino").style.display="none";
}

<!-- da flash !-->
function showAlert(msg){
	alert(msg);
}
function openPopUP(url, name, feature){
	open(url, name, feature);
}
function showConfirm(msg) {
	var x;
	x=confirm(msg);
//alert("---"+x+"---");
	return x;
}

<!-- change image on rollover !-->
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

<!-- MISC !-->

function highlight(who) {
    who.style.backgroundColor="#CBC8C8"
}
function normal(who) {
    who.style.backgroundColor="#FFFFFF"
}
function highlightmenu(who) {
    who.style.backgroundColor="#000000"
	who.style.color="#FFFFFF";
}
function normalmenu(who) {
    who.style.backgroundColor=""
	who.style.color="#5b5b5b";
}

function highlightcontrolpanel(who) {
    who.style.border="2px solid #834848"
}
function normalcontrolpanel(who) {
    who.style.border="2px solid #FFFFFF"
}


function changebrochure(filename) {
	document.getElementById(filename).style.display="block";
}


function display_block(blockID) {
	document.getElementById(blockID).style.display = "block";
	if (document.getElementById('action_'+blockID)) {
		document.getElementById('action_'+blockID).style.display = "block";
	}	
	document.getElementById('hs_'+blockID).innerHTML = "<a href=\"#\" onClick=\"hide_block('"+blockID+"');\"><img border=\"0\" src=\"images/icon/18x18/minimize.png\" alt=\"Hide\" title=\"Hide\"></a>";		

	if (document.getElementById('save_'+blockID)) {
		document.getElementById('save_'+blockID).innerHTML = "<a href=\"index.php?op=savelayout&blockcode="+blockID+"&status=show\"><img border=\"0\" src=\"images/icon/18x18/anchor.png\" alt=\"Blocca\" title=\"Blocca\"></a>";		
	}
}
function hide_block(blockID) {
				
	document.getElementById(blockID).style.display = "none";
	if (document.getElementById('action_'+blockID)) {
		document.getElementById('action_'+blockID).style.display = "none";
	}
	document.getElementById('hs_'+blockID).innerHTML = "<a href=\"#\" onClick=\"display_block('"+blockID+"');\"><img border=\"0\" src=\"images/icon/18x18/maximize.png\" alt=\"Show\" title=\"Show\"></a>";		

	if (document.getElementById('save_'+blockID)) {
		document.getElementById('save_'+blockID).innerHTML = "<a href=\"index.php?op=savelayout&blockcode="+blockID+"&status=hide\"><img border=\"0\" src=\"images/icon/18x18/anchor.png\" alt=\"Blocca\" title=\"Blocca\"></a>";		
	}
}


function display_menu(blockID) {
	document.getElementById(blockID).style.display = "block";
	document.getElementById('hs_'+blockID).innerHTML = "<a href=\"#\" onClick=\"hide_menu('"+blockID+"');\"><img border=\"0\" src=\"images/icon/18x18/minimize.png\"></a>";		
}
function hide_menu(blockID) {
	document.getElementById(blockID).style.display = "none";
	document.getElementById('hs_'+blockID).innerHTML = "<a href=\"#\" onClick=\"display_menu('"+blockID+"');\"><img border=\"0\" src=\"images/icon/18x18/maximize.png\"></a>";		
}

function show_help(helpID,width,height) {
	window.scrollbar=0;
	
	if ( window.screen ) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
	
		var xc = ( aw - width ) / 2;
		var yc = ( ah - height ) / 2;
	
	} 
	document.getElementById('help_'+helpID).style.left=xc;
	document.getElementById('help_'+helpID).style.top=yc;
	document.getElementById('help_'+helpID).style.width=width;
	document.getElementById('help_'+helpID).style.height=height;
	
	document.getElementById('overlayer').style.display = "block";	
	document.getElementById('help_'+helpID).style.display = "block";
}
function close_help(helpID) {

	document.getElementById('overlayer').style.display = "none";	
	document.getElementById('help_'+helpID).style.display = "none";
}	

//-->

<!-- auto change video thumb !-->
var checktimeout;
function startloopthumb(id,pic,filepic,filepath) { 
	var str_img;
	if (pic.indexOf("_1.png")>0) {
		str_img=filepath+filepic+"_2.png";
	}
	else if (pic.indexOf("_2.png")>0) {
		str_img=filepath+filepic+"_3.png";
	}
	else if (pic.indexOf("_3.png")>0) {
		str_img=filepath+filepic+"_4.png";
	}
	else if (pic.indexOf("_4.png")>0) {
		str_img=filepath+filepic+"_5.png";
	}
	else {
		str_img=filepath+filepic+"_1.png";
	}		
	document.getElementById(id).src=str_img;
	checktimeout=setTimeout("startloopthumb('"+id+"','"+str_img+"','"+filepic+"','"+filepath+"')",800);
}
function stoploopthumb() { 
	clearTimeout(checktimeout);
}

<!-- tooltip personalizzato !-->
var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 300;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				/* c.style.border='1px solid #CCCCCC'; */
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');				
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();

<!-- js per login low --!>
	function close_login() {		
		document.getElementById('overlayer').style.display = "none";
		document.getElementById('div_login').style.display = "none";
	}
	function show_login(width,height,tipo) {
		window.scrollbar=0;
		width=870;
		height=500;
		if ( window.screen ) {
			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;
		
			var xc = ( aw - width ) / 2;
			var yc = ( ah - height ) / 2;
		
		}
		document.getElementById('div_login').style.left=xc;
		document.getElementById('div_login').style.top=yc;
		document.getElementById('div_login').style.width=width;
		document.getElementById('div_login').style.height=height;
		
		document.getElementById('overlayer').style.display = "block";
		document.getElementById('div_login').style.display = "block";
		if (tipo=='webtv') {
			loginaswebtv();
		}
		else if (tipo=='user') {
			loginasuser();
		}
		else {
			loginchoise();		
		}
	}
	
	function close_login(redirect) {
		document.getElementById('overlayer').style.display = "none";
		document.getElementById('div_login').style.display = "none";
	}	
	function loginchoise() {
		document.getElementById("tdchoise").style.backgroundColor = "#CCCCCC";
        document.getElementById("tdchoise").style.borderBottom = "0px";		

		document.getElementById("tduser").style.backgroundColor = "#999999";
        document.getElementById("tduser").style.borderBottom = "2px solid #FFFFFF";		

		document.getElementById("tdwebtv").style.backgroundColor = "#999999";
        document.getElementById("tdwebtv").style.borderBottom = "2px solid #FFFFFF";		
	
		document.getElementById('loginchoise').style.display = "block";
		document.getElementById('loginasuser').style.display = "none";
		document.getElementById('loginaswebtv').style.display = "none";
	}	
	function loginasuser() {
		document.getElementById("tduser").style.backgroundColor = "#CCCCCC";
        document.getElementById("tduser").style.borderBottom = "0px";		

		document.getElementById("tdwebtv").style.backgroundColor = "#999999";
        document.getElementById("tdwebtv").style.borderBottom = "2px solid #FFFFFF";		

		document.getElementById("tdchoise").style.backgroundColor = "#999999";
        document.getElementById("tdchoise").style.borderBottom = "2px solid #FFFFFF";		
	
		document.getElementById('loginasuser').style.display = "block";
		document.getElementById('loginaswebtv').style.display = "none";
		document.getElementById('loginchoise').style.display = "none";
	}	
	function loginaswebtv() {
		document.getElementById("tdwebtv").style.backgroundColor = "#CCCCCC";
        document.getElementById("tdwebtv").style.borderBottom = "0px";		

		document.getElementById("tduser").style.backgroundColor = "#999999";
        document.getElementById("tduser").style.borderBottom = "2px solid #FFFFFF";		

		document.getElementById("tdchoise").style.backgroundColor = "#999999";
        document.getElementById("tdchoise").style.borderBottom = "2px solid #FFFFFF";		

		document.getElementById('loginaswebtv').style.display = "block";
		document.getElementById('loginchoise').style.display = "none";
		document.getElementById('loginasuser').style.display = "none";
	}	

	function close_loginwebtv() {		
		document.getElementById('overlayer').style.display = "none";
		document.getElementById('div_loginwebtv').style.display = "none";
	}
	function show_loginwebtv(width,height) {
		window.scrollbar=0;		
		document.getElementById('overlayer').style.display = "block";
		document.getElementById('div_loginwebtv').style.display = "block";
	}
	
	function close_loginuser() {		
		document.getElementById('overlayer').style.display = "none";
		document.getElementById('div_loginuser').style.display = "none";
	}
	function show_loginuser(width,height) {
		window.scrollbar=0;		
		document.getElementById('overlayer').style.display = "block";
		document.getElementById('div_loginuser').style.display = "block";
	}

function previewLogo(idFile,idAccount) {
	alert(document.getElementById("preview").src+"--");
	document.getElementById(idAccount).src=document.getElementById(idFile).value;
}

<!-- server date !-->
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}

function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var datestring=padlength(serverdate.getDate())+" "+montharray[serverdate.getMonth()]+" "+serverdate.getFullYear()
var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds())
document.getElementById("servertime").innerHTML=datestring+" ore "+timestring
}

//window.onload=function(){
//setInterval("displaytime()", 1000)
//}

//////////////////////////////////////////////////////////////////////
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
 
};
BrowserDetect.init();
