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

function trim(str) {
   return str.replace(/^\s*|\s*$/g,"");
}

function clear_textbox() {
 if (document.searchform.s.value == "cerca l'evento..."){
	document.searchform.s.value = "";
	document.searchform.s.style.background = "#FFF";
	}
}

function restore_textbox() {
 if (trim(document.searchform.s.value) == ""){
	document.searchform.s.value = "cerca l'evento...";
	document.searchform.s.style.background = "#FFF";
	}
}

function showDiv(n,folder){
	document.getElementById(eval("last"+folder)).style.display = "none";
	document.getElementById(n).style.display = "block";
	eval("last"+folder+" = '"+n+"';");
	//alert(eval("last"+folder));
}



// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 20;
PositionY = 20;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 810;
defaultHeight = 810;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN = (navigator.appName=="Netscape") ? 1 : 0;
	var isIE = (navigator.appName.indexOf("Microsoft")!=-1) ? 1 : 0;
}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage_OLD(imageURL,imageTitle){
	if (isNN){
		imgWin=window.open('about:blank','',optNN);
	}
	if (isIE){
		imgWin=window.open('about:blank','',optIE);
	}
	with (imgWin.document){
		writeln('<html>')
		writeln('<head>')
		writeln('<title>Loading...</title>')
		writeln('<style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-document.images[0].width);');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');
		writeln('window.innerWidth=document.images["myImage"].width;');
		writeln('window.innerHeight=document.images["myImage"].height;}}');
		writeln('function doTitle(){document.title="TorinoForum - '+imageTitle+'";}');
		writeln('</sc'+'ript>');
		//writeln('<script src="DOM_Fixes.js" type="text/javascript"></sc'+'ript>');
		//writeln('<script src="customtooltip.js" type="text/javascript"></sc'+'ript>');
		//writeln('<style type="text/css" media="screen">')
		//writeln('@import url(layout2b.css);')
		//writeln('</style>')

		
		if (!AutoClose){
			writeln('</head>')
			writeln('<body bgcolor="#000000" scroll="no" onload="initToolTips();reSizeToImage();doTitle();self.focus();">')
		}
		else
			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus();">');
		writeln('<a href="javascript:self.close();"><img name="myImage" src="' + imageURL + '" border="0" style="display:block" title="Clicca sull immagine per chiudere la finestra"></a></body></html>');
		close();
	}
}

/*** LB - Nuova funzione per aprire le Popup, compatibile anche con Safari ***/
function popImage(imageURL, imageTitle) {
	if(isNN)
		imgWin = window.open('blank.php?img='+ imageURL + '&title=' + imageTitle, '', optNN);
	else if(isIE)
		imgWin = window.open('blank.php?img='+ imageURL + '&title=' + imageTitle, '', optIE);
}


/*** LB - SCROLL x TODAY ***/

/*
Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Credit MUST stay intact
*/

//Specify the marquee's width (in pixels)
var marqueewidth="244px"

//Specify the marquee's height
var marqueeheight="136px"

//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=1

//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1



////NO NEED TO EDIT BELOW THIS LINE////////////

marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1) //slow speed down by 1 for NS
var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
var actualheight=''
var cross_marquee, ns_marquee

function populate(){
	if (iedom){
		cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
		cross_marquee2=document.getElementById? document.getElementById("iemarquee2") : document.all.iemarquee
		//cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
		cross_marquee.style.top="8px"
		cross_marquee.innerHTML=marqueecontent
		actualheight=cross_marquee.offsetHeight
		
		//cross_marquee2.style.top=parseInt(actualheight)+parseInt(marqueeheight)+8+"px"
		cross_marquee2.style.top=parseInt(actualheight)+8+"px"
		cross_marquee2.innerHTML=marqueecontent
		actualheight2=cross_marquee2.offsetHeight
		
	}
	else if (document.layers){
		ns_marquee=document.ns_marquee.document.ns_marquee2
		ns_marquee.top=parseInt(marqueeheight)+8
		ns_marquee.document.write(marqueecontent)
		ns_marquee.document.close()
		actualheight=ns_marquee.document.height
	}
	cm = cross_marquee
	lefttime=setInterval("scrollmarquee()",80) // Regola la velocitą dello scroll (tempo espresso in ms - per rallentare, aumentare il valore)
}

function scrollmarquee(){
	if (iedom){
		if (parseInt(cm.style.top)>(actualheight*(-1))){
			cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
			cross_marquee2.style.top=parseInt(cross_marquee2.style.top)-copyspeed+"px"
			}
		else{
			cm.style.top=parseInt(actualheight)+"px"
			cm==cross_marquee ? cm = cross_marquee2 : cm = cross_marquee
		}
	}
	else if (document.layers){
		if (ns_marquee.top>(actualheight*(-1)+8))
			ns_marquee.top-=copyspeed
		else
			ns_marquee.top=parseInt(marqueeheight)+8
	}
}

function writediv(){
	if (iedom||document.layers){
		with (document){
			if (iedom){
				write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
				write('<div id="iemarquee" style="position:absolute;left:0px;top:0px;width:100%; color:#000; font:normal 12px/18px verdana, arial, helvetica, sans-serif;border:0px solid #0f0">')
				write('</div>')
				write('<div id="iemarquee2" style="position:absolute;left:0px;top:0px;width:100%; color:#000; font:normal 12px/18px verdana, arial, helvetica, sans-serif;border:0px solid #00f">')
				write('</div></div>')
			}
			else if (document.layers){
				write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee">')
				write('<layer name="ns_marquee2" width='+marqueewidth+' height='+marqueeheight+' left=0 	top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
				write('</ilayer>')
			}
		}
	}
}

//window.onload=populate;MM_preloadImages('b2-img/nav/menu_f2.gif','b2-img/nav/menu_f3.gif','b2-img/nav/menu_f4.gif','b2-img/nav/menu_f5.gif','b2-img/nav/menu_f6.gif','b2-img/nav/menu_f7.gif','b2-img/nav/menu_f8.gif');















/*** LB - SCROLL x TAKE A LOOK ***/

/***********************************************
* Conveyor belt slideshow 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
***********************************************/


//Specify the slider's width (in pixels)
var sliderwidth="294px"

//Specify the slider's height
var sliderheight="149px"

//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=1

//configure background color:
slidebgcolor="#FFF"

//Specify gap between each image (use HTML):
var imagegap="<img src=\"b2-img\\spacer.gif\" width=1>"
//var imagegap=""

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=0


////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeeds=slidespeed
var iedom=document.all||document.getElementById
var actualwidth=''
var cross_slide, ns_slide





function fillup(){
	if (iedom){
		cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
		cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
		cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
		actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
		cross_slide2.style.left=actualwidth+slideshowgap+"px"
	}
	else if (document.layers){
		ns_slide=document.ns_slidemenu.document.ns_slidemenu2
		ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
		ns_slide.document.write(leftrightslide)
		ns_slide.document.close()
		actualwidth=ns_slide.document.width
		ns_slide2.left=actualwidth+slideshowgap
		ns_slide2.document.write(leftrightslide)
		ns_slide2.document.close()
	}
	cs = cross_slide
	lefttime=setInterval("slideleft()",30)
}

function slideleft(){
	if (iedom){
		if (parseInt(cs.style.left)>(actualwidth*(-1))){
			cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeeds+"px"
			cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeeds+"px"
		}
		else{
			cs.style.left=actualwidth+2*slideshowgap+"px"
			cs==cross_slide ? cs = cross_slide2 : cs = cross_slide
		}
	}
	else if (document.layers){
		if (ns_slide.left>(actualwidth*(-1)+8))
			ns_slide.left-=copyspeeds
		else
			ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

		if (ns_slide2.left>(actualwidth*(-1)+8))
			ns_slide2.left-=copyspeeds
		else
			ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
	}
}


function writeDivSlide(){
	if (iedom)
		document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
	if (iedom||document.layers){
		with (document){
			document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td>')
			if (iedom){
				write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden;">')
				write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeeds=0" onMouseout="copyspeeds=slidespeed">')
				write('<div id="test2" style="position:absolute;left:0px;top:0px; border:0px solid #00F;"></div>')
				write('<div id="test3" style="position:absolute;left:-1000px;top:0px; border:0px solid #0F0;"></div>')
				write('</div></div>')
			}
			else if (document.layers){
				write('<ilayer width='+sliderwidth+' height='+sliderheight+'name="ns_slidemenu" bgColor='+slidebgcolor+'>')
				write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeeds=0" onMouseout="copyspeeds=slidespeed"></layer>')
				write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeeds=0" onMouseout="copyspeeds=slidespeed"></layer>')
				write('</ilayer>')
			}
			document.write('</tr></td></table>')
		}
	}
}


