﻿// JavaScript Document
var pagi = ''; /* pagina corrente*/
var lang = ''; /* lingua corretnte*/

function pause(a) 
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); } 
while(curDate-date < a);
}

function pausa(a) 
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); } 
while(curDate-date < a);
} 

function mxnosi()
	{if(document.getElementById) {
	var aa=mxnosi.arguments;
	for(i=0; i<aa.length; i+=2)
	{
	if (aa[i+1]==0){m='none';} else {m='';}
	if (document.getElementById(aa[i])) {document.getElementById(aa[i]).style.display = m;}
	}
	}}
	
function menuclose()
	{if(document.getElementById) {
	for(i=16; i<19; i++)	{
	eval("document.getElementById('me_"+i+"').style.display = 'none'");		
	}
	}}

function menuopen(a,b)
	{if(document.getElementById) {
	menuclose();
	if (a!=0) {
	bb = b+a;
	//alert(a+' - '+b+' - '+bb);
	for(i=a; i<bb; i++)	{
	eval("document.getElementById('me_"+i+"').style.display = ''");		
	}}
	}}
	
var cl_act = "";

function cl_overk(a)
	{if(document.getElementById) {
	cl_act = a.className;
	a.className='m-titlk';
	}}
	
function cl_overs(a)
	{if(document.getElementById) {
	cl_act = a.className;
	a.className='m-subtk';
	}}

function cl_out(a)
	{if(document.getElementById) {
	a.className=cl_act;
	}}
	
var CookiesAcc = false;
if(document.cookie == '') {
    document.cookie = 'CookiesAcc=yes';
    if(document.cookie.indexOf('CookiesAcc=yes') != -1) {
	CookiesAcc = true; 
    }
} else {
  CookiesAcc = true;
}
	
function CookieSet (name, value, hours, path, domain, secure) {
    if (CookiesAcc) {
	var not_NN2 = (navigator && navigator.appName 
		       && (navigator.appName == 'Netscape') 
		       && navigator.appVersion 
		       && (parseInt(navigator.appVersion) == 2))?false:true;

	if(hours && not_NN2) { 
	    if ( (typeof(hours) == 'string') && Date.parse(hours) ) { 
		var numHours = hours;
	    } else if (typeof(hours) == 'number') { 
		var numHours = (new Date((new Date()).getTime() + hours*3600000)).toGMTString();
	    }
	}
	document.cookie = name + '=' + escape(value) + ((numHours)?(';expires=' + numHours):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':''); 
    } else {
	/* cookie_acc();	
	mxnosi('no_cookie','1','accesso','0'); */
	}
} 

function CookieRead(name) {
    if(document.cookie == '') {
	return false; 
    } else { 
	var CharA, CharZ;
	var CookieTot = document.cookie;
	CharA = CookieTot.indexOf(name);	
	var NN2Hack = CharA + name.length;
	if((CharA != -1) && (CookieTot.charAt(NN2Hack) == '=')) {
	    CharA += name.length + 1;
	    CharZ = CookieTot.indexOf(';', CharA);
	    if(CharZ == -1) CharZ = CookieTot.length;
	    return unescape(CookieTot.substring(CharA, CharZ));
	} else { 
	    return false;
	}
    }	
}

function pagereload() {
document.location.reload()
}

/*  ------------------------------------   messages  */

var a_x = new Array(0, 1, 2, 4, 4, 4, 8, 8, 8, 8);
var a_y = new Array(0, 1, 2, 2, 4, 6, 2, 4, 6, 8);
var a_z = new Array('#FFFFFF', '#FFE16C', '#BFFFBF', '#D5FFFF', '#FF0000', '#00FF00','#0000FF');

var msg_over = 0;

function msg_bclear(a) 
	{if(document.getElementById) {
	if (a==0) {msg_over = 0;} else {msg_over = 1;}
	}}

function msg_apri(a,b,c,f,d,e) 
	{if(document.getElementById) {
	var bx =  0;
	CTnome = '';
	if(CookieRead(e)) {
	bx = CookieRead(e);}
	else {var bx = b;}
	pause(300);
	if (bx > 0) {
		bx = (bx-1);
		CookieSet (e,bx,d);
		msg_idset(a_x[a],a_y[a],a_z[c],a_z[f]);
		setTimeout("mxnosi('msg', 1)",100);
		if (msg_over == 1) {setTimeout("mxnosi('msg_over',0)",300);}
		}
	}}

function msg_idset(w,h,kc,bc) 
	{if(document.getElementById) {
		var ww = w+'00px';
		var bb = '-'+w/2+'00px';
		var hh = h+'00px';
		document.getElementById('msg').style.width = ww;
		document.getElementById('msg').style.marginLeft = bb;
		document.getElementById('msg').style.backgroundColor = kc;
		document.getElementById('msg').style.borderColor = bc;
		document.getElementById('alte').height = hh;
	}}
	
function msg_chiu() 
	{if(document.getElementById) {
	mxnosi('msg', 0);
	if (msg_over == 1) {mxnosi('msg_over',1);}
	}}

/*   ------------------------------  */





/* if style riactivate



function modifyStyle(a,b) {
	var aa = '';
	var bb = '';
	if ((a!='x')&&(CookieRead('BeaulieuFonts'))) {aa = CookieRead('BeaulieuFonts');}
	if ((b!='x')&&(CookieRead('BeaulieuColors'))) {bb = CookieRead('BeaulieuColors');}
	if ((a)&&(a!='')&&(a!='x')) {aa = a;}
	if ((b)&&(b!='')&&(b!='x')) {bb = b;}
	eval("changeStyle('"+aa+"','"+bb+"')");
	}

function getAllSheets() {
	if( !window.ScriptEngine && navigator.__ice_version ) { return document.styleSheets; }
	if( document.getElementsByTagName ) { var Lt = document.getElementsByTagName('link'), St = document.getElementsByTagName('style');
	} else if( document.styleSheets && document.all ) { var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
	} else { return []; } for( var x = 0, os = []; Lt[x]; x++ ) {
		var rel = Lt[x].rel ? Lt[x].rel : Lt[x].getAttribute ? Lt[x].getAttribute('rel') : '';
		if( typeof( rel ) == 'string' && rel.toLowerCase().indexOf('style') + 1 ) { os[os.length] = Lt[x]; }
	} for( var x = 0; St[x]; x++ ) { os[os.length] = St[x]; } return os;
	}
	
function changeStyle() {
	window.userHasChosen = window.MWJss;
	for( var x = 0, ss = getAllSheets(); ss[x]; x++ ) {
		if( ss[x].title ) { ss[x].disabled = true; }
		for( var y = 0; y < arguments.length; y++ ) { if( ss[x].title == arguments[y] ) { ss[x].disabled = false; } }
	if (arguments[0]!='') {CookieSet('BeaulieuFonts',arguments[0],8760);} else {CookieSet('BeaulieuFonts','',0);}
	if (arguments[1]!='') {CookieSet('BeaulieuColors',arguments[1],8760);} else {CookieSet('BeaulieuColors','',0);}
	}}

function initStyle()
	{
	var a = '';
	var b = '';
  	if(CookieRead('BeaulieuFonts')) {a = CookieRead('BeaulieuFonts');}
  	if(CookieRead('BeaulieuColors')) {b = CookieRead('BeaulieuColors');}
	eval("changeStyle('"+a+"', '"+b+"')");	
	}
*/