function MM_findObj(n, d) { //v3.0
  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); 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];}
}

function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

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;
}


//
// ************************ COOKIES *************************************
//

// Parametro n.3: in millisecondi
function WriteCookie(cookieName, cookieValue, expiry)
{
	var expDate = new Date();
	if(expiry)
	{
		expDate.setTime(expDate.getTime() + expiry);
		document.cookie = cookieName + "=" + escape(cookieValue) + "; expires=" + expDate.toGMTString();
	}
	else
	{
		document.cookie = cookieName + "=" + escape(cookieValue);
	}
}

function ReadCookie(CookieName)
{
	var CookieString = document.cookie;
	var CookieSet = CookieString.split (';');
	var SetSize = CookieSet.length;
	var CookiePieces
	var ReturnValue = "";

	for (i = 0; ((i < SetSize) && (ReturnValue == "")); ++i)
	{
		CookiePieces = CookieSet[i].split ('=');
		if (CookiePieces[0].substring(0,1) == ' ')
		CookiePieces[0] = CookiePieces[0].substring(1, CookiePieces[0].length);
		if (CookiePieces[0] == CookieName)
		ReturnValue = CookiePieces[1];
	}
	return ReturnValue;
}

//
// ************************************************************************
//


function Pagina_onLoad()
{
	MM_preloadImages(
		'BOT_ART-over.jpg',
		'BOT_ART-down.jpg',
		'BOT_SERV-over.jpg',
		'BOT_SERV-down.jpg',
		'BOT_CHI-over.jpg',
		'BOT_CHI-down.jpg',
		'DX_BOT.gif',
		'LAT_BOT.gif',
		'sottoHome.gif',
		'rock1_01-over.gif',
		'blues1_01-over.gif',
		'newage1_01-over.gif',
		'ballabili1_01-over.gif',
		'midi1_01-over.gif',
		'produzioni_01-over.gif',
		'spartiti1_01-over.gif',
		'strumenti_01-over.gif',
		
		'partners_over.gif',
		'forum_over.gif',
		'links_over.gif',
		'contattaci_over.gif'
		);		
	
	
	PrincipaleCliccato = 0;
	/*
	PrincipaleCliccato = Number(ReadCookie('principaleCliccato'));
	Principale_onMouseOver(PrincipaleCliccato);
	Principale_onMouseOut();
	*/
}

function Principale_onMouseOver(nbot)
{
	switch(nbot)
	{
	case 1:
		MM_swapImage('imgBotArtist','','BOT_ART-over.jpg',1);

		MM_swapImage('imgSottoHome','','sottoHome.gif',1);
		MM_swapImage('imgDxArtist','','DX_BOT.gif',1);
		MM_swapImage('imgDxService','','nulla.gif',1);
		MM_swapImage('imgDxChi','','nulla.gif',1);

		// per IE
		MM_changeProp('layArtist','','style.visibility','visible','DIV');
		MM_changeProp('layService','','style.visibility','hidden','DIV');

		// per NETSCAPE
		MM_changeProp('layArtist','','visibility','show','DIV');
		MM_changeProp('layService','','visibility','hide','DIV');

		break;
	case 2:
		MM_swapImage('imgBotService','','BOT_SERV-over.jpg',1);

		MM_swapImage('imgSottoHome','','sottoHome.gif',1);
		MM_swapImage('imgDxArtist','','LAT_BOT.gif',1);
		MM_swapImage('imgDxService','','DX_BOT.gif',1);
		MM_swapImage('imgDxChi','','nulla.gif',1);

		// per IE
		MM_changeProp('layArtist','','style.visibility','hidden','DIV');
		MM_changeProp('layService','','style.visibility','visible','DIV');

		// per NETSCAPE
		MM_changeProp('layArtist','','visibility','hide','DIV');
		MM_changeProp('layService','','visibility','show','DIV');
		break;
	case 3:
		MM_swapImage('imgBotChi','','BOT_CHI-over.jpg',1);

		MM_swapImage('imgSottoHome','','sottoHome.gif',1);
		MM_swapImage('imgDxArtist','','LAT_BOT.gif',1);
		MM_swapImage('imgDxService','','LAT_BOT.gif',1);
		MM_swapImage('imgDxChi','','DX_BOT.gif',1);

		// per IE
		MM_changeProp('layArtist','','style.visibility','hidden','DIV');
		MM_changeProp('layService','','style.visibility','hidden','DIV');

		// per NETSCAPE
		MM_changeProp('layArtist','','visibility','hide','DIV');
		MM_changeProp('layService','','visibility','hide','DIV');
		break;
	}
}

function Principale_onMouseOut()
{
	switch(PrincipaleCliccato)
	{
		case 1:
			MM_swapImage('imgBotArtist','','BOT_ART-down.jpg',1);
			MM_swapImage('imgBotService','','BOT_SERV.jpg',0);
			MM_swapImage('imgBotChi','','BOT_CHI.jpg',0);

			MM_swapImage('imgDxChi','','nulla.gif',1);
			MM_swapImage('imgDxService','','nulla.gif',1);
			MM_swapImage('imgDxArtist','','DX_BOT.gif',1);
			MM_swapImage('imgSottoHome','','sottoHome.gif',1);

			// per IE
			MM_changeProp('layArtist','','style.visibility','visible','DIV');
			MM_changeProp('layService','','style.visibility','hidden','DIV');

			// per NETSCAPE
			MM_changeProp('layArtist','','visibility','show','DIV');
			MM_changeProp('layService','','visibility','hide','DIV');
			break;
		case 2:
			MM_swapImage('imgBotArtist','','BOT_ART.jpg',1);
			MM_swapImage('imgBotService','','BOT_SERV-down.jpg',0);
			MM_swapImage('imgBotChi','','BOT_CHI.jpg',0);

			MM_swapImage('imgDxChi','','nulla.gif',1);
			MM_swapImage('imgDxService','','DX_BOT.gif',1);
			MM_swapImage('imgDxArtist','','LAT_BOT.gif',1);
			MM_swapImage('imgSottoHome','','sottoHome.gif',1);

			// per IE
			MM_changeProp('layArtist','','style.visibility','hidden','DIV');
			MM_changeProp('layService','','style.visibility','visible','DIV');

			// per NETSCAPE
			MM_changeProp('layArtist','','visibility','hide','DIV');
			MM_changeProp('layService','','visibility','show','DIV');
			break;
		case 3:
			MM_swapImage('imgBotArtist','','BOT_ART.jpg',1);
			MM_swapImage('imgBotService','','BOT_SERV.jpg',0);
			MM_swapImage('imgBotChi','','BOT_CHI-down.jpg',0);

			MM_swapImage('imgDxChi','','DX_BOT.gif',1);
			MM_swapImage('imgDxService','','LAT_BOT.gif',1);
			MM_swapImage('imgDxArtist','','LAT_BOT.gif',1);
			MM_swapImage('imgSottoHome','','sottoHome.gif',1);

			// per IE
			MM_changeProp('layArtist','','style.visibility','hidden','DIV');
			MM_changeProp('layService','','style.visibility','hidden','DIV');

			// per NETSCAPE
			MM_changeProp('layArtist','','visibility','hide','DIV');
			MM_changeProp('layService','','visibility','hide','DIV');
			break;
		default:
			MM_swapImage('imgBotArtist','','BOT_ART.jpg',1);
			MM_swapImage('imgBotService','','BOT_SERV.jpg',0);
			MM_swapImage('imgBotChi','','BOT_CHI.jpg',0);

			MM_swapImage('imgDxChi','','nulla.gif',1);
			MM_swapImage('imgDxService','','nulla.gif',1);
			MM_swapImage('imgDxArtist','','nulla.gif',1);
			MM_swapImage('imgSottoHome','','nulla.gif',1);

			// per IE
			MM_changeProp('layArtist','','style.visibility','hidden','DIV');
			MM_changeProp('layService','','style.visibility','hidden','DIV');

			// per NETSCAPE
			MM_changeProp('layArtist','','visibility','hide','DIV');
			MM_changeProp('layService','','visibility','hide','DIV');
			break;
	}
}

function Principale_onClick(nbot)
{
	PrincipaleCliccato = nbot;
	WriteCookie('principaleCliccato', String(nbot), 0);
}
