
window.onerror = null;
window.defaultStatus = '';

var N = navigator.appName;
var V = parseInt(navigator.appVersion);
var loaded=0;
var n3 = (N == "Netscape" && V < 4);
var i3 = (N == "Microsoft Internet Explorer" && V < 4);
var n4 = (N == "Netscape" && V >= 4);
var i4 = (N == "Microsoft Internet Explorer" && V >= 4);

if (n3 || i3)
{
	window.location = "/best_view.htm";
}

function popupOpenDim(theUrl,theTarget, wDim, hDim)
{
	openWindow = window.open(theUrl, theTarget, "toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,left=1,top=1,width="+wDim+",height="+hDim);
	openWindow.focus();
}

function popupOpenScr(theUrl,theTarget, wDim, hDim)
{
	openWindow = window.open(theUrl, theTarget, "toolbar=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,left=1,top=1,width="+wDim+",height="+hDim);
//	openWindow.focus();
}

function popupOpenTlbScr(theUrl,theTarget, wDim, hDim)
{
	openWindow = window.open(theUrl, theTarget, "toolbar=yes,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no,left=1,top=1,width="+wDim+",height="+hDim);
//	openWindow.focus();
}

function oggi()
{
	var  d  = new Date ();
	var gs  = d.getDay();
	var gg  = d.getDate();
	var mm  = d.getMonth()+1;
	var aa  = d.getFullYear();
	var hh  = d.getHours();
	var min = d.getMinutes();

	var giorni = new Array("Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato");
	var mesi = new Array("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto","Settembre",
						"Ottobre","Novembre","Dicembre");

	if (gg < 10)
		gg = "0"+gg;

	if (mm < 10)
		mm = "0"+mm;

	if (hh < 10)
		hh = "0"+hh;

	if (min < 10)
		min = "0"+min;

	document.write (giorni[gs]+ " " +gg+" "+mesi[mm-1]+" "+aa);
}

function jumpTo(oPath)
{
	var index = document.jumper.jump.selectedIndex;
	var val = document.jumper.jump.options[document.jumper.jump.selectedIndex].value;
	switch(val) {
		case '0':
			document.location.href = oPath + '/a1amm/hpf01.jsp';
			break;
		case '1':
			document.location.href = oPath + '/a1amm/hpf02.jsp';
			break;
		case '2':
			document.location.href = oPath + '/a1amm/hpf03.jsp';
			break;
		case '3':
			document.location.href = oPath + '/a1amm/hpf04.jsp';
			break;
		case '4':
			document.location.href = oPath + '/a1amm/hpf12.jsp';
			break;
		case '5':
			document.location.href = oPath + '/a1amm/hpf08.jsp';
			break;
		case '6':
			document.location.href = oPath + '/a1amm/hpf07.jsp';
			break;
		case '7':
			document.location.href = oPath + '/a1amm/hpf09.jsp';
			break;
		case '8':
			document.location.href = oPath + '/a1amm/hpf11.jsp';
			break;
		case '9':
			document.location.href = oPath + '/a1amm/hpf11.jsp';
			break;
	}
}

function addBookmark(url)
{
	if ( document.all )
	{
		var description = "Sanpaolo Imprese";
		var URL = new String(url);

		if ( URL.indexOf("a1amm") >= 0 )
			description = "Sanpaolo IMI Imprese - Amministrazione e Finanza";
		if ( URL.indexOf("a2est") >= 0 )
			description = "Sanpaolo IMI Imprese - Estero";
		if ( URL.indexOf("a3pro") >= 0 )
			description = "Sanpaolo IMI Imprese - Produzione e Logistica";
		if ( URL.indexOf("a4mer") >= 0 )
			description = "Sanpaolo IMI Imprese - Marketing e Vendite";
		if ( URL.indexOf("a5inf") >= 0 )
			description = "Sanpaolo IMI Imprese - I C T e R & S";
		if ( URL.indexOf("a6ris") >= 0 )
			description = "Sanpaolo IMI Imprese - Risorse umane";
		if ( URL.indexOf("poe") >= 0 )
			description = "Sanpaolo IMI Imprese - Piccole Imprese e Professionisti";

		window.external.AddFavorite(url, description);
	}
	else
		alert("Ricordati di aggiungere questa pagina ai bookmark.\nDopo aver premuto OK, premi CTRL + D.");
}


function popupOpenSegnala(theUrl,theTarget,wDim,hDim)
{
	var w = 800, h = 600;

	if (document.all || document.layers)
	{
		w = screen.availWidth;
 		h = screen.availHeight;
	}

	var leftPos = (w-wDim)/2, topPos = (h-hDim)/2;
	openWindow = window.open(theUrl,theTarget,'toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,width=' + wDim + ',height=' + hDim + ',top=' + topPos + ',left=' + leftPos);
}


//
// [GA] 03/03/2003 funzioni per le celle di hmenu
//
function hideMenuLayer(chi) {

	if(document.layers)	   //NN4+
    {
       document.layers[chi].visibility = "hidden";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(chi);
        obj.style.visibility = "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[chi].style.visibility = "hidden";
    }


}

function showMenuLayer(chi) {
	if(document.layers)	   //NN4+
    {
       document.layers[chi].visibility = "visible";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(chi);
        obj.style.visibility = "visible";
    }
    else if(document.all)	// IE 4
    {
        document.all[chi].style.visibility = "visible";
    }
}

//
// [FV - AG] 23/04/2003 Cartografia filiali imprese
//
function doFilialiCartografia(m_codFiliale)
{
	document.frmCartografiaFiliali.m_codFiliale.value = m_codFiliale;
	document.frmCartografiaFiliali.target = "cartografia";
	popupOpenDim("javascript:document.write('Caricamento in corso...');", "cartografia", 720, 590);
	document.frmCartografiaFiliali.submit();
	return;
}

//
// [SG] 03/05/2005 Ridimenzionamento di un'immagine (vetrina di links).
//
	function resizeImg(img,width,height)
	{
		var w = img.width;
		var h = img.height;
		if (w==0 || h==0){
			img.height=50;
			return;
			}
		//scale = w/h;
		if (w>=h){
			img.width=Math.min(img.width,width);
			//img.height=img.width/scale;
			}
		else{
			img.height=Math.min(img.height,height);
			//img.width=img.height*scale;
			}
	}
	
	function alertImgSize(img)
	{
		var w = img.width;
		var h = img.height;
		if(w>200)
			alert("Larghezza immagine superiore al valore consigliato");
		if(h>200)
			alert("Altezza immagine superiore al valore consigliato");
	}
