var requiredMajorVersion = 8;
var requiredMinorVersion = 0;
var requiredRevision = 0;
var myWin=""
var msg = "FUTURSIRO CROMATISMI MUSICALI – BOLOGNA – INSPIRED BY GEORGE BYRON 3° EDIZIONE – ROMA – ANDY BLOWING IN THE WINDOW – MILANO – BEYOND THE BEYOND – TORINO – GIORGIO DE CHIRICO IL SOGNO METAFISICO – FIRENZE - ";

function MywinNoScroll(quale,wWindow,hWindow){
		if (myWin!=""){
			if (myWin.closed==false){
				myWin.close()
			}
		}
		if (wWindow==undefined){
			wWindow=650;
		}
		if (hWindow==undefined){
			hWindow=650;
		}
		Left = (screen.width) ? (screen.width-wWindow)/2 : 0; 
		Top = (screen.height) ? (screen.height-hWindow)/2 : 0;
		myWin=window.open(quale,"myWin","menubar=0,toolbar=0,scrollbars=yes,width="+wWindow+",height="+hWindow+",left="+Left+",top="+Top+";statusbar=0");
		myWin.focus();
	}


function Mywin(quale,wWindow,hWindow){
	var myWin=""
		if (myWin!=""){
			if (myWin.closed==false){
				myWin.close()
			}
		}
		if (wWindow==undefined){
			wWindow=650;
		}
		if (hWindow==undefined){
			hWindow=650;
		}
		Left = (screen.width) ? (screen.width-wWindow)/2 : 0; 
		Top = (screen.height) ? (screen.height-hWindow)/2 : 0;
		myWin=window.open(quale,"myWin","scrollbars=yes,width="+wWindow+",height="+hWindow+",left="+Left+",top="+Top+";statusbar=0");
	}

var myWin2=""
function Mywin2(quale,wWindow,hWindow){
		if (myWin2!=""){
			if (myWin2.closed==false){
				myWin2.close()
			}
		}
		if (wWindow==undefined){
			wWindow=650;
		}
		if (hWindow==undefined){
			hWindow=650;
		}
		Left = (screen.width) ? (screen.width-wWindow)/2 : 0; 
		Top = (screen.height) ? (screen.height-hWindow)/2 : 0;
		myWin2=window.open(quale,"myWin2","scrollbars=yes,width="+wWindow+",height="+hWindow+",left="+Left+",top="+Top+";statusbar=0");
	}
var myWin3=""
function MywinControl(quale,wWindow,hWindow){
		if (myWin3!=""){
			if (myWin3.closed==false){
				myWin3.close()
			}
		}
		Left = (screen.width) ? (screen.width-wWindow)/2 : 0; 
		Top = (screen.height) ? (screen.height-hWindow)/2 : 0;
		myWin3=window.open(quale,"myWin3","toolbar=1,scrollbars=yes,width="+wWindow+",height="+hWindow+",statusbar=1,menubar=1,resizable=1");
	}
	

function Mywin3(quale,wWindow,hWindow){
		if (myWin3!=""){
			if (myWin3.closed==false){
				myWin3.close()
			}
		}
		if (wWindow==undefined){
			wWindow=650;
		}
		if (hWindow==undefined){
			hWindow=650;
		}
		Left = (screen.width) ? (screen.width-wWindow)/2 : 0; 
		Top = (screen.height) ? (screen.height-hWindow)/2 : 0;
		myWin3=window.open(quale,"myWin3","scrollbars=yes,width="+wWindow+",height="+hWindow+",left="+Left+",top="+Top+";statusbar=0");
	}
	
pos = 0;
function ScrollMessage(msg) {
   var newtext = msg.substring(pos, msg.length) + msg.substring(0, pos);
   var div = document.getElementById("scrollInfo");
   div.firstChild.nodeValue = newtext;
   pos++;
   if (pos > msg.length) pos = 0;
   window.setTimeout("ScrollMessage(msg)",150);
}

function trim(myStr)
{
   re=/\s+$|^\s+/g;
   myStrApp=myStr.replace(re,"");   
   return myStrApp;
}

function apriPdf(quale){
	Mywin("pdf/" + quale)
}

function workshop(quale,w,h){	
	if (quale==undefined) {
		quale="aprile09";
		w=500;
		h=240;
	}
	Mywin('corsi/workshop/calendario'+quale+'.php',w,h);
}

/***********************************************
* Tab Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Set tab to intially be selected when page loads:
//[which tab (1=first tab), ID of tab content to display]:
var initialtab=[1, "sc1"]

////////Stop editting////////////////

function cascadedstyle(el, cssproperty, csspropertyNS){
if (el.currentStyle)
return el.currentStyle[cssproperty]
else if (window.getComputedStyle){
var elstyle=window.getComputedStyle(el, "")
return elstyle.getPropertyValue(csspropertyNS)
}
}

var previoustab=""


function expandcontent(cid, aobject){
if (document.getElementById){
highlighttab(aobject)
detectSourceindex(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
if (aobject.blur)
aobject.blur()
return false
}
else
return true
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++){
tabobjlinks[i].style.fontSize="10px";
tabobjlinks[i].style.fontWeight="400";
}
//var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
aobject.style.fontSize="12px";
aobject.style.fontWeight="700";
}

function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("a")
}

function detectSourceindex(aobject){
for (i=0; i<tabobjlinks.length; i++){
if (aobject==tabobjlinks[i]){
tabsourceindex=i //source index of tab bar relative to other tabs
break
}
}
}

function do_onload(){
collecttablinks();
if (tabobjlinks.length==2){
	initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
}
initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck){
var cookieparse=get_cookie(cookiename).split("|")
var whichtab=cookieparse[0]
var tabcontentid=cookieparse[1]
expandcontent(tabcontentid, tabobjlinks[whichtab])
}
else
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}
function STimit()
	{
	var today = new Date();
	if ( hr != today.getHours())
		{
		if ( nD != today.getDate())
			{
			nFY = today.getFullYear(); nM = today.getMonth(); nD = today.getDate();
			todayA = new Date(nFY,nM,nD,4,0,0); endofyear = new Date(nFY-1, 11, 31,6,0,0);
			Tday = Math.ceil((todayA.getTime()-endofyear.getTime())/(1000*60*60*24)); W1day = Tday;
			if(endofyear.getDay()<6) W1day += endofyear.getDay() + 1;
			Week = Math.ceil((W1day)/7);
			Mesi = " ";
			for (ir = 1; ir <= rDe; ir++)
				{
				eval("Rm = rV" + ir + "[0] - 1; Rd = rV" + ir +"[1];Ry = rV" + ir + "[2];");
				if ( (Rm == -1 || Rm == nM) && Rd == nD && (Ry == 0 || Ry == nFY))
					{
					eval("Ri = rV" + ir + "[4]");
					if(Ri == 0) Mesi += ("<br>" + eval("rV" + ir + "[3]"));
					else Mesi += ("<br><a href='#'><span>"+eval("rV" +ir+"[3]")+"</span></a>");
					}
				}
			Mese = (" - Day " + Tday + " - Calendar Week " + Week + Mesi)
			}
		hr = today.getHours();
		}
	document.getElementById('Timit').innerHTML = (today.toLocaleString() + Mese);
	setTimeout('STimit()',1000);
	}

function MCDate(c)
	{
	var km = parseInt(document.CalForm.month.value) + c;
	if (km < 0 ) {km = km + 12;	document.CalForm.year.value--;}
	if (km > 11) {km = km - 12;	document.CalForm.year.value++;}
	document.CalForm.month.value = km;
	VMonth();
	}

function SToday()
	{
	document.CalForm.month.value = (new Date()).getMonth();
	document.CalForm.year.value = (new Date()).getFullYear();
	VMonth();
	}

function VMonth()
	{
	var mh = document.CalForm.month.value;
	var myMese=parseInt(mh)+1;
	eval("myLungArray = eventi" +myMese+".length");
	var yr = document.CalForm.year.value;
	if (yr < 1583) {alert("Gli anni prima del 1583 non sono accettati");return false;}		
	var MSDay = (new Date(yr, mh, 1)).getDay();
	var days = 31;
	if (mh == 3 || mh == 5 || mh == 8 || mh == 10) days=30;
	if (mh == 1)
		{
		if (((yr % 4)==0) && ((yr % 100)!=0) || ((yr % 400)==0)) {days = 29;}
		else { days = 28; }
		}
	var ki= 1; var ke = MSDay + days;
	for (i = 0; i < 42; i++){
		eval("document.getElementById('m0n" + i + "').style.backgroundColor='#efefef'");
		if (i > (MSDay - 1) && i < ke){
			var Mes2 = "";			
			for (ir = 0; ir <= myLungArray; ir++)
				{					
				eval("Rm =" + myMese+"; Rd = eventi" +myMese+"["+ir+"];Ry ="+ yr+";");
				if ((Rm == -1 || Rm == myMese) && Rd == ki && (Ry ==0 || Ry ==yr)){						
					Mes2 = ("<a href='javascript:void(0);'>"+ki+"<span>" + eval("dettEventi" + myMese + "["+ir+"]")+"</span></a>");
					mycolor="#ed1c24";
					break;
				}else{
					Mes2 =ki;
					mycolor="#efefef"
				}
			}
			eval("document.getElementById('m0n" + i + "').innerHTML=Mes2");
			eval("document.getElementById('m0n" + i + "').style.backgroundColor=mycolor");
			ki++;			
		}else
			{eval("document.getElementById('m0n" + i + "').innerHTML = '&nbsp;'");}
		}
	eval("document.getElementById('H0').innerHTML = '" + mP[mh] + ", " + yr + "'" );
	}
function InstShow(IP)
	{
	var DI = 'dID' + IP;
	if ( InSw[IP] == 0 ) {document.getElementById(DI).style.display = 'block';InSw[IP]=1;}
	else {document.getElementById(DI).style.display = 'none';InSw[IP]=0;}
}
function scriviTabella(){
document.write("<table border='0' cellspacing='1' cellpadding='2' class='myTesto'>");
document.write("<tr bgcolor='#ffffff'><td colspan='7' align='center'><a href='javascript:MCDate(-1)' class='testoRosso'><<</a>&nbsp;&nbsp;<span id='H0'>&nbsp;</span>&nbsp;&nbsp;<a href='javascript:MCDate(1)' class='testoRosso'>>></a></td></tr>");
document.write("<tr bgcolor='#ffffff' align='center'>");
document.write("<td width='15'>D</td><td width='15'>L</td><td width='15'>M</td>");
document.write("<td width='15'>M</td><td width='15'>G</td><td width='15'>V</td><td width='15'>S</td></tr></table>");
document.write("<table border='0' cellspacing='1' cellpadding='2' class='calendario'>");
for (k = 0; k < 42; k = k + 7)
	{
	document.write("<tr height='15' align='center' valign='top' >");
	document.write("<td align='center' width='15' id='m0n" + k + "' bgcolor='#efefef'> </td>");
	for (ic = k + 1; ic < k + 7; ic++) {document.write("<td align='center' width='15' id='m0n" + ic + "' bgcolor='#efefef'> </td>");}
	}
document.write("</tr></table>");
}
