function replaceOpenBlank() 
{
	if (document.links)
		for (var i = 0; i < document.links.length; i++)
			if (document.links[i].className.indexOf("openBlank") >= 0) 
				document.links[i].target = "_blank";
}

if (window.addEventListener)
	window.addEventListener("load", replaceOpenBlank, false);
else if (window.attachEvent) 
	window.attachEvent("onload", replaceOpenBlank);

function Zumma(sImma, nWinWidth)
{
	if (nWinWidth == "") nWinWidth = 700;
	if (screen.height > 800)
		nWinHeight = 560;
	else
		nWinHeight = 530;
	
	sSettings = 'width=' + nWinWidth + ', height=' + nWinHeight + ', left=' + ((screen.width/2) - (nWinWidth/2) - 5) + ', top=' + (((screen.height - 30)/2) - (nWinHeight/2) - 15) + ', status=0, location=0, toolbar=0, scrollbars=1, resizable=1'
	window.open('zoompop.asp?P_sPath=' + sImma, 'ZoomWnd', sSettings);
}

function toggleCartellone(OAnchor, ExC_CID)
{
	var expdate = new Date();
	expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365 * 1));
	
	for (iNode = 0; iNode < OAnchor.childNodes.length; iNode++)
		if (OAnchor.childNodes[iNode].tagName && (OAnchor.childNodes[iNode].tagName.toUpperCase() == "IMG"))
			OIco = OAnchor.childNodes[iNode];
	
	sEvento = "|" + ExC_CID + "|";
	
// Leggo prima il cookie esistente
	sCookieCartellone = ""
	ACs = document.cookie.split(";");
	for (i = 0; i < ACs.length; i++)
	{
		AC = ACs[i].split("=");
		
		while (AC[0].substring(0, 1) == ' ')
			AC[0] = AC[0].substring(1, AC[0].length);
		
		if (AC[0] == "MioCartellone")
			sCookieCartellone = AC[1];
	}
	
	if (OIco.src.substr(OIco.src.length - 6) == 'in.gif')
	{
		sCookieCartellone = sCookieCartellone + sEvento;
		document.cookie = "MioCartellone=" + sCookieCartellone + ";expires=" + expdate.toGMTString()
		OIco.alt = 'Rimuovi questo evento dal tuo cartellone'
		OIco.src = 'images/ico_cartelloneout.gif'
		alert("Spettacolo inserito nel tuo cartellone.\n Per vedere il tuo cartellone clicca nel menu sul pulsante IL MIO CARTELLONE");
	}
	else
	{
		while (sCookieCartellone.indexOf(sEvento) >= 0)
			sCookieCartellone = sCookieCartellone.replace(sEvento, "");
			
		if (sCookieCartellone == "") sCookieCartellone = "|"
	
		document.cookie = "MioCartellone=" + sCookieCartellone + ";expires=" + expdate.toGMTString()
		OIco.alt = 'Inserisci questo evento nel tuo cartellone'
		OIco.src = 'images/ico_cartellonein.gif'
		alert("Spettacolo rimosso dal tuo cartellone.")	
	}
}

// OThis è passato per blurrare il link in modo che non rimanga la sottolineatura
function toggleVisible(sId, OThis)
{
	Obj = document.getElementById(sId);
	if (Obj && Obj.style)
	{
		diplayCur = Obj.style.display;
		if (Obj.displayPrev)
			Obj.style.display = Obj.displayPrev;
		else
			if ((diplayCur == "none") || (Obj.className.indexOf("startHidden") >= 0))
			{
				Obj.className = Obj.className.replace("startHidden", "");
				Obj.style.display = "block";
			}
			else
				Obj.style.display = "none";
		
		Obj.displayPrev = diplayCur;
		
		if (OThis) OThis.blur();
	}
	
//	setTimeout("doNothing('" + sId + "')", 1000);		// Per correggere bug FF
}

function doNothing(sId)
{
	Obj = document.getElementById(sId);
	if (Obj && Obj.style)
	{	
		Obj.style.textDecoration = "underline";
		Obj.style.textDecoration = "none";
	}
}
