window.addEvent('domready', function() {
	var accordion = new Accordion(
		'div.Btn', 'div.Main', 
			{
				opacity: true,
				show : -1,
				alwaysHide: true,
				onActive: function(toggler, element){
					var btnType = toggler.className.split(' ')[1].split('_')[0];
					if (btnType != undefined) {
						if (btnType == 'BtnText'){
							toggler.className = 'Btn BtnText_active';
						} else if (btnType == 'BtnDoc') {
							toggler.className = 'Btn BtnDoc_active';
						} else  if (btnType == 'BtnRel') {
							toggler.className = 'Btn BtnRel_active';
						} else  if (btnType == 'BtnFull') {
							toggler.className = 'Btn BtnFull_active';
						} else  if (btnType == 'BtntoolCont') {
							toggler.className = 'Btn BtntoolCont_active';
						} else  if (btnType == 'BtntoolStock') {
							toggler.className = 'Btn BtntoolStock_active';
						} else  if (btnType == 'BtnDowndoc') {
							toggler.className = 'Btn BtnDowndoc_active';
						} else  if (btnType == 'BtnText1') {
							toggler.className = 'Btn BtnText1_active';
						} else  if (btnType == 'BtnVTable') {
							toggler.className = 'Btn BtnVTable_active';
						} else  if (btnType == 'BtnFullArchive') {
							toggler.className = 'Btn BtnFullArchive_active';
						} else  if (btnType == 'BtnArgCorrel') {
							toggler.className = 'Btn BtnArgCorrel_active';
						} else  if (btnType == 'BtnUffReg') {
							toggler.className = 'Btn BtnUffReg_active';
						}  else  if (btnType == 'BtnLegenda') {
							toggler.className = 'Btn BtnLegenda_active';
						} else  if (btnType == 'BtnCurriculum') {
							toggler.className = 'Btn BtnCurriculum_active';
						} else  if (btnType == 'BtnVediMappa') {
							toggler.className = 'Btn BtnVediMappa_active';
						} else  if (btnType == 'Btndocp') {
							toggler.className = 'Btn Btndocp_active';
						}
					}
				},
				onBackground: function(toggler, element){
					try{ 
						var btnType = toggler.className.split(' ')[1].split('_')[0];
						if (btnType != undefined) {
							if (btnType == 'BtnText'){
								toggler.className = 'Btn BtnText';
							} else if (btnType == 'BtnDoc') {
								toggler.className = 'Btn BtnDoc';
							} else  if (btnType == 'BtnRel') {
								toggler.className = 'Btn BtnRel';
							} else  if (btnType == 'BtnFull') {
								toggler.className = 'Btn BtnFull';
							} else  if (btnType == 'BtntoolCont') {
								toggler.className = 'Btn BtntoolCont';
							} else  if (btnType == 'BtntoolStock') {
								toggler.className = 'Btn BtntoolStock';
							} else  if (btnType == 'BtnDowndoc') {
								toggler.className = 'Btn BtnDowndoc';
							} else  if (btnType == 'BtnText1') {
								toggler.className = 'Btn BtnText1';
							} else  if (btnType == 'BtnVTable') {
								toggler.className = 'Btn BtnVTable';
							} else  if (btnType == 'BtnFullArchive') {
								toggler.className = 'Btn BtnFullArchive';
							} else  if (btnType == 'BtnArgCorrel') {
								toggler.className = 'Btn BtnArgCorrel';
							} else  if (btnType == 'BtnUffReg') {
								toggler.className = 'Btn BtnUffReg';
							} else  if (btnType == 'BtnLegenda') {
								toggler.className = 'Btn BtnLegenda';
							} else  if (btnType == 'BtnVediMappa') {
								toggler.className = 'Btn BtnVediMappa';
							} else  if (btnType == 'Btndocp') {
								toggler.className = 'Btn Btndocp';
							}
						}
					}
					catch(er){}
				}
			}
		);	
		
		var req = new Request.HTML({   
            method: 'get',   
            url: '/lottomatica-group/eventCalendar.do',   
            data: { 'month' : _month, 'year' : _year, 'lang' : _lang },   
            onRequest: function() { },   
            update: $('calendarContent'),
            onComplete: function(response) { }
        }).send();
		
		//init StockWatch in homepage
		this.getStockWatch();
		
		// polling StockWatch - l'intervallo di tempo (delay) e' espresso in millisecondi, ad esempio, 10000=10 secondi
		window.setInterval("getStockWatch()", 60000);
});


//  POP UP WINDOW FUNCTION
function windowOpener(what_url,winheight,winwidth) {
	options="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+winwidth+",height="+winheight;

	popwin = window.open(what_url,'pop_win',options);
	popwin.focus();
}

<!-- Begin
function Check(chk) {
if(document.myform.categories.checked==true)
 					{
for (i = 0; i < chk.length; i++)
chk[i].checked = true ;
}else{
for (i = 0; i < chk.length; i++)
chk[i].checked = false ;
			}
}

// End -->

// StockWatch in homepage
function getStockWatch() {	
		var req = new Request.HTML({   
		method: 'get',   
		url:'/lottomatica-group/stockWatch.do' + '?lang=it&rnd=' + $random(1,100000),   
		onRequest: function() { },   
		update: $('stockWatch'),
		onComplete: function(response) { }   
		}).send();
}

//	Bilancio interattivo

