﻿/****************************************************************
	SEZIONE GESTIONE IMMAGINI IN SCROOLING
****************************************************************/

////change number of images below 
var number_of_images=15;
//change speed below (in seconds)
var speed=3;
var step=0;
var whichimage=1;

function slideit(first)
{

	if (step<number_of_images)
	{
		step++;
	}
	else
	{
	   step=1;		
	}

	if (!first)
	{
		blendimage('blenddiv','blendimage','img/slider/slider_' + step + '.jpg',2000);		
	}
	
	if (document.all)
	{
		setTimeout('slideit(false)',speed*1500);
	}
	else
	{
		setTimeout("slideit(false)",speed*1500)
	}
}



function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

/****************************************************************
	SEZIONE GESTIONE MENU 
****************************************************************/
	var arrayTab=new Array();
	var arraySecondoLivello=new Array();

	function voceTab(id,descrizione,collegamento,name,haveChild,immagine)
	{
		this.id = id;
		this.descrizione = descrizione;
		this.collegamento = collegamento;
		this.name = name;
		this.haveChild = haveChild;
		this.immagine = immagine;
	}
	
	
	arrayTab[arrayTab.length]=new voceTab(1,"Home","index.html","home",0,"banner.jpg"); 
	arrayTab[arrayTab.length]=new voceTab(2,"Il paese","paese.html","paese",1,"banner9.jpg"); 
	arrayTab[arrayTab.length]=new voceTab(7,"Foto e racconti","luciano.html","foto",1,"banner8.jpg"); 
	arrayTab[arrayTab.length]=new voceTab(3,"Nei dintorni","boccadirio.html","dintorni",1,"pano5.jpg"); 
	arrayTab[arrayTab.length]=new voceTab(6,"Camping Relax","camping.html","camping",1,"banner2.jpg"); 
	arrayTab[arrayTab.length]=new voceTab(4,"Pianese calcio a 5","squadra.html","pianese",1,"banner6.jpg");
	//arrayTab[arrayTab.length]=new voceTab(5,"Soft Air","soft.html","soft",1,"banner4.jpg");  
	arrayTab[arrayTab.length]=new voceTab(8,"Varie","motoraduno11.html","varie",1,"banner7.jpg"); 

	/*arrayTab[arrayTab.length]=new voceTab(6,"Contattaci","contattaci.html","contattaci",0,"banner2.jpg");*/ 

	function voceSecondoLivello(id,descrizione,collegamento,name,idPadre)
	{
		this.id = id;
		this.descrizione = descrizione;
		this.collegamento = collegamento;
		this.name = name;
		this.idPadre = idPadre;
	}

	//**** IL PAESE
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Il paese","paese.html","paese",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Dove siamo","dove.html","dove",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Dal satellite","satellite.html","satellite",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"La storia","storia.html","storia",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Servizi","servizi.html","servizi",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Per le vie","vie.html","vie",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Lavori in corso","lavori.html","lavori",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"La banda","banda.html","banda",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Ristoranti","attivita.html","attivita",2); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Attività","fabbriche.html","fabbriche",2); 

	//**** FOTO E RACCONTI
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Le foto di Luciano","luciano.html","luciano",7); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Cartoline Pianesi","cartoline.html","cartoline",7); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Il presepe","presepe.html","presepe",7); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"L'angolo di Veronica","veronicaArticoli.html","veronica",7); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"La banda","fotobanda.html","fotobanda",7);	 
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Fantone 2007","fantone.html","fantone",7); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Neve","neve.html","neve",7); 
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Attrezzi Agricoli","monne.html","monne",7)
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Calcio Balilla","balilla.html","balilla",7)
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Fotografi dell' appennino","fotografi.html","fotografi",7);

	//**** NEI DINTORNI
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"boccadirio","boccadirio.html","boccadirio",3);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"lago di bilancino","bilancino.html","bilancino",3);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"futa","futa.html","futa",3);  
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"monte galletto","montegalletto.html","montegalletto",3);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"la strada romana","stradaromana.html","stradaromana",3);  
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Parco dei Laghi","bacini.html","bacini",3);
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Valmezzana","valmezzana.html","valmezzana",3);-->
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Il Passeggere","passeggere.html","passeggere",3);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Panigale","panigale.html","panigale",3);

		 

	//Pianese
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Squadra","squadra.html","squadra",4);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Rosa","rosa.html","rosa",4);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Risultati","risultati.html","risultati",4);
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Classifica","classifica.html","classifica",4);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Marcatori","marcatori.html","marcatori",4);
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Torneo 2008","torneo.html","torneo",4);
	
	
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Foto","fotosquadra.html","foto",4);

	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Il campeggio","camping.html","camping",6);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Carnevale 2008 1","carnevale.html","carnevale",6);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Carnevale 2008 2","carnevale2.html","carnevale2",6);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Carnevale 2009","carnevale3.html","carnevale3",6);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Carnevale 2010","carnevale4.html","carnevale4",6);

	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"I Guardiani","soft.html","soft",5);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Foto","fotosoft.html","fotosoft",5);
	//LINK
	//arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"link","link.html","link",8);
	
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Moto Raduno 2011","motoraduno.html","motoraduno",8);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Moto Raduno 2011","motoraduno11.html","motoraduno11",8);

	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Corri Piano","corri.html","corripiano",8);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Download","download.html","download",8);
	arraySecondoLivello[arraySecondoLivello.length]=new voceSecondoLivello(arraySecondoLivello.length,"Ringraziamenti","thanks.html","thanks",8);
	
function menu(idpulsante,idFiglio)
{
	var indiceidPadre = -1;
	var descrizionePadre = "";
	var hasChild = 0;
	var foto = "";
	document.write('<div id="pulsante"><ul>');

	for (var loopIndex= 0; loopIndex < arrayTab.length; loopIndex++)
	{
		 var voce = arrayTab[loopIndex];
		 
		 if (idpulsante == voce.name)
		 {
		 	indiceidPadre = voce.id;
			hasChild = voce.haveChild;
			descrizionePadre = voce.descrizione;
			foto = voce.immagine;
		 }
		 document.write('    <li id="'+(idpulsante==voce.name?"current":"plain")+'"><a href="'+voce.collegamento+'">'+voce.descrizione+'</a></li>');
	}

	document.write('</ul></div>');
	document.getElementById("logo").style.backgroundImage= "url(css/img/" + foto +")";
	
	if (indiceidPadre == -1)
		alert("Errore nella configurazione dei menu");
	
	
	if (hasChild == 1)
	{
		document.write('<div id="fancymenu"><ul>');
		//document.write('<div><ul class="lavaLampNoImage">');
		//document.write('<ul class="fancymenu">');

		for (var loopIndex= 0; loopIndex < arraySecondoLivello.length; loopIndex++)
		{
			 var voce = arraySecondoLivello[loopIndex];
			 var classCurrent = "";	
			
			if (idFiglio == voce.name)
		 	{
		 		classCurrent = 'class="current"';
			}
			
			if (indiceidPadre == voce.idPadre)
			{
				if (idFiglio == voce.name)
					document.write('    <li class="current"><a href="'+voce.collegamento+'">'+voce.descrizione+'</a></li>');
				else
					document.write('    <li ><a href="'+voce.collegamento+'">'+voce.descrizione+'</a></li>');	
			}
		}
		document.write('</ul></div>');		
		
	}else
	{
		document.write('<div >');
		document.write('<ul class="sottomenuVuoto">');
		document.write('</ul></div>');		

	}

 }
 
 function printImmagini()
{
	//var toWrite ='<script language="JavaScript1.2" src="js/neve.js"></script>';

	var toWrite ='<h1>Pian del Voglio &nbsp;&nbsp;&nbsp;</h1>';

								

	toWrite += '<div style="background-image: url(img/slider/slider_1.jpg); background-repeat: no-repeat; width: 250px; height: 167px;" id="blenddiv">'; 	
	toWrite += '<img src="img/slider/slider_1.jpg" alt="" style="width: 250px; height: 167px; border: 1px solid; filter: alpha(opacity=0); -moz-opacity: 0; opacity: 0;" id="blendimage"/>'
	toWrite += '</div>';


	toWrite += '';
	//toWrite +='<h5>Ultimo aggiornamento 4 gennaio 2008: <br/> fitta e intensa nevicata dal primo mattino</h5>';
	toWrite += '<span class ="news"><br/><br/>Pian del Voglio,<br/>';
	toWrite += 'piccolo Paesino sull\'Appennino<br/>tosco-emiliano. <br/> Luoghi, racconti, immagini <br/>e tradizioni di un paesino dalla storia secolare....<br/>';
	//toWrite += "<br/>Il sito nasce su iniziativa dell' <br/><strong>Associazione Sportiva Dilettantistica Pian del Voglio calcio a5</strong><br/>";
	//toWrite += "con lo scopo di promuovere le iniziative del paese, mostrarne le bellezze e le peculiarita'. ";
	toWrite += '<br/><br/>Aiutaci a raccogliere storie, ricordi,<br/> immagini e foto, contattaci all\'indirizzo:</span>';
	toWrite += '<br/><br/><A HREF="mailto:webmaster@piandelvoglio.it" STYLE="COLOR:#033b72; font-weight: bold; font-size: 14px">webmaster@piandelvoglio.it</A>&nbsp;&nbsp;&nbsp;<br/><br/>';

	toWrite += "<BR/><strong>Collegamenti<ul><li><A HREF='contattaci.html'>Contattaci</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='attivita.html'>Ristoranti</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='fabbriche.html'>Fabbriche e attività</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='camping.html'>Camping Relax</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='passeggere.html'>Il passeggere</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='panigale.html'>Il panigale</A>&nbsp;&nbsp;&nbsp;</li></ul></strong>";
	toWrite += "<BR/><strong>Siti consigliati<ul>";
	toWrite += "<li><A HREF='http://www.campingrelax.it' target='_blank'>CampingRelax.it</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='http://www.montefredente.it' target='_blank'>Montefredente.it</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='http://www.tecnoluximpianti.it' target='_blank'>TecnoLux Impianti</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='http://www.fmp.bo.it/' target='_blank'>FMP</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='http://www.passeggere.it' target='_blank'>Il passeggere</A>&nbsp;&nbsp;&nbsp;</li>";	
	toWrite += "<li><A HREF='http://www.guardianidelluppolo.org/' target='_blank'>Guardiani del Luppolo</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='http://www.pizzeriadragoverde.it' target='_blank'>Pizzeria Drago Verde</A>&nbsp;&nbsp;&nbsp;</li>";
	toWrite += "<li><A HREF='http://www.ilpanigaleturismoequestre.com' target='_blank'>Turismo Equestre il panigale</A>&nbsp;&nbsp;&nbsp;</li></ul></strong>";

		
	document.write(toWrite);
}	

	function writeContatore()
	{
		var inizioTabellaInterna = false;
		var fineTabellaInterna = false;
		var output="";
	
		output +="<br/><span class ='news'>Sei il visitatore numero:<br/><br/></span>";
		output +="<!-- Inizio Codice Shinystat --><script type='text/javascript' language='JavaScript' src='http://codice.shinystat.com/cgi-bin/getcod.cgi?USER=piandelvoglio'></script>";
		output +="<noscript><a href='http://www.shinystat.com/it' target='_top'>";
		output +="<img src='http://www.shinystat.com/cgi-bin/shinystat.cgi?USER=piandelvoglio' alt='Contatore utenti connessi' border='0'></a>";
		output +="</noscript>";
		
		

		
		document.write(output);
	}












