//////////////////////////////////////
// JavaScript 						 //
//  by BFM Computer					  //
//////////////////////////////////////

var waiting = false;

var IE = (document.all && navigator.appName.indexOf("Internet Explorer") >= 0);
var NS = (navigator.appName.indexOf("Netscape") >= 0);

// Cerca un element di nome [elemName] nel document [doc] (per default window.document)

function byId(elemName, doc)
{
	var obj = null;

	if(!doc) doc = document;

	if(doc.all) {
		obj = doc.all[elemName];
	}
	else if(doc.getElementsByTagName("*").length > 0) {
		obj = (doc.getElementsByTagName("*"))[elemName];
	}
	else if(doc.getElementById) {
		obj = doc.getElementById(elemName);
	}

	return obj;
}

function findFormElementByName(form, elemName)
{
	for(var i = 0; i < form.elements.length; i++) if(form.elements[i].name == elemName) return form.elements[i];
	return null;
}

function findFormByName(formName)
{
	for(var i = 0; i < document.forms.length; i++) if(document.forms[i].name == formName) return document.forms[i];
	return null;
}

function getElementGlobalPosition(elem)
{
	var obj = new Object();
	var x = elem.offsetLeft;
	var y = elem.offsetTop;

	while(elem = elem.offsetParent) {
		x += elem.offsetLeft - (elem.scrollLeft ? elem.scrollLeft : 0);
		y += elem.offsetTop - (elem.scrollTop ? elem.scrollTop : 0);
	}

	obj.x = (x ? x : 0);
	obj.y = (y ? y : 0);

	return obj;
}

function setObjPos(obj, x, y)
{
	if(!x) x = 0;
	if(!y) y = 0;

	obj.style.left = parseInt(x) + 'px';
	obj.style.top  = parseInt(y) + 'px';
	obj.style.pixelLeft = parseInt(x);
	obj.style.pixelTop  = parseInt(y);
}

function linkElem2Elem(divHelp, elem, dx, dy)
{
	if(divHelp && elem) {
		var pos = getElementGlobalPosition(elem);

		setObjPos(divHelp, pos.x + dx, pos.y + dy);
		divHelp.style.visibility = 'visible';
	}
}

function toggleComboVisibility(vis)
{
	var v = (document.getElementsByTagName ? document.getElementsByTagName("select") : document.all);

	if(v) {
		for(var i = 0; i < v.length; i++) {
			if(v[i].tagName == "SELECT") v[i].style.visibility = (vis ? 'visible' : 'hidden');
		}

		v = byId("flashcontent"); if(v) v.style.visibility = (vis ? 'visible' : 'hidden');
		v = byId("pdfPreview"); if(v) v.style.visibility = (vis ? 'visible' : 'hidden');
	}
}

function doAction(action, formName, fieldNames, fieldValues, silentMode)
{
	if(waiting) return;

	waiting = true;

	if(document.body.appendChild && !silentMode) {
		var div = document.createElement('div');
		var w = 240;
		var h = 70;

		div.id = 'WAITING';
		div.style.width = w + 'px';
		div.style.height = h + 'px';
		div.innerHTML = "<div style='font-size: 22px; padding-bottom: 8px;'>Attendere Prego</div>La vostra richiesta &egrave; stata inoltrata...";

		if(document.documentElement && document.documentElement.offsetWidth) {
			div.style.left = (document.documentElement.offsetWidth - w) / 2;
			div.style.top  = (document.documentElement.offsetHeight - h) / 2.5;
		}
		else {
			div.style.left = 100;
			div.style.top  = 80;
		}

		document.body.appendChild(div);
	}

	var form;

	if(formName && (form = findFormByName(formName))) {
		if(action) form.action = action;

		if(fieldNames != null && fieldValues != null) {
			if(fieldNames.substring || fieldValues.substring) {
				var elem = findFormElementByName(form, fieldNames);
				elem.value = fieldValues;
			}
			else {
				for(var i = 0; i < fieldNames.length; i++) {
					var elem = findFormElementByName(form, fieldNames[i]);
					elem.value = fieldValues[i];
				}
			}
		}

		if(form.onDoAction) form.onDoAction();

		form.submit();
	}
	else {
		document.location.href = action;
	}
}



function startDate(obj)
{
	if(obj) {
		var TDay   = new Array('Domenica', 'Lunedi', 'Martedi', 'Mercoledi', 'Giovedi', 'Venerdi',  'Sabato');
		var TMonth = new Array('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno',  'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre');
		var TDate  = new Date();

		// obj.innerHTML = TDay[TDate.getDay()] + ' ' +TDate.getDate() + ' ' + TMonth[TDate.getMonth()] + ' ' + TDate.getYear();
		obj.innerHTML = TDate.getDate() + ' ' + TMonth[TDate.getMonth()];
	}
}

function startClock()
{
	var obj = byId('tail1947');

	if(obj) {
		var tDate = new Date();
		var tHour = tDate.getHours();
		var tMins = tDate.getMinutes();
		var tSecs = tDate.getSeconds();

		obj.innerHTML = (tHour < 10 ? "0" : "") + tHour + (tSecs % 2 == 0 ? ":" : " ") + (tMins < 10 ? "0" : "") + tMins + "." + (tSecs < 10 ? "0" : "") + tSecs + "&nbsp;";

		setTimeout("startClock()", 1000);
	}
}

function openIcaWindow(db, qry, maxDocNo)
{
	openPopupWindow("icaQry", -1024, 0, "/icaro/default.jsp?icaDB=" + db + "&icaQuery=" + qry + (maxDocNo ? "&maxDocNo=" + maxDocNo : ""), true);
}

function openPopupWindow(wndName, _w, _h, cmd, resiz)
{
	var sw = (screen.availWidth ? screen.availWidth : 800);
	var sh = (screen.availHeight ? screen.availHeight : 600);

	var w = (_w <= 0 || _w > sw - 50 ? sw - 80 : _w); if(_w < 0 && w >= -_w) w = -_w;
	var h = (_h <= 0 || _h > sh - 100 ? sh - 140 : _h); if(_h < 0 && h >= -_h) h = -_h;

	var props = "dependent,scrollbars," + (resiz ? "resizable," : "");
	props += "left=" + ((sw - w) / 2) + ",top=" + ((sh - h) / 2 - 20) + ",";
	props += "width=" + w + ",height=" + h;

	return window.open(cmd, wndName, props);
}

function openDocument(docURL, wndName, unresizable)
{
	if(!wndName) wndName = 'docWindow';

	var w = openPopupWindow(wndName, -1200, 0, "/common/document.htm", !unresizable);

	eval(wndName + " = w");

	setTimeout("if(" + wndName + ") " + wndName + ".frameDoc.document.location = '" + docURL + "'", 1000);
}

function openNewPage(pageURL)
{
	if(pageURL) window.open(pageURL, "", "resizable,scrollbars,width=750,height=550,left=100,top=100");
}

function openSlideshow(params)
{
	openPopupWindow('slideshow', 720, 550, '/common/slideshow/default.jsp?' + params, false);

}

function openGallery()
{
	openPopupWindow('gallery', 0, 0, '/tour/gallery/default.htm', true);
}

function videoSeduta()
{
	openPopupWindow("videoWindow", 650, 500, "/sedute/video/default.jsp", false);
}

function videoEvento()
{
	openPopupWindow("videoWindow", 650, 500, "/informazione/video/default.jsp", false);
	//openDocument("/informazione/video/default.jsp", "videoWindow", true);
}

var creditsBack = null;
var creditsWnd = null;

function createElement(element)
{
	if(typeof document.createElementNS != 'undefined') {
		return document.createElementNS('http://www.w3.org/1999/xhtml', element);
	}

	return document.createElement(element);
}

function hideCredits()
{
	if(creditsWnd) {
		window.onresize = creditsWnd.oldResize;
		window.onscroll = creditsWnd.oldScroll;

		document.body.removeChild(creditsWnd);
		document.body.removeChild(creditsBack);

		creditsWnd = null;

		var _body = document.getElementsByTagName("body").item(0);
		var _html = document.getElementsByTagName("html").item(0);

		_body.style.overflow = ''; _body.style.height = '';
		_html.style.overflow = ''; _html.style.height = '';

		toggleComboVisibility(true);
	}
}

function showCredits()
{
	if(creditsWnd) return;

	var _body = document.getElementsByTagName("body").item(0);
	var _html = document.getElementsByTagName("html").item(0);

	_body.style.overflow = 'hidden'; _body.style.height = '100%';
	_html.style.overflow = 'hidden'; _html.style.height = '100%';

	_body.scrollTop = _body.scrollLeft = 0;

	creditsBack = createElement('div');
	creditsBack.id = "creditsBack";

	creditsWnd = createElement('div');
	creditsWnd.id = "creditsWnd";

	var ihtml = "";
	ihtml += "<div id='creditsTop'></div>";
	ihtml += "<div id='creditsScroll'>";
//	ihtml += 	"<div style='height: 100%;'></div>";
	ihtml += 	"<div class='crdJob'>Servizio</div>BFM Computer";
//	ihtml += 	"<div style='height: 100%;'></div>";
	ihtml += "</div>";

	creditsWnd.innerHTML = ihtml;
	creditsWnd.oldResize = window.onresize;
	creditsWnd.oldScroll = window.onscroll;

	window.onresize = function() {
		var y = parseInt((creditsBack.offsetHeight - creditsWnd.offsetHeight) / 2);
		creditsWnd.style.left = parseInt((creditsBack.offsetWidth - creditsWnd.offsetWidth) / 2) + 'px';
		creditsWnd.style.top = (y < 1 ? 1 : (y > 80 ? 80 : y));
	}

	creditsBack.onclick = creditsWnd.onclick = hideCredits;

	toggleComboVisibility(false);

	document.body.appendChild(creditsBack);
	document.body.appendChild(creditsWnd);

	window.onresize();

//	startDivScroll("creditsScroll", 50);
}

function startDivScroll(id, interval)
{
	var o = byId(id); if(!o || o.scrollTimer) return;
	o.scrollTimer = setInterval("divScroll('" + id + "')", interval ? interval : 50);
}

function stopDivScroll(id)
{
	var o = byId(id); if(!o || o.scrollTimer) return;
	if(o.scrollTimer) clearInterval(o.scrollTimer);
	o.scrollTimer = 0;
}

function divScroll(id)
{
	var o = byId(id); if(!o) return;
	var st = (o.scrollTop ? o.scrollTop : 0);

	o.scrollTop = st + 1;
	if(o.scrollTop == st) o.scrollTop = 0;
}

////////////////////////////
// Transitions
////////////////////////////

var transObjects = [];

function TransitionObject(obj, msec)
{
	this.idx = transObjects.length;
	this.obj = obj;
	this.msec = msec;
	this.timer = 0;
	this.trans = [];

	transObjects[this.idx] = obj;
}

function Transition(func, dx, stopAt, zeroValue)
{
	this.func = func;
	this.dx = dx;
	this.stopAt = stopAt;
	this.zeroValue = (zeroValue ? zeroValue : 0);
}

function startTrans(obj, msec, msecFirst, trans, endFunc)
{
	if(!obj) return;
	var trObj = obj.transObj;

	if(trObj) {
		trObj.msec = msec;
		if(trObj.timer) { clearTimeout(trObj.timer); trObj.timer = 0; }
	}
	else {
		trObj = obj.transObj = new TransitionObject(obj, msec);
	}

	trObj.endFunc = endFunc;

	for(var i = 0; i < trans.length; i++) {
		var t = trans[i];

		for(var j = 0; j < trObj.trans.length; j++) {
			var r = trObj.trans[j];

			if(r.func == t.func) {
				r.dx = t.dx;
				r.stopAt = t.stopAt;
				break;
			}
		}

		if(j == trObj.trans.length) {
			trObj.trans[j] = t;
		}
	}

	for(var j = 0; j < trObj.trans.length; j++) {
		trObj.timer = setTimeout("doTrans(" + trObj.idx + ")", msecFirst ? msecFirst : msec);
	}
}

function doTrans(idx)
{
	var obj = transObjects[idx];
	var trObj = obj.transObj;
	var trans = trObj.trans;
	var theEnd = 0;

	for(var i = 0; i < trans.length; i++) {
		var t = trans[i];
		var v = t.func(obj, null);

		if(v == null) v = t.zeroValue; else v -= t.zeroValue;

		if(v < t.stopAt) {
			if((v += t.dx) >= t.stopAt) { v = t.stopAt; theEnd++; }
		}
		else if(v > t.stopAt) {
			if((v -= t.dx) <= t.stopAt) { v = t.stopAt; theEnd++; }
		}
		else theEnd++;

		t.func(obj, v + t.zeroValue);
	}

	if(theEnd == trans.length) {
		trans = [];
		trObj.timer = 0;
		if(trObj.endFunc) { if(trObj.endFunc.substring) eval(trObj.endFunc); else trObj.endFunc(obj); }
	}
	else trObj.timer = setTimeout("doTrans(" + trObj.idx + ")", trObj.msec);
}

function alphaTrans(obj, value)
{
	if(value == null) {
		var f = obj.style.filter;
		var p = (f == null ? -1 : f.indexOf("="));
		return (p >= 0 ? parseInt(f.substring(p + 1)) : 100);
	}

	obj.style.filter = (value == 100 ? "" : "alpha(opacity=" + value + ")");
}

function flashTrans(obj, value)
{
	if(value == null) {
		var f = obj.flashCount;
		return (f ? f : 0);
	}

	obj.flashCount = value;
	obj.style.visibility = ((value % 2) == 0 ? 'visible' : 'hidden');
}

function horzTrans(obj, value)		{ if(value == null) { var t = obj.style.left; return (t ? parseInt(t) : null); } obj.style.left = value + 'px'; }
function leftPercTrans(obj, value)	{ if(value == null) { var t = obj.style.left; return (t ? parseInt(t) : null); } obj.style.left = value + '%'; }
function rightTrans(obj, value)		{ if(value == null) { var t = obj.style.right; return (t ? parseInt(t) : null); } obj.style.right = value + 'px'; }
function vertTrans(obj, value)		{ if(value == null) { var t = obj.style.top; return (t ? parseInt(t) : null); } obj.style.top = value + 'px'; }
function topPercTrans(obj, value)	{ if(value == null) { var t = obj.style.top; return (t ? parseInt(t) : null); } obj.style.top = value + '%'; }
function widthTrans(obj, value)		{ if(value == null) { var t = obj.style.width; return (t ? parseInt(t) : null); } obj.style.width = value + 'px'; }
function heightTrans(obj, value)		{ if(value == null) { var t = obj.style.height; return (t ? parseInt(t) : null); } obj.style.height = value + 'px'; }

function fontSizeTrans(obj, value)
{
	if(value == null) { var t = obj.style.fontSize; return (t ? parseInt(t) : null); }
	obj.style.fontSize = value + 'px';
}

function padTopTrans(obj, value)
{
	if(value == null) { var t = obj.style.paddingTop; return (t ? parseInt(t) : null); }
	obj.style.paddingTop = value + 'px';
}

function padBottomTrans(obj, value)
{
	if(value == null) { var t = obj.style.paddingBottom; return (t ? parseInt(t) : null); }
	obj.style.paddingBottom = value + 'px';
}

function createTitle(text, sx, sy, parent, textColor, borderColor, shadowColor, shadowDx, shadowDy, clName)
{
	var o, x, y;

	if(!parent) return;
	if(!clName) clName = 'floatingTitle';

	if(!shadowDx && !shadowDy) { shadowDx = 2; shadowDy = 1; }

	for(x = -1; x <= 1; x++) {
		for(y = -1; y <= 1; y++) {
			if(borderColor) {
				o = document.createElement('div');
				o.className = clName;
				if(sx < 0) o.style.right = (x - sx) + 'px'; else o.style.left = (sx + x) + 'px';
				o.style.top = (sy + y) + 'px';
				o.style.color = borderColor;
				o.style.zIndex = 2;
				o.innerHTML = text;
				parent.appendChild(o);
			}

			if(shadowColor) {
				o = document.createElement('div');
				o.className = clName;
				if(sx < 0) o.style.right = (x - sx - shadowDx) + 'px'; else o.style.left = (sx + x + shadowDx) + 'px';
				o.style.top = (sy + y + shadowDy) + 'px';
				o.style.color = shadowColor;
				o.style.zIndex = 1;
				o.innerHTML = text;
				parent.appendChild(o);
			}
		}
	}

	o = document.createElement('div');
	o.className = clName;
	if(sx < 0) o.style.right = (-sx) + 'px'; else o.style.left = sx + 'px';
	o.style.top = sy + 'px';
	o.style.color = textColor;
	o.style.zIndex = 3;
	o.innerHTML = text;
	parent.appendChild(o);
}

////////////////////////////////////////////////////////////////////////////////
// Helper Functions                                                           //
////////////////////////////////////////////////////////////////////////////////

function trim(s)
{
	var sout = s;

	while(true) {
		var iLen = sout.length;

		if(iLen == 0) {
			break;
		}
		else if(sout.charAt(0) == " ") {
			sout = sout.substring(1, iLen);
		}
		else if(sout.charAt(iLen - 1) == " ") {
			sout = sout.substring(0, iLen - 1);
		}
		else {
			break;
		}
	}

	return sout;
}

function checkDate(date)
{
	if(date.length == 0) return true;
	if(date.length < 10) return false;

	var day   = getDayFromDate(date);
	var month = getMonthFromDate(date);
	var year  = getYearFromDate(date);

	if(day == null || month == null || year == null) return false;

	if(day < 1 || month < 1 || day > 31 || month > 12) return false;

	if((month == 4 || month == 6 || month == 9 || month == 11) && day > 30) return false;

	if(month == 2) {
		if(year % 4 == 0) {
			if(day > 29) return false;
		}
		else {
			if(day > 28) return false;
		}
	}

	return true;
}

function checkTime(time)
{
	if(time.length == 0) return true;
	if(time.length > 8) return false;

	var hour 	= getHour(time);
	var minute 	= getMinute(time);
	var second	= getSecond(time);

	if(hour == null || minute == null) return false;

	if(hour > 24 || minute >= 60) return false;

	if(time.length > 5 && (second == null || second >= 60)) return false;

	return true;
}

function getDayFromDate(date)
{
	if(date.length < 2)
		return null;

	var day = date.substring(0, 2);

	if(!IsNumeric(day))
		return null;

	return day;
}

function getMonthFromDate(date)
{
	if(date.length < 5)
		return null;

	var month = date.substring(3, 5);

	if(!IsNumeric(month))
		return null;

	return month;
}

function getYearFromDate(date)
{
	if(date.length < 10)
		return null;

	var year = date.substring(6, 10);

	if(!IsNumeric(year))
		return null;

	return year;
}

function getHour(time)
{
	if(time.length < 2)
		return null;

	var hour = time.substring(0, 2);

	if(!IsNumeric(hour))
		return null;

	return hour;
}

function getMinute(time)
{
	if(time.length < 5)
		return null;

	var minute = time.substring(3, 5);

	if(!IsNumeric(minute))
		return null;

	return minute;
}

function getSecond(time)
{
	if(time.length < 8)
		return null;

	var second = time.substring(6, 8);

	if(!IsNumeric(second))
		return null;

	return second;
}

function IsNumeric(value)
{
	var validChars = "0123456789";

		for (i = 0; i < value.length; i++)
		if (validChars.indexOf(value.charAt(i)) == -1)
			return false;

	return true;
}

function emptySelection()
{
	if(document.getSelection) {
		//document.getSelection().??
	}
	else if(document.selection && document.selection.empty) {
		document.selection.empty();
	}
}

////////////////////////////////////////////////////////////////////////////////
// Masked Controls Functions                                                  //
////////////////////////////////////////////////////////////////////////////////

function controlKey(obj, mask, key, characterPos, noMaskedCharacters)
{
	if(key == 8) return true;

	if(obj.value.length >= mask.length) return false;

	var characterMask = mask.charAt(characterPos);

	switch(characterMask) {
		case 'A':
			obj.value += noMaskedCharacters;
			return true;

		case 'L':
			if((key >= 97 && key <=122) || (key >= 65 && key <= 90)) {
				obj.value += noMaskedCharacters;
				return true;
			}

			break;

		case '#':
			if(key >= 48 && key <= 57) {
				obj.value += noMaskedCharacters;
				return true;
			}

			break;

		default:
			noMaskedCharacters += characterMask;
			return controlKey(obj, mask, key, ++characterPos, noMaskedCharacters);
	}

	return false;
}

function dateKeyPress()
{
	return controlKey(this, "##-##-####", window.event.keyCode, this.value.length, '');
}

function dateBlurCheck()
{
	if(this.value != "" && !checkDate(this.value)) {
		alert("Invalid Date field!");
		this.value = "";
		this.focus();
	}
}

function timeKeyPress()
{
	return controlKey(this, "##:##", window.event.keyCode, this.value.length, '');
}

function timeBlurCheck()
{
	if(this.value != "" && !checkTime(this.value)) {
		alert("Invalid Time field.");
		this.value = "";
		this.focus();
	}
}

function euroKeyPress()
{
	if(window.event.keyCode == 44) window.event.keyCode = 46;
	if((window.event.keyCode >= 48 && window.event.keyCode <= 57) || window.event.keyCode == 46) return true;
	return false;
}

function euroBlurCheck()
{
	euroBlur(this);
}

function euroBlur(obj)
{
	var txt = obj.value;
	var len = txt.length;
	var str = "";
	var dot = -1;
	var i;

	for(i = 0; i < len; i++) {
		if(dot >= 0 && str.length > dot + 2) break;

		var c = txt.charAt(i);

		if(c >= '0' && c <= '9') {
			if(str.length > 0 || c > '0') str += c;
		}
		else if(c == '.' || c == ',') {
			if(dot == -1) {
				dot = str.length;
				str += ".";
			}
		}
	}

	if(str.length == 0) {
		str = "0";
	}
	else if(dot == 0) {
		str = "0" + str;
		dot = 1;
	}

	if(dot == -1) {
		str += ".00";
	}
	else while(str.length <= dot + 2) {
		str += "0";
	}

	obj.value = str;
}

function setupEuroEditControl(obj)
{
	obj.onkeypress = euroKeyPress;
	obj.onblur     = euroBlurCheck;
	obj.onpaste    = function() { return false; }

	euroBlur(obj);
}

function resetEuroEditControl(obj)
{
	obj.onkeypress = null;
	obj.onblur     = null;
	obj.onpaste    = null;
}

function longKeyPress()
{
	if(window.event.keyCode >= 48 && window.event.keyCode <= 57) return true;
	return false;
}

function longBlurCheck()
{
	longBlur(this);
}

function longBlur(obj)
{
	var txt = obj.value;
	var len = txt.length;
	var str = "";
	var i;

	for(i = 0; i < len; i++) {
		var c = txt.charAt(i);

		if(c >= '0' && c <= '9') {
			if(str.length > 0 || c > '0') str += c;
		}
	}

	if(str.length == 0) {
		str = "0";
	}

	obj.value = str;
}

function setupLongEditControl(obj)
{
	obj.onkeypress = longKeyPress;
	obj.onblur     = longBlurCheck;
	obj.onpaste    = function() { return false; }

	longBlur(obj);
}

function resetLongEditControl(obj)
{
	obj.onkeypress = null;
	obj.onblur     = null;
	obj.onpaste    = null;
}

///////////////////////////////////////////////////////////////////////
// Operazioni eseguite automaticamente ad ogni caricamento di pagina //
///////////////////////////////////////////////////////////////////////

function setAllControls()
{
	if(document.all) {
		for(var i = document.all.length - 1; i >= 0; i--) {
			var obj = document.all[i];
			var cln = obj.className.substring(0, 8);

			if(cln == "dateEdit") {
				obj.onkeypress = dateKeyPress;
				obj.onblur     = dateBlurCheck;
				obj.onpaste    = function() { return false; }
			}
			else if(cln == "timeEdit") {
				obj.onkeypress = timeKeyPress;
				obj.onblur     = timeBlurCheck;
				obj.onpaste    = function() { return false; }
			}
			else if(cln == "euroEdit") {
				setupEuroEditControl(obj);
			}
			else if(cln == "longEdit") {
				setupLongEditControl(obj);
			}
		}
	}
}

var oldLoad = window.onload;

window.onload = function()
{
	setAllControls();
	if(oldLoad) oldLoad();
}

var currentPanel = null;
var panelTimer = 0;

function showPanel(panelNum, lang)
{
	if(!panelNum) {
		if(panelTimer) { clearTimeout(panelTimer); panelTimer = 0; }
		return;
	}

	hidePanel(true);

	if(currentPanel = byId("menuArea_" + panelNum)) {
		if(!currentPanel.panelNum) {
			currentPanel.panelNum = panelNum;
			currentPanel.onmouseover = function() { showPanel(0); };
			currentPanel.onmouseout = function() { hidePanel(false); };
		}

		currentPanel.style.display = 'block';
		currentPanel.MM_swap = (lang == "it");

		if(currentPanel.MM_swap) MM_swapImage("tabArea_" + panelNum, "", "/common/skin/" + (document.homePage ? "home/" : "") + "button" + panelNum + "over.gif", 1);

		toggleComboVisibility(false);
	}
}

function hidePanel(immediate)
{
	if(currentPanel) {
		if(!immediate) {
			if(!panelTimer) panelTimer = setTimeout("hidePanel(true)", 300);
			return;
		}

		if(panelTimer) {
			clearTimeout(panelTimer);
			panelTimer = 0;
		}

		currentPanel.style.display = 'none';
		if(currentPanel.MM_swap) MM_swapImage("tabArea_" + currentPanel.panelNum, "", "/common/skin/" + (document.homePage ? "home/" : "") + "button" + currentPanel.panelNum + "it.gif", 1);
		toggleComboVisibility(true);
		currentPanel = null;
	}
}

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_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_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];}
}

