
//trova un oggetto sparso nel documento

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}



<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->

// funzioni per creare le sfumature nelle immagini

function FuzzyOn(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}


function FuzzyOff(which2){
theobject=which2
lowlighting=setInterval("lowlightit(theobject)",50)
}

function FuzzyZero(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=0
}

function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}

function lowlightit(cur2){
if (cur2.filters.alpha.opacity>5)
cur2.filters.alpha.opacity-=5
else if (window.lowlighting)
clearInterval(lowlighting)
}



<!--

//**************//
//EFFETTO GRAFICO  MACCHINA DA SCRIVERE//

var speed = 50;                   // scroller speed
var msg_delay = 3000;             // delay between messages
var msg = new Array()
var reset=0

function InitSMS(MsgNum){

	switch (MsgNum)
	{
	case 1:

	 msg[0] = 'Abbigliamento per professionisti'
	  break;
	case 2:
	 msg[0] = 'Tutto per il sanitario'
	  break;
	case 3:
	 msg[0] = 'Alimentaristi e Cucina'
	  break;

	default:

	  msg[0] ='Benvenuto sul sito di Confezioni Cambiano'
	  break;
	}

}



// msg[1] = '<br><br>Featuring:';
// msg[2] = '<br>. A moving/blinking cursor';
// msg[3] = '<br>. Completely costomizable.';
// msg[4] = '<br>. Supports ALL HTML tags including images and links.';
// msg[5] = '<br>. Unlimited number of messages.';
// msg[6] = '<br>. Variable timings for different areas of message.<br>';


var cursor_color = '#000000'
var ticker_top = 80
var ticker_left = 80

//**************//

var pics = new Array()
pics[0] = ''
var temp = "";
var temp2 = "";
var count = 0;
var count2 = 1;
var count3 = 0;
var tag = 0;
var xCase,yCase,zCase

function set_scroller()
{// Tampone se non si trova l'errore
//alert()
document.all.scroller.innerHTML = msg[0]
}



function set_scroller1()



 {

 if (reset==1) {
      return(1);}

  document.all.scroll_holder.style.top   = ticker_top;
  document.all.scroll_holder.style.left  = ticker_left;
  scroller();
 }


function scroller()

 {

 //document.all.debug.innerHTML=reset
 if (reset==1) {alert(reset);
      return(1);}


  switch (count3) // change timings for different parts of message
  {
   case 0:   msg_delay = 3000; break
   case 2:   msg_delay = 200;  break
   case 7:   msg_delay = 3000; break
  }
  if (count3 < msg.length)
   {
	if (count2 < msg[count3].length + 1)
     {
      temp = msg[count3].substring(count,count2);
	  temp2+=temp;
      count++;
	  count2++;
	  if(temp=="<"||temp==">")status = temp
      document.all.scroller.innerHTML = temp2 + "<font color='"+cursor_color+"'>_</font>";
     xCase= setTimeout('scroller();',speed);
     }
	else
	 {
       document.all.scroller.innerHTML = temp2 + "<font color='"+cursor_color+"'><blink>_</blink></font>";
	  count = 0;
	  count2 = 1;
	  count3++;
	 yCase= setTimeout('scroller();',msg_delay);
	 }
   }
  else
   {
    count = 0;
	count2 = 1;
	temp2 = ""; // reset the entire message
	count3 = 0;
	zCase= setTimeout('scroller();',msg_delay);
   }
 }

function doBlink()
 {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""

 }

function resetScroll(){
clearInterval(xCase)
clearInterval(yCase)
clearInterval(zCase)
document.all.scroller.innerHTML=""
reset=1
//alert(reset)

var temp = "";
var temp2 = "";
var count = 0;
var count2 = 1;
var count3 = 0;
var tag = 0;

 }





// funzione per fare blinkare il testo HTML

function doBlink() {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)

   blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}

function startBlink() {
  // Make sure it is IE4
  if (document.all)
    setInterval("doBlink()",200)
}

// esempio di chiamata
// window.onload = startBlink;



// ------------------------- APRE UN POPUP CON I CREDITS SE PREMI CTRL+Q ------------------------------


function Credits(){
 if(document.layers){
   document.captureEvents(Event.KEYPRESS)
   }
   document.onkeypress=kpress;
}


function kpress(e){
   keyCode=(document.layers)?e.which:window.event.keyCode
   keyPressed=String.fromCharCode(key)
   // Debug
   //alert("Carattere premuto: "+ keyPressed + "Codice: " + keyCode)

  if (keyCode==17) { alert("Carattere premuto: "+ keyPressed + " " + keyCode);}

  }



//-------------------------------------------------------------------------------------------------------


// Lancia una applicazione


function launchApp(strCmdLine)
{
var obj = new ActiveXObject("LaunchinIE.Launch");
obj.LaunchApplication(strCmdLine);
}



//--------------------------------------------------------------------------------------------

// funzioni per creare le sfumature nelle immagini


function FuzzyOn(which2){
theobject=which2
//alert()
which2.style.visibility="visible"
highlighting=setInterval("highlightit(theobject)",10)
}


function FuzzyZero(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=0
}


function FuzzyOff(which2){
theobject=which2
lowlighting=setInterval("lowlightit(theobject)",10)
//alert();

}


function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}

/*

function lowlightit(cur2){
if (cur2.filters.alpha.opacity>5)
	cur2.filters.alpha.opacity-=5
else if (window.lowlighting){
	clearInterval(lowlighting)}

     else {
    // cur2.style.visibility="hidden"}
}

*/



function lowlightit(cur2){
if (cur2.filters.alpha.opacity>5)
	cur2.filters.alpha.opacity-=5
else if (window.lowlighting){
	clearInterval(lowlighting)
	//alert()
	cur2.style.visibility="hidden"
	}

}



// ----------------------------------------------------------------------------------------------

// funzioni per traslare la foto del relatore


n = (document.layers) ? 1:0
ie = (document.all) ? 1:0

block = new Array()



//xEndPos=750
//numeroOggetto=1



// ---------------------------------------- INIZIALIZZAZIONE OGGETTO ---------------------------------------------------------

// carica l'oggetto layer in un array da utilizzare nella funzione seguente:
// prende in carico il nome dell'oggetto e l'indice dell'oggetto da creare e utilizzare nella funzione ricorsiva


function inizializzaPosOggetto(oggetto,numeroOggetto) {
//alert(oggetto+ " " +numeroOggetto)

	/*

	if (browser == "EXPLORER")  {

		   block[numeroOggetto]=MM_findObj(oggetto).style
		  }
	else

		  {   block[numeroOggetto] = MM_findObj(oggetto)
			alert("sono qui")
			}
 */


   block[numeroOggetto]=MM_findObj(oggetto).style



	block[numeroOggetto].xpos = parseInt(block[numeroOggetto].left)
	block[numeroOggetto].ypos = parseInt(block[numeroOggetto].top)



}


// ----------------------------------------- SLIDE OGGETTO NELLE 4 DIREZIONI ----------------------------------------------

// prende in carico la posizione X finale, la posizione Y finale e il numero dell'indice precaricato dalla funzione precedente


function slide(xEndPos,yEndPos,numeroOggetto) {



	block[numeroOggetto].visibility="visible"

	//alert("X:" + block[numeroOggetto].xpos + " Y:"+ block[numeroOggetto].ypos + " EndX:" + xEndPos + " EndY:" + yEndPos)


	// --------------- Posizione X maggiore ------------------------------
	if (block[numeroOggetto].xpos > xEndPos + 10) {
		block[numeroOggetto].xpos += -5
		block[numeroOggetto].left = block[numeroOggetto].xpos
	}




	// --------------- Posizione X Minore ------------------------------
	if (block[numeroOggetto].xpos < xEndPos - 10) {
		block[numeroOggetto].xpos += +5
		block[numeroOggetto].left = block[numeroOggetto].xpos
	}




	// --------------- Posizione Y Maggiore ------------------------------
	if (block[numeroOggetto].ypos > yEndPos + 10) {
		block[numeroOggetto].ypos += -5
		block[numeroOggetto].top = block[numeroOggetto].ypos

	}



	// --------------- Posizione Y Minore  ------------------------------
	if (block[numeroOggetto].ypos < yEndPos - 10) {
		block[numeroOggetto].ypos += +5
		block[numeroOggetto].top = block[numeroOggetto].ypos
	}



	if ((block[numeroOggetto].xpos > xEndPos + 10) || (block[numeroOggetto].xpos < xEndPos - 10) || (block[numeroOggetto].ypos > yEndPos + 10) || (block[numeroOggetto].ypos < yEndPos - 10)) {
	 	setTimeout("slide(" + xEndPos + "," + yEndPos + "," + numeroOggetto + ")",10)

	 }


}




function moveTo(obj,x,y) {
	obj.xpos = x
	obj.ypos = y
	obj.left = obj.xpos
	obj.top = obj.ypos
}









// ------------------ Funzione per visualizzare il waiting nella pagina (da invocare appena prima del caricamento della pagina) ----------------------------------------------------

function pleaseWait()
{
MM_showHideLayers('pleaseWait','','show')
}


function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


// RESET DI UN FORM VIA JAVASCRIPT

function clearForm(formIdent)
{
  var form, elements, i, elm;
  form = document.getElementById
    ? document.getElementById(formIdent)
    : document.forms[formIdent];

	if (document.getElementsByTagName)
	{
		elements = form.getElementsByTagName('input');
		for( i=0, elm; elm=elements.item(i++); )
		{
			if (elm.getAttribute('type') == "text")
			{
				elm.value = '';
			}
		}
		elements = form.getElementsByTagName('select');
		for( i=0, elm; elm=elements.item(i++); )
		{
			elm.options.selectedIndex=0;
		}
		
	    elements = form.getElementsByTagName('checkbox');
		for( i=0, elm; elm=elements.item(i++); )
		{
			elm.checked=false;
		}
		
		
		
	}
	// Actually looking through more elements here
	// but the result is the same.
	else
	{
		elements = form.elements;
		for( i=0, elm; elm=elements[i++]; )
		{
			if (elm.type == "text")
			{
				elm.value ='';
			}
		}
	}
}












function addEvent(elm, strEvent, fnHandler)
{
	return ( elm.addEventListener
	? elm.addEventListener( strEvent, fnHandler, false)
	: elm.attachEvent( 'on'+strEvent, fnHandler)
	);
}



function test(){
	alert()
	}



function showHideObj(obj){
	x=obj.className=="show"?obj.className="hide":obj.className="show"
	}



// -------------------- Gestione di un cookie ------------------------------------------------



function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


//--- visualizza in un alert il contenuto del cookie -------------------
function messageCookie(name){
	alert(readCookie(name))
	}

// -------------------------------------------UNA DATA SU SCHERMO----------------------------------------------------------------
// prende in carico l1 l2 l3 direttamente dalla varibile generica della lingua

function visualDate(lingua){

								var mydate=new Date()
								var year=mydate.getYear()
								if (year < 1000)
								year+=1900
								var day=mydate.getDay()
								var month=mydate.getMonth()
								var daym=mydate.getDate()
								if (daym<10)
								daym="0"+daym
								
								switch (lingua) { 
								
								case "l1":
								var dayarray=new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato")
								var montharray=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre")
								document.write(dayarray[day]+",  "+daym+" "+montharray[month]+" "+year)
								break;
								
								
								case "l2":
								var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
								var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
								document.write(dayarray[day]+", "+montharray[month]+" "+daym+" "+year)
								break;
								
								default:
								var dayarray=new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato")
								var montharray=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre")
								document.write(dayarray[day]+",  "+daym+" "+montharray[month]+" "+year)
								break;
								
								
								
								}
}


			//--------------------  FUNZIONE PER RECUPERARE VIA JAVASCRIPT IL VALORE DI UN RADIOBUTTON ------------------------------
			// esempio di chiamata: prodottoItalpunte=getRadioValue("produttoreUtensile")
			
			function getRadioValue(nomeOggettoRadio)
			{
			oggetto = document.getElementsByName(nomeOggettoRadio)
			for (i=0; i<oggetto.length; i++)
				{
				  if (oggetto[i].checked == true)
				  		{
						//alert(oggetto[i].value)
						return oggetto[i].value
						}
				}
			
			}
			//------------------------------------------------------------------------------------------------------------------------
			
			// FUNZIONE PER ABILITARE O DISABILITARE UNA COLLECTION DI RADIOBUTTON 
			// il parametro  nomeOggettoRadio accetta il nome di un oggetto radio es:  "pippoRadio"
			// il parametro evento: 1=abilita 2=disabilita
			// esempio di chiamata: abilitaDisabilitaRadioCollection("pippoRadio",1)
			
			function abilitaDisabilitaRadioCollection(nomeOggettoRadio,evento)
			{
			oggetto = document.getElementsByName(nomeOggettoRadio)
			for (i=0; i<oggetto.length; i++)
				{
				 
				  if (evento == 1)
				  		{
						oggetto[i].disabled=false
						}
				  else
						{
						oggetto[i].checked=false  //azzero il contenuto
						oggetto[i].disabled=true
						}
				
				}
			
			}
			//-----------------------------------------------------------------------------------------------------------------------------
			// COME SOPRA MA PER LE TEXTBOX UNICA DIFFERENZA BISOGNA PASSARE L'ID dell'OGGETTO AL POSTO DEL NOME
			//esempio: 	abilitaDisabilitaTextBox("matricola",1)
			
			function abilitaDisabilitaTextBox(idOggetto,evento)
			{
			oggetto = document.getElementById(idOggetto)
			//alert(evento)
			  
			  if (evento == 1) 
			  	{
				//oggetto.value="yeahhhhhhhhhhhhhhhh"
				oggetto.disabled=false
				oggetto.className="formNormal"
				}
				else
				{
				oggetto.value="" // svuoto la textbox
				oggetto.disabled=true
				oggetto.className="formGrayed"
				}
				
				{

				}
			}
			
			
			

	/************************************************************************************************************
	SELECT EDITABILE MOLTO UTILE

		I.e.: A combination of text-and selectbox. You can type in a value or choose from the list
		
		The only thing you have to do to make this work is to add an attribute "selectBoxOptions" to one of your text inputs:
		
		<input type="text" name="myText" value="Norway" selectBoxOptions="Canada;Denmark;Finland;Germany;Mexico;Norway;Sweden;United Kingdom;United States"> 
		
		And then simply call a javascript function that creates the editable select box:
		
		
		in una riga javascript scrivere per creare l'oggetto:
		createEditableSelect(document.forms[0].myText);
		


	************************************************************************************************************/	
 
	
	// Path to arrow images
	var arrowImage = '/images/interface/icons/select_arrow.gif';	// Regular arrow
	var arrowImageOver = '/images/interface/icons/select_arrow_over.gif';	// Mouse over
	var arrowImageDown = '/images/interface/icons/select_arrow_down.gif';	// Mouse down
 
	
	var selectBoxIds = 0;
	var currentlyOpenedOptionBox = false;
	var editableSelect_activeArrow = false;
	
 
	
	function selectBox_switchImageUrl()
	{
		if(this.src.indexOf(arrowImage)>=0){
			this.src = this.src.replace(arrowImage,arrowImageOver);	
		}else{
			this.src = this.src.replace(arrowImageOver,arrowImage);
		}
		
		
	}
	
	function selectBox_showOptions()
	{
		if(editableSelect_activeArrow && editableSelect_activeArrow!=this){
			editableSelect_activeArrow.src = arrowImage;
			
		}
		editableSelect_activeArrow = this;
		
		var numId = this.id.replace(/[^\d]/g,'');
		var optionDiv = document.getElementById('selectBoxOptions' + numId);
		if(optionDiv.style.display=='block'){
			optionDiv.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='none';
			this.src = arrowImageOver;	
		}else{			
			optionDiv.style.display='block';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='block';
			this.src = arrowImageDown;	
			if(currentlyOpenedOptionBox && currentlyOpenedOptionBox!=optionDiv)currentlyOpenedOptionBox.style.display='none';	
			currentlyOpenedOptionBox= optionDiv;			
		}
	}
	
	function selectOptionValue()
	{
		var parentNode = this.parentNode.parentNode;
		var textInput = parentNode.getElementsByTagName('INPUT')[0];
		textInput.value = this.innerHTML;	
		this.parentNode.style.display='none';	
		document.getElementById('arrowSelectBox' + parentNode.id.replace(/[^\d]/g,'')).src = arrowImageOver;
		
		if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + parentNode.id.replace(/[^\d]/g,'')).style.display='none';
		
	}
	var activeOption;
	function highlightSelectBoxOption()
	{
		if(this.style.backgroundColor=='#316AC5'){
			this.style.backgroundColor='';
			this.style.color='';
		}else{
			this.style.backgroundColor='#316AC5';
			this.style.color='#FFF';			
		}	
		
		if(activeOption){
			activeOption.style.backgroundColor='';
			activeOption.style.color='';			
		}
		activeOption = this;
		
	}
	
	function createEditableSelect(dest)
	{
 
		dest.className='selectBoxInput';		
		var div = document.createElement('DIV');
		div.style.styleFloat = 'left';
		div.style.width = dest.offsetWidth + 16 + 'px';
		div.style.position = 'relative';
		div.id = 'selectBox' + selectBoxIds;
		var parent = dest.parentNode;
		parent.insertBefore(div,dest);
		div.appendChild(dest);	
		div.className='selectBox';
		div.style.zIndex = 10000 - selectBoxIds;
 
		var img = document.createElement('IMG');
		img.src = arrowImage;
		img.className = 'selectBoxArrow';
		
		img.onmouseover = selectBox_switchImageUrl;
		img.onmouseout = selectBox_switchImageUrl;
		img.onclick = selectBox_showOptions;
		img.id = 'arrowSelectBox' + selectBoxIds;
 
		div.appendChild(img);
		
		var optionDiv = document.createElement('DIV');
		optionDiv.id = 'selectBoxOptions' + selectBoxIds;
		optionDiv.className='selectBoxOptionContainer';
		optionDiv.style.width = div.offsetWidth-2 + 'px';
		div.appendChild(optionDiv);
		
		if(navigator.userAgent.indexOf('MSIE')>=0){
			var iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			iframe.style.width = optionDiv.style.width;
			iframe.style.height = optionDiv.offsetHeight + 'px';
			iframe.style.display='none';
			iframe.id = 'selectBoxIframe' + selectBoxIds;
			div.appendChild(iframe);
		}
		
		if(dest.getAttribute('selectBoxOptions')){
			var options = dest.getAttribute('selectBoxOptions').split(';');
			var optionsTotalHeight = 0;
			var optionArray = new Array();
			for(var no=0;no<options.length;no++){
				var anOption = document.createElement('DIV');
				anOption.innerHTML = options[no];
				anOption.className='selectBoxAnOption';
				anOption.onclick = selectOptionValue;
				anOption.style.width = optionDiv.style.width.replace('px','') - 2 + 'px'; 
				anOption.onmouseover = highlightSelectBoxOption;
				optionDiv.appendChild(anOption);	
				optionsTotalHeight = optionsTotalHeight + anOption.offsetHeight;
				optionArray.push(anOption);
			}
			if(optionsTotalHeight > optionDiv.offsetHeight){				
				for(var no=0;no<optionArray.length;no++){
					optionArray[no].style.width = optionDiv.style.width.replace('px','') - 22 + 'px'; 	
				}	
			}		
			optionDiv.style.display='none';
			optionDiv.style.visibility='visible';
		}
		
		selectBoxIds = selectBoxIds + 1;
	}	
	


					