var ns6=document.getElementById&&!document.all
var ie=document.all

var dayarray=new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato")
var montharray=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre")

function zoomimg(picture, title, description)
{
	immagine = new Image;
	immagine.src = picture;
	Altezza=65;
	
	if (description!='') Altezza=120;
	
	
	html = '<HTML>\n<HEAD>\n<TITLE>'+title+'</TITLE>\n</HEAD>\n<BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<CENTER><IMG SRC="'+picture+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+'+ Altezza +')"><br><br><FONT face="Tahoma" size="1"><B>'+description+'</B></FONT><br></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=0,status=0,copyhistory= 0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
};

function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD"&&source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) {
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore"))
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}


function VerificaImmagine(SeImmagineInesistente, SostituisciCon)

{

	if (SeImmagineInesistente=='images/' || SeImmagineInesistente=='') 
		return SostituisciCon
	else
		return SeImmagineInesistente; 
  }


function VerificaTestiVuoti(Testo, Label){
if (Testo != "") document.write(Label+" "+Testo);
}

function EffettoImmagine(foto, tip, descrizione, larghezza, altezza, sfondo, allineamento)
{
			var ricercato=foto.indexOf("images/");
			
			if (allineamento=='')
			    allineamento='left';
			
			if (sfondo=='')
				sfondo='images/sfondo_foto.png';
				
			if (larghezza==0)
				larghezza=150;
			
			if (altezza==0)
				altezza=larghezza*3/4;
				
			if ((foto != "nondisponibile.gif") && (foto != "")) 
			{	
			    var ricercato=foto.indexOf("images/")
//				document.write(ricercato)
//				document.write(foto)
			    if (ricercato == -1) 
			    {
					thumbs='thumbs/'+ foto;
			   		foto='images/' + foto;
			   		}
			   	else
			   	{
			   		thumbs=foto.replace('images', 'thumbs')
			   		
			   	}
			   		
				document.write('<div style="background-color: #000; position: relative; width: '+larghezza+'px; height: '+altezza+'px; z-index: 1; background-image: url('+thumbs+'); float: '+allineamento+'" >')
				document.write('<a href="javascript:zoomimg(\''+foto +'\',\''+tip+'\',\''+descrizione+'\');">')
				document.write('<img src="'+sfondo+'" border=0 width='+larghezza+' height='+altezza+' alt="'+tip+'"></a></div>')
						
			}

}


function FxImages(foto, tip, descrizione, larghezza, altezza, sfondo, allineamento)
{
			var ricercato=foto.indexOf("images/");
			var stringa = "";
			
			if (allineamento=='')
			    allineamento='left';
			
			if (sfondo=='')
				sfondo='images/sfondo_foto.png';
				
			if (larghezza==0)
				larghezza=150;
			
			if (altezza==0)
				altezza=larghezza*3/4;
				
			if ((foto != "nondisponibile.gif") && (foto != "")) 
			{	
			    
//				document.write(ricercato)
//				document.write(foto)
			    if (ricercato == -1) 
			    {
					thumbs='thumbs/'+ foto;
			   		foto='images/' + foto;
			   		}
			   	else
			   	{
			   		thumbs=foto.replace('images', 'thumbs')
			   		
			   	}
			   		
				stringa = '<div id="sfondo" style="z-index: 2; background-image: url(\''+thumbs+'\');  width: '+larghezza+'px; height: '+altezza+'px; margin-right: 10px;  z-index: 1; float: '+allineamento+'" >';
				stringa = stringa + '<div id="immagine" style="z-index: 1; position: absolute; width: '+larghezza+'px; height: '+altezza+'px; float: '+allineamento+'">';
				stringa = stringa + '<a href="'+foto +'" alt="'+tip+'" class="highslide" onclick="return hs.expand(this,{wrapperClassName: \'highslide-white\', spaceForCaption: 30, outlineType: \'rounded-white\'})" title="Clicca per allargare">';
				stringa = stringa + '<img src="'+sfondo+'" border=0 width='+larghezza+' height='+altezza+' alt="'+tip+'" style="float: '+allineamento+'"></a>';
				stringa = stringa + '<div class="highslide-caption">'+descrizione+'</div></div></div>';
				document.write(stringa);				
			}

}







function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+","+daym+" "+montharray[month]+" "+year+", ore "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
//else
//document.write(cdate)
}
if (!document.all)
getthedate()
function goforit(){
if (document.all)
setInterval("getthedate()",1000)
}


function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.3
else if (which2.filters)
which2.filters.alpha.opacity=30
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}

function Titolo(Stringa){
	parent.titolo.document.close;
	parent.titolo.document.open();
	parent.titolo.document.write ('<table border=0 cellpadding=0 style="border-collapse: collapse" width=100% height=44 background="images/sfondotitolo.gif">');
	parent.titolo.document.write ('<tr>');
	parent.titolo.document.write ('<td height=44 valign=bottom>');
	parent.titolo.document.write ('<p align=right><font face=Tahoma color="#FFFFFF" size=5>'+Stringa+'&nbsp;&nbsp;&nbsp; </font></td>');
	parent.titolo.document.write ('</tr>');
	parent.titolo.document.write ('</table>');
	}


function FrameToIndex(PaginaIniziale){

if (PaginaIniziale.lenght==0) {
	PaginaIniziale='index.htm'}
	
if(self.name==top.name){
		location.href=PaginaIniziale
	}
}




function Downloadabile(Parametro)
{
var dwl=Parametro.indexOf('download/');

	if (dwl > 0)
	
	   document.write("<a "+Parametro+"><img src='images/download.gif' border=0 align=middle></a>")
		}









function RicostruisciFrameSet(){


// Javascript creato da Francesco Rombecchi @ 2005
// ===============================================
// Serve per creare il frameset nelle pagine HTML con link diretto
// Per far funzionare questo script nelle linee utilizzare il valore #LOCAZIONE# per indicare il posto dove sostituire l'URL


var Linee = new Array ()


Linee[0] = '<frameset framespacing="0" border="0" frameborder="0" rows="125,*,37">'
Linee[1] = '<frame name="superiore" scrolling="no" noresize target="sommario" src="top.htm" marginwidth="0" marginheight="0">'
Linee[2] = '<frameset cols="203,*,12">'
Linee[3] = '<frame name="sommario" target="principale" src="menucategorie.htm" scrolling="no" marginwidth="0" marginheight="0">'
Linee[4] = '<frame name="principale" scrolling="auto" marginwidth="0" marginheight="0" noresize target="_self" src="#LOCAZIONE#">'
Linee[5] = '<frame name="principale1" src="dx.htm" scrolling="no" target="_self">'
Linee[6] = '</frameset>'
Linee[7] = '<frame name="inferiore" scrolling="no" noresize target="sommario" src="lingue.htm" marginwidth="0" marginheight="0">'
Linee[8] = '<noframes><body></body></noframes></frameset>'

// aggiungere qui le linee che servono aumentando progressivamente il numero


var LunghezzaVettore = Linee.length;
var Locazione = document.location.href
 
// controllo che nella query string della location esista già il punto interrogativo
if (Locazione.indexOf('?') > -1) {
  Locazione = Locazione + '&framed=yes'
  }
else
  {
  Locazione = Locazione + '?framed=yes'
  }


if (self.name==top.name)
{
 for (var i=0; i<LunghezzaVettore; i++)
   {
     var Convertita = Linee[i];
     
     // Viene sostituito il valore di #LOCAZIONE# con quello di destinazione     
     if (Convertita.indexOf('#') > -1) {
       Convertita = Convertita.replace("#LOCAZIONE#", Locazione);
     }         

     document.write(Convertita);
   }
}
}
