// JavaScript Document

   function init()  
 {  
 //assegna le funzioni di rollover ai menu con id "navx" dove x è da 1 a nNav
  var nNav=1;
  var imgs,j,i;  
 // Loop through all images, check if they contain the class roll  
 	for (j=1;j<=nNav;j++) {
	  uls=document.getElementById('nav'+j)
	  if (uls) {
	  imgs=uls.getElementsByTagName('img');  
	  for(i=0;i<imgs.length;i++)  
	  {  
	   if(/roll/.test(imgs[i].className))  
	   {  
	 // add the function roll to the parent Element of the image  
		   if(tag!='' && imgs[i].getAttribute('name')==tag) {
			   sr = imgs[i].src
			   ft = sr.substring(sr.lastIndexOf('.'), sr.length);  
			   imgs[i].src= sr.replace(ft, '_on'+ft);;
		   }else{
		   imgs[i].parentNode.onmouseover=function(){roll(this);};  
		   imgs[i].parentNode.onmouseout=function(){roll(this);};  
		   }
	   }  
	  }  
	  }
	}
	//se c'è il box delle news scorrevole assegna i comportamenti di cambio variabile
	var mc = document.getElementById("marqueecontainer");
	if (mc){
		initializemarquee();
		mc.onmouseover=function(){copyspeed=pausespeed;};
		mc.onmouseout=function(){copyspeed=marqueespeed;};	
	}
	//se c'è una form assegna inizia la validazione
	var formv = document.getElementsByTagName("form");
	for(i=0;i<formv.length;i++)  
	  {
		  if(/valida/.test(formv[i].className))
		  {
			var nome = formv[i].getAttribute('id');
		  	var valid = new Validation(nome, {immediate : true, onFormValidate : formCallback});
		  	Validation.addAllThese([
							['validate-password', 'Password non valida', {
								minLength : 6,
								notOneOf : ['password','PASSWORD','1234567','0123456'],
								notEqualToField : 'username_'
							}],
							['validate-password-confirm', 'Le password non coincidono', {
								equalToField : 'password_'
							}]
						]);
		  }
	  }
   //se c'è un'area per la comparsa e scomparsa dei div qui la configura
   div_effetto = document.getElementById("effetto");
	 if (div_effetto) {
	 links =  div_effetto.getElementsByTagName("a");
	 var attivita = new Array();
	 var nt = "";
	 for(i=0;i<links.length;i++)  
	  {  
	   if(/blind/.test(links[i].className))  
	   {		
	   			j=links[i].getAttribute('id').replace("toggle","");
				attivita[j] = new Fx.Slide('attivita_'+j);$('toggle'+j).addEvent('click', function(e){
				e = new Event(e);				
				h = this.getAttribute('id').replace("toggle","");
				attivita[h].toggle();
				if (nt!="") attivita[nt].toggle();
				if (h!=nt){
					nt = h;
				}else{
					nt="";
				}
				e.stop();
				});
				if (c == "") attivita[j].hide();
	   }
	  }
	 }
 }  
 function hide() {

document.getElementById('popup').style.visibility = 'hidden';
}

 //funzioni richiamate dalla init
 function roll(o)  
 {  
  var i,isnode,src,ftype,newsrc,nownode;  
 // loop through all childNodes  
  for (i=0;i<o.childNodes.length;i++)  
  {  
   nownode=o.childNodes[i];  
 // if the node is an element and an IMG set the variable and exit the loop  
   if(nownode.nodeType==1 && /img/i.test(nownode.nodeName))  
   {  
    isnode=i;  
    break;  
   }  
  }  
 // check src and do the rollover  
  src = o.childNodes[isnode].src;  
  ftype = src.substring(src.lastIndexOf('.'), src.length);  
  if(/_on/.test(src))  
  {  
   newsrc = src.replace('_on','');  
  }else{  
   newsrc = src.replace(ftype, '_on'+ftype);  
  }  
  o.childNodes[isnode].src=newsrc;  
 }  
   
/* window.onload=function(){  
  init();  
 }  
 */
 /***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}
function formCallback(result, form) {
	window.status = "validation callback for form '" + form.id + "': result = " + result;
}

// e qui parte tutto
if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.getElementById)
window.onload=init

