//Contents for menu 1
var menu1=new Array()

menu1[0]='<a href="paese.html">- Il paese</a>'
menu1[1]='<a href="arriva.html">- Come arrivarci</a>'
menu1[2]='<a href="meteo.html">- Che tempo fa</a>'
menu1[3]='<a href="cartina.html">- La cartina</a>'
menu1[4]='<a href="ierioggi.html">- Ieri e oggi</a>'
menu1[5]='<a href="curiosit.html">- Curiosità</a>'

var menu2=new Array()
menu2[0]='<a href="orignome.html">- Origine del nome</a>'
menu2[1]='<a href="storia.html">- Un po\' di storia</a>'
menu2[2]='<a href="feudatar.html">- I feudatari</a>'
menu2[3]='<a href="villaggi.html">- I villaggi scomparsi</a>'

var menu3=new Array()
menu3[0]='<a>ll Castello</a>'
menu3[1]='<a href="castello.html">\  \- La storia</a>'
menu3[2]='<a href="castfoto.html">\  \- Le foto</a>'
menu3[3]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu3[4]='<a>Le Chiese</a>'
menu3[5]='<a href="sbiagio.html">\  \- San Biagio</a>'
menu3[6]='<a href="chsbfoto.html">\  \  \  \- Le foto</a>'
menu3[7]='<a href="santioco.html">\  \- Sant\'Antioco</a>'
menu3[8]='<a href="chsafoto.html">\  \  \  \- Le foto</a>'
menu3[9]='<a href="svitalia.html">\  \- Santa Vitalia</a>'
menu3[10]='<a href="chsvfoto.html">\  \  \  \- Le foto</a>'
menu3[11]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu3[12]='<a>Nuraghe</a>'
menu3[13]='<a href="susonado.html">\  \- Complesso \'\'Su Sonadori\'\'</a>'
menu3[14]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu3[15]='<a>La Pineta</a>'
menu3[16]='<a href="supardu.html">\  \- Pineta e Fonte \'\'Su Pardu\'\'</a>'

var menu4=new Array()
menu4[0]='<a>Il servizio 118</a>'
menu4[1]='<a href="foto_ambulanze.html">\  \- Le ambulanze</a>'
menu4[2]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu4[3]='<a href="numindut.html">- Numeri di tel. e indirizzi utili</a>'
menu4[4]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu4[5]='<a>Disservizi e lamentele</a>'
menu4[6]='<a href="lamentele_segnalazione.html">\  \- Segnala un disservizio...</a>'
menu4[7]='<a href="lamentele.html">\  \- Disservizi segnalati</a>'

var menu5=new Array()
menu5[0]='<a href="eventi_prossimi.html">- Prossimi eventi</a>'
menu5[1]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu5[2]='<a href="eventi_segnalazione.html">- Segnala un evento...</a>'
menu5[3]='<a href="eventi_segnalati.html">- Eventi segnalati</a>'
menu5[4]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu5[5]='<a href="mamuthones080223.html">- Esibizione dei Mamuthones e Issohadores di Mamoiada</a>'
menu5[6]='<a href="mamutzones080301.html">- Esibizione dei Mamutzones di Samugheo</a>'
menu5[7]='<a><hr color="#FEDCBA" size=1 width="96%"></a>'
menu5[8]='<a href="eventi_precedenti.html">- Eventi degli anni precedenti</a>'

var menu6=new Array()						
menu6[0]='<a href="informaz.html">- Informazioni su villasor.it</a>'
menu6[1]='<a href="segnalaz.html">- Segnalazioni e Impressioni</a>'
menu6[2]='<a href="links.html">- Collegamenti a siti amici</a>'


var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}

function dropdownmenu(obj, e, menucontents, menuwidth, gap){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")+gap
dropmenuobj.y=getposOffset(obj, "top")+3
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

function AltezzaDisponibile(Minimo)
{
    var pixelgap=0;
	var Altezza=screen.availheight;
	if (Altezza>Minimo+250) pixelgap=(Altezza-250);
    return pixelgap;
}

function fullscreen(pagina)
{
   window.open(pagina,"fullscreen","status=no,fullscreen=no,width=750,height=550")
}

function fullscreenbar(pagina)
{
   window.open(pagina,"fullscreen","status=no,fullscreen=no,scrollbars=yes,width=750,height=550")
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

window.onload = function()
{
	resizeMe();
}
window.onresize = function()
{
	resizeMe();
}
function resizeMe()
{
  if (document.getElementById("mezzo_interno"))
  {
	var AltAuto = 0;
	var AltDisp = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		AltDisp = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in ’standards compliant mode’
		AltDisp = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		AltDisp = document.body.clientHeight;
	}
	document.getElementById("mezzo_interno").style.height= "Auto";
	AltAuto = document.getElementById("mezzo_interno").offsetHeight;
	AltDisp = AltDisp-170;
	//window.alert(AltAuto+ " - " + AltDisp);
	if (AltDisp > 80)
	{
		if (AltAuto > AltDisp) document.getElementById("mezzo_interno").style.height = AltDisp + "px";
	}
	else
	{
		document.getElementById("mezzo_interno").style.height = "80px";
	}
  }
}

function VerificaForm(){
	FNome = document.FormSegnalazione.Cognome_e_nome.value
	FMail = document.FormSegnalazione.E_mail.value
  	if (FNome.length < 5 || FMail.indexOf('@', 0) == -1) alert("Devi inserire unNome e un indirizzo e-mail valido!")
  	else document.FormSegnalazione.submit()
}

var thumbnailviewer={
enableTitle: true, //Should "title" attribute of link be used as description?
enableAnimation: true, //Enable fading animation?
definetop: '<div class="topbar">Chiudi <img border="0" src="images/x.gif"></div>', //Define HTML for top interface
defineLoading: '<img src="images/loading.gif" /> Caricamento immagine ...', //Define HTML for "loading" div

/////////////No need to edit beyond here/////////////////////////

scrollbarwidth: 16,
opacitystring: 'filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1',
targetlinks:[], //Array to hold links with rel="thumbnail"

createthumbBox:function(){
//write out HTML for Image Thumbnail Viewer plus loading div
document.write('<div id="thumbBox" onClick="thumbnailviewer.closeit()">'+this.definetop+'<div id="thumbImage"></div><div id="thumbBottom"></div>'+'</div>')
document.write('<div id="thumbLoading">'+this.defineLoading+'</div>')
this.thumbBox=document.getElementById("thumbBox")
this.thumbImage=document.getElementById("thumbImage") //Reference div that holds the shown image
this.thumbLoading=document.getElementById("thumbLoading") //Reference "loading" div that will be shown while image is fetched
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
},


centerDiv:function(divobj){ //Centers a div element on the page
var ie=document.all && !window.opera
var dom=document.getElementById
var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.scrollbarwidth
var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight //Full scroll height of document
var objwidth=divobj.offsetWidth //width of div element
var objheight=divobj.offsetHeight //height of div element
var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" //Vertical position of div element: Either centered, or if element height larger than viewpoint height, 10px from top of viewpoint
divobj.style.left=docwidth/2-objwidth/2+"px" //Center div element horizontally
divobj.style.top=Math.floor(parseInt(topposition))+"px"
divobj.style.visibility="visible"
},

showthumbBox:function(){ //Show ThumbBox div
this.centerDiv(this.thumbBox)
if (this.enableAnimation){ //If fading animation enabled
this.currentopacity=0.1 //Starting opacity value
this.opacitytimer=setInterval("thumbnailviewer.opacityanimation()", 20)
}
},


loadimage:function(link){ //Load image function that gets attached to each link on the page with rel="thumbnail"
if (this.thumbBox.style.visibility=="visible") //if thumbox is visible on the page already
this.closeit() //Hide it first (not doing so causes triggers some positioning bug in Firefox
var imageHTML='<img src="'+link.getAttribute("href")+'" style="'+this.opacitystring+'" />' //Construct HTML for shown image
if (this.enableTitle && link.getAttribute("title")) //Use title attr of the link as description?
imageHTML+='<br/>'+link.getAttribute("title")
this.centerDiv(this.thumbLoading) //Center and display "loading" div while we set up the image to be shown
this.thumbImage.innerHTML=imageHTML //Populate thumbImage div with shown image's HTML (while still hidden)
this.featureImage=this.thumbImage.getElementsByTagName("img")[0] //Reference shown image itself
this.featureImage.onload=function(){ //When target image has completely loaded
thumbnailviewer.thumbLoading.style.visibility="hidden" //Hide "loading" div
thumbnailviewer.showthumbBox() //Display "thumbbox" div to the world!
}
if (document.all && !window.createPopup) //Target IE5.0 browsers only. Address IE image cache not firing onload bug: panoramio.com/blog/onload-event/
this.featureImage.src=link.getAttribute("href")
this.featureImage.onerror=function(){ //If an error has occurred while loading the image to show
thumbnailviewer.thumbLoading.style.visibility="hidden" //Hide "loading" div, game over
}
},

setimgopacity:function(value){ //Sets the opacity of "thumbimage" div per the passed in value setting (0 to 1 and in between)
var targetobject=this.featureImage
if (targetobject.filters && targetobject.filters[0]){ //IE syntax
if (typeof targetobject.filters[0].opacity=="number") //IE6
targetobject.filters[0].opacity=value*100
else //IE 5.5
targetobject.style.filter="alpha(opacity="+value*100+")"
}
else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
targetobject.style.MozOpacity=value
else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
targetobject.style.opacity=value
else //Non of the above, stop opacity animation
this.stopanimation()
},

opacityanimation:function(){ //Gradually increase opacity function
this.setimgopacity(this.currentopacity)
this.currentopacity+=0.1
if (this.currentopacity>1)
this.stopanimation()
},

stopanimation:function(){
if (typeof this.opacitytimer!="undefined")
clearInterval(this.opacitytimer)
},


closeit:function(){ //Close "thumbbox" div function
this.stopanimation()
this.thumbBox.style.visibility="hidden"
this.thumbImage.innerHTML=""
this.thumbBox.style.left="-2000px"
this.thumbBox.style.top="-2000px"
},

cleanup:function(){ //Clean up routine on page unload
this.thumbLoading=null
if (this.featureImage) this.featureImage.onload=null
this.featureImage=null
this.thumbImage=null
for (var i=0; i<this.targetlinks.length; i++)
this.targetlinks[i].onclick=null
this.thumbBox=null
},

dotask:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
},

init:function(){ //Initialize thumbnail viewer script by scanning page and attaching appropriate function to links with rel="thumbnail"
if (!this.enableAnimation)
this.opacitystring=""
var pagelinks=document.getElementsByTagName("a")
for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
if (pagelinks[i].getAttribute("rel") && pagelinks[i].getAttribute("rel")=="thumbnail"){ //Begin if statement
pagelinks[i].onclick=function(){
thumbnailviewer.stopanimation() //Stop any currently running fade animation on "thumbbox" div before proceeding
thumbnailviewer.loadimage(this) //Load image
return false
}
this.targetlinks[this.targetlinks.length]=pagelinks[i] //store reference to target link
} //end if statement
} //END FOR LOOP
//Reposition "thumbbox" div when page is resized
this.dotask(window, function(){if (thumbnailviewer.thumbBox.style.visibility=="visible") thumbnailviewer.centerDiv(thumbnailviewer.thumbBox)}, "resize")


} //END init() function

}

thumbnailviewer.createthumbBox() //Output HTML for the image thumbnail viewer
thumbnailviewer.dotask(window, function(){thumbnailviewer.init()}, "load") //Initialize script on page load
thumbnailviewer.dotask(window, function(){thumbnailviewer.cleanup()}, "unload")