// JavaScript Document
//*******************JAVASCRIPT INITIALIZING FUNCTIONS********************************************************
//functions initialize functions
window.onload = callfunctions;
window.onunload = removefunctions;
function callfunctions() {
	formValidationOverRules();
	start_slideshow();
	if(document.location.href == "http://www.ilvetrointesta.com/index.php?subsection=dovesono") {
		loadMaps();
	}
}

function removefunctions() {
	if(document.location.href == "http://www.ilvetrointesta.com/index.php?subsection=dovesono") {
		GUnload();
	}
}

Event.observe(window, 'load', function(evnt){        
		var ProtFlow = new ProtoFlow($("protoflow"), {                
				startIndex: 3,  //which image do you want the flow                                                
				//to focus on by default
				                
				slider: true,   //show or hide slider?                
				captions: true, //show or hide captions, by default we hide it.                                 
				//So YOU MUST turn it on here                
				useReflection: true,   //Add reflection to your images. Please                                 
				//note that this will slow down rendering.                
				enableOnClickScroll: false //add NEW! if you wish to keep scrolling
				//on click just set this to be true         
		});
});


//SLIDESHOW PROTOTYPE + SCRIPTACULOUS //Mclaud 2K8
var slides= new Array('slide1','slide2','slide3','slide4','slide5');
var slidesdesc= new Array('','','','',''); 
var i = 0; 
var wait = 8000;
var filetype = '.jpg';
function SlideShow() {
	Effect.Fade(slides[i], { duration:0.5, from:1.0, to:0.0, fps: 30 }); 
	i++;
	if (i == slides.length) i = 0; 
	Effect.Appear(slides[i], { duration:0.5, from:0.0, to:1.0, fps: 30 });
} 

// the onload event handler that starts the fading. 
function start_slideshow() { 
	setInterval('SlideShow()',wait); 
	for(var n=1; n<=slides.length; n++) {
		var style = (n>1)?'style="display: none;"':'';
		$("banner").innerHTML+= '<div class="slide" id="slide'+n+'" '+style+'>'
								+'<img src="./images/banner/slide'+n+filetype+'">'
								+'</div>';	
	}
}

//*******************FORM VALIDATION FUNCTIONS****************************************************************************
//form onFocus and onBlur functions:
/*CODICE MOLTO TOZZO RIPRESO DA QUELLO SOTTO (funziona solo da solo): (vedi anche assoeurope_form.css) McLaud2k4*/
function formValidationOverRules() {
	//rel external --- overrides the target="_blank" tag:
	//Before:<a href="document.html" target="_blank">external link</a>
	//After:<a href="document.html" rel="external">external link</a>
	 var anchors = document.getElementsByTagName("a");
	 for (var i=0; i<anchors.length; i++) {
	   var anchor = anchors[i];
	   if (anchor.getAttribute("href") &&
			   anchor.getAttribute("rel") == "external")
			 anchor.target = "_blank";
	 }
}

//
function emailes(Address,Domain) {
	var Mailme = "mail" + "to:"+Address+"@"+Domain;
	parent.location=Mailme;
}

/*
for (var i=0;i<document.images.length;i++) {
	document.images[i].oncontextmenu = function (){ return false;};
}
*/
document.oncontextmenu = function (){ return false };
