function imgHover(id,tag){
	if ($(id)) {
      var sfEls = $(id).getElementsByTagName(tag);
      for (var i=0; i<sfEls.length; i++) {
            sfEls[i].onmouseover=function() {  
                  if (this.className.search("rollOver")>=0){
                        if (this.src.search("jpg")>=0){
                             this.src=this.src.replace('.jpg','_a.jpg');
                        }else{
                             this.src=this.src.replace('.gif','_a.gif');
                        }
                  }
            }
            sfEls[i].onmouseout=function() {
                  if (this.className.search("rollOver")>=0){
                        if (this.src.search("jpg")>=0){
                             this.src=this.src.replace('_a.jpg','.jpg');
                        }else{
                             this.src=this.src.replace('_a.gif','.gif');
                        }
                  }
            }
      }
	}
}

function tagHover(id,tag,cssOver,cssOut,auto,button) {
	if ($(id)) {
		var sfEls = $(id).getElementsByTagName(tag);
		for (var i=0; i<sfEls.length; i++) {
		   if (auto) sfEls[i].className = cssOver; //solo se si vuole settare un classe iniziale per il menu serve
		   sfEls[i].onmouseover=function() {  
				if ((this.className.search(cssOver)>=0) && (this.className.search(cssOver+"_on")==-1)  && (this.className.search(cssOver+"_open")==-1)) {
					this.className = this.className.replace(cssOver,cssOut);
					if (button) {
						var sfElsChild = this.parentNode.getElementsByTagName("SPAN");
						if (sfElsChild.length == 1) if (sfElsChild[0].className == "freccia") sfElsChild[0].className = "frecciaHover";
					}
				}				
			}
			sfEls[i].onmouseout=function() {
				if ((this.className.search(cssOut)>=0) && (this.className.search(cssOut+"_on")==-1)  && (this.className.search(cssOut+"_open")==-1)){
					this.className = this.className.replace(cssOut,cssOver);
					if (button) {
						var sfElsChild = this.parentNode.getElementsByTagName("SPAN");
						if (sfElsChild.length == 1) if (sfElsChild[0].className == "frecciaHover") sfElsChild[0].className = "freccia";
					}
				}				
		   }
		}
	}
}

function hideAllFAQ(){
	var sfEls = $('content').getElementsByTagName("P");
	for (var i=0; i<sfEls.length; i++) {
		if (sfEls[i].id.search("Risposta")>=0)
			sfEls[i].style.display='none';
	}
}

/*
 * USAGE: 
 * 
 * <script language="javascript" type="text/javascript"> 
 *   window.addEvent('domready', function() {
 *   tagHover ('menuSinistra','LI','ulliSubMenuNotHover','ulliSubMenuHover',false);
 *   tagHover ('menuSx','LI','sfondoGrigio','coloreSfondo',false);
 *   tagHover ('pageContent','DIV','testoBottone bottone','testoBottoneHover bottoneHover',false,true);
 *   });
 * </script>
 * 
 * oppure
 * 
 * <script language="javascript" type="text/javascript"> 
 *   window.addEvent('domready', function() {
 *   imgHover('menu', 'IMG');
 *   });	
 * </script>
*/