//funzione visualizza data corrente client.
function visData(){
var days=new Array("Domenica","Luned&igrave;","Marted&igrave;","Mercoled&igrave;","Gioved&igrave;","Venerd&igrave;","Sabato");
var months=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");
var dateObj=new Date();
var lmonth=months[dateObj.getMonth()];
var anno=dateObj.getFullYear();
var date=dateObj.getDate();
var wday=days[dateObj.getDay()];
document.write(" " + wday + " " + date + " " + lmonth + " " + anno);}


var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);

var NS6 = (bName == "Netscape" && bVer >=5 && bVer < 7); //alternativa check su getElementById
var NS4= document.layers;
var IE4=  document.all;

//LAYER SWITCHING CODE

     if (NS4) {
       layerStyleRef="layer.";
       layerRef="document.layers[";
       styleSwitch="]"; layerDoc=".document."
     }
	 else if (IE4) {
        layerStyleRef="layer.style.";
        layerRef="document.all[";
        styleSwitch="].style"; layerDoc=".";
     }
	 else if (NS6) { 
       layerStyleRef="style.";
       layerRef="document.getElementById(";
       styleSwitch=").style"; layerDoc=".";
     }	
     else {
		//vedi un po' tu che vuoi fare. Se uno ha un browser per conto suo?
     }

	 menutop = new Array ()
menutop[0]="menuopenso";
menutop[1]="menuopenco";
menutop[2]="menuopenlp";
menutop[3]="menuopenbp";
menutop[4]="Pmenuopenso";
menutop[5]="Pmenuopenpo";
menutop[6]="Pmenuopenbp";
 
function showLayer(layerName){
        if (NS4 || IE4 || NS6) {
                eval(layerRef+'"'+layerName+'"'+styleSwitch+'.visibility="visible"');
        }       
}
        
   function hideLayer(layerName){
        if (NS4 || IE4 || NS6) {
                eval(layerRef+'"'+layerName+'"'+styleSwitch+'.visibility="hidden"');
                }       
        }
		
		function hideAll () {
	for (i_loc=0; i_loc < menutop.length; i_loc ++) {
		hideLayer (menutop[i_loc]);
	}return false;
}



function setVariables(){
if (navigator.appName == "Netscape") {
if (parseInt(navigator.appVersion) >= 5){v=".top=";h=".left=";dS="document.getElementById(\"";sD="\").style";
y="window.pageYOffset";x="window.pageXOffset";}
else {v=".top=";h=".left=";dS="document.";sD="";
y="window.pageYOffset";x="window.pageXOffset";}
}
else {h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style";
y="document.body.scrollTop";x="document.body.scrollLeft";}checkLocationA()}
movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0
function checkLocation(){
object="object1";yy=eval(y);xx=eval(x);ydiff=ystart-yy;xdiff=xstart-xx;
if ((ydiff<(-1))||(ydiff>(1))) movey=Math.round(ydiff/10),ystart-=movey
if ((xdiff<(-1))||(xdiff>(1))) movex=Math.round(xdiff/10),xstart-=movex
if (ystart>=130){eval(dS+object+sD+v+(ystart+10));
} else {eval(dS+object+sD+v+130);}


eval(dS+object+sD+h+xstart);
setTimeout("checkLocation()",10);
}

function checkLocationA(){ystart=eval(y);xstart=eval(x);}
var val50 =1936.27
var dec5 =2
var val51 =(1/val50)
var dec =2

function kommaclean(string){
        i=string.indexOf(",");
        while(i != -1)
        {
                string = string.substring(0,i) + '.' + string.substring(i+1, string.length);
                i=string.indexOf(",");
        }
        i=string.lastIndexOf(".");
        j=string.indexOf(".")
        while(j != i)
        {
                string = string.substring(0,j) + string.substring(j+1, string.length);
                i=string.lastIndexOf(".");
                j=string.indexOf(".");
        }
        return string;
}
function convert(f){
        invalstring = f.input.value
        invalstring = kommaclean(invalstring)
        inval = parseFloat(invalstring);
        if (f.direction.value=='fromeuro'){
                decuit = 3;
                decin  = 3
;
        }else{
                decuit = 3;
                decin  = 3;
                
        }
        inval = parseFloat(formatfloat(inval, decin))
        if (!(inval>0)){
                uitval = 0;
                inval  = 0;
        }else{
                if (f.direction.value=='fromeuro'){
                uitval = inval * val50 + 0.005;
                }else{
                uitval = inval * val51 + 0.005;
                }
        }
        f.result.value=formatfloat(uitval,decuit);
        f.input.value=formatfloat(inval,decin);
}
dec = 3
function formatfloat(fl, dec){
        str=""+fl;
        i = str.indexOf(".");
        if (i<0){
                i=str.length;
                str=str+".00000000000";
        }else{
                if(i==0){
                        i=1;
                        str="0"+str;
                }else{
                        str=str+"00000000000";
                }
        }
        return str.substring(0,i+dec);
}
function newwin (url) {
	window.open(url);
}
function apripopup(purl,ptitle,pwidth,pheight,presisable){

window.open(purl,ptitle,'width='+pwidth+',height='+pheight+',location=0,menubar=0,personalbar=0,resizable='+presisable+',toolbar=0,status=0,scrollbars=1');
return false;
}
function rnd_logo() {
	var now = new Date();
	// incrementare di 1 n_logos quando si aggiunge un nuovo logo
	var n_logos = 6;
	var sec_divide = now.getSeconds();
	rnd_number = (sec_divide % n_logos) + 1;
	document.write("<a href=\"http://www.poste.it\" target=\"_top\"><img src=\"/img/tb/logo_foto0", rnd_number, ".jpg\" width=\"245\" height=\"46\" border=\"0\" alt=\"Foto logo\"></a>");
}
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 (nomeCookie) {
	var arg = nomeCookie + "=";
	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 write_style_tag() {
	cok = "PIlayout"
	val = GetCookie(cok)
	if (val == 2) {document.write("<link rel=\"stylesheet\" href=\"global_grande.css\">")}
	else {document.write("<link rel=\"stylesheet\" href=\"global.css\">")}
}

