/**
 * @author Hilite s.n.c.
 */


/* HELP
 * 
 * 	Gli Items Selezionabili devono avere l'attributo class impostato su 'item';
 *  Gli	Items selezionati devono avere l'attributo class impostato su 'selected';
 *  I SubItems devon avere l'attributo class impostato su 'subItem';
 *  Per rendere un elemento un collegamento ipertestuale impostare l'attributo navigate sull'url desiderato;
 * 
 */



/* PARAMETRI CONFIGURAZIONE */

/* Stili transizione voci principali */
        
		
        var stili_transizione = new Array();
        
        stili_transizione['durata'] = 150;
        stili_transizione['color'] = '#7F141C';
        stili_transizione['bgColor'] = '#CCCCCC';
        stili_transizione['padding-left'] = 12;
        stili_transizione['padding-top'] = 2;
        stili_transizione['padding-right'] = 2;
        stili_transizione['padding-bottom'] = 2;
        stili_transizione['border'] = '0px solid #FFFFFF';
        stili_transizione['font-family'] = 'verdana';
        stili_transizione['font-size'] = 10;
        stili_transizione['cursor'] = 'pointer';
		stili_transizione['font-weight'] = 'bold';
		stili_transizione['text-decoration'] = 'none';
        
        
        /* Stili iniziali per gli items */
        
        var stili_item = new Array();
        
        stili_item['color'] = '#333333';
        stili_item['bgColor'] = '#E3E3E3';
        stili_item['padding-left'] = 6;
        stili_item['padding-top'] = 2;
        stili_item['padding-right'] = 2;
        stili_item['padding-bottom'] = 2;
        stili_item['border'] = '0px solid #BBBBBB';
        stili_item['font-family'] = 'verdana';
        stili_item['font-size'] = 10;
        stili_item['item-width'] = 160;
        stili_item['margin-top'] = 6;
        stili_item['cursor'] = 'pointer';
		stili_item['font-weight'] = 'bold';
		stili_item['text-decoration'] = 'none';
        
       
        /* Stili sub items*/

        var stili_sub_item = new Array();
        
        stili_sub_item['color'] = '#FFFFFF';
        stili_sub_item['bgColor'] = '#636363';
        stili_sub_item['padding-left'] = 10;
        stili_sub_item['padding-top'] = 3;
        stili_sub_item['padding-right'] = 3;
        stili_sub_item['padding-bottom'] = 3;
        stili_sub_item['border'] = '0px solid #DDD';
        stili_sub_item['font-family'] = 'verdana';
        stili_sub_item['font-size'] = 10;
        stili_sub_item['item-width'] = 160;
        stili_sub_item['margin-top'] = 4;
        stili_sub_item['cursor'] = 'pointer';
		stili_sub_item['font-weight'] = 'bold';
		stili_sub_item['text-decoration'] = 'none';
        
        
        /* Stili transizione sub items*/
        
        var stili_transizione_sub = new Array();
        
        stili_transizione_sub['durata'] = 150;
        stili_transizione_sub['color'] = '#FFFFFF';
        stili_transizione_sub['bgColor'] = '#838383';
        stili_transizione_sub['padding-left'] = 18;
        stili_transizione_sub['padding-top'] = 3;
        stili_transizione_sub['padding-right'] = 3;
        stili_transizione_sub['padding-bottom'] = 3;
        stili_transizione_sub['border'] = '0px solid #DDD';
        stili_transizione_sub['font-family'] = 'verdana';
        stili_transizione_sub['font-size'] = 10;
        stili_transizione_sub['cursor'] = 'pointer';
		stili_transizione_sub['font-weight'] = 'bold';
		stili_transizione_sub['text-decoration'] = 'none';
        
        
        /* Stili voce selezionata */
        
        var stili_selezione = new Array();
        
        stili_selezione['margin-top'] = 7;
        stili_selezione['color'] = '#333333';
        stili_selezione['bgColor'] = '#F7BA00';
        stili_selezione['padding-left'] = 6;
        stili_selezione['padding-top'] = 3;
        stili_selezione['padding-right'] = 3;
        stili_selezione['padding-bottom'] = 3;
        stili_selezione['border'] = '0px solid #FFFFFF';
        stili_selezione['font-family'] = 'verdana';
        stili_selezione['font-size'] = 10;
        stili_selezione['cursor'] = 'default';
        stili_selezione['item-width'] = 160;
        stili_selezione['font-weight'] = 'bold';
		stili_selezione['text-decoration'] = 'none';
    
        $$('div.item').each(
                                function(item)
                                {
                                
                                    InitItem(item);
                                
                                
                                   item.onmouseover = function()
                                                      {
                                                         var effect = new Fx.Styles(this,{duration: stili_transizione['durata'],transition: Fx.Transitions.linear});
                                                         effect.start({'padding-left' : [stili_item['padding-left'],stili_transizione['padding-left']]});
                                                         
                                                         this.setStyle('color',stili_transizione['color']);
                                                         this.setStyle('background-color',stili_transizione['bgColor']);
                                                         this.setStyle('border',stili_transizione['border']);
                                                         this.setStyle('font-family',stili_transizione['font-family']);
                                                         this.setStyle('cursor',stili_transizione['cursor']);
                                                         this.setStyle('font-size',stili_transizione['font-size'] + 'px');
														 this.setStyle('font-weight',stili_transizione['font-weight']);
														 this.setStyle('text-decoration',stili_transizione['text-decoration']);
                                                      }
                                   
                                   item.onclick = function()
                                                  {
                                                    if(this.getProperty('navigate') != undefined)
                                                    {
														if(this.getProperty("target") == undefined)
														{
															location.href = this.getProperty('navigate');
														}
                                                        else
														{
															$(this.getProperty('target')).src = this.getProperty('navigate');
														}
                                                    }
                                                  }
                                   
                                   
                                   item.onmouseout = function()
                                                     {
                                                         var effect = new Fx.Styles(this,{duration: stili_transizione['durata'],transition: Fx.Transitions.linear});
                                                         effect.start({'padding-left' : [stili_transizione['padding-left'],stili_item['padding-left']]});
                                                         this.setStyle('color',stili_item['color']);
                                                         this.setStyle('background-color',stili_item['bgColor']);
                                                         this.setStyle('border',stili_item['border']);
                                                         this.setStyle('font-family',stili_item['font-family']);
                                                         this.setStyle('font-size',stili_item['font-size'] + 'px');
														 this.setStyle('font-weight',stili_item['font-weight']);
														 this.setStyle('text-decoration',stili_item['text-decoration']);
                                                     }
                                }
                            );
                   
                   
              $$('div.subItem').each(
                                        function(item)
                                        {
                                            InitSubItem(item);
                                            
                                            item.onmouseover = function()
                                                      {
                                                         var effect = new Fx.Styles(this,{duration: stili_transizione_sub['durata'],transition: Fx.Transitions.linear});
                                                         effect.start({'padding-left' : [stili_sub_item['padding-left'],stili_transizione_sub['padding-left']]});
                                                         
                                                         this.setStyle('color',stili_transizione_sub['color']);
                                                         this.setStyle('background-color',stili_transizione_sub['bgColor']);
                                                         this.setStyle('border',stili_transizione_sub['border']);
                                                         this.setStyle('font-family',stili_transizione_sub['font-family']);
                                                         this.setStyle('cursor',stili_transizione_sub['cursor']);
                                                         this.setStyle('font-size',stili_transizione_sub['font-size'] + 'px');
														 this.setStyle('font-weight',stili_transizione_sub['font-weight']);
														 this.setStyle('text-decoration',stili_transizione['text-decoration']);
                                                      }
                                                      
                                            item.onclick = function()
                                                            {
                                                                if(this.getProperty('navigate') != undefined)
                                                    			{
																	if(this.getProperty("target") == undefined)
																	{
																		location.href = this.getProperty('navigate');
																	}
                                                        			else
																	{
																		$(this.getProperty('target')).src = this.getProperty('navigate');
																	}
                                                    			}
                                                            }          
                                                      
                                            item.onmouseout = function()
                                                     {
                                                         var effect = new Fx.Styles(this,{duration: stili_transizione_sub['durata'],transition: Fx.Transitions.linear});
                                                         effect.start({'padding-left' : [stili_transizione_sub['padding-left'],stili_sub_item['padding-left']]});
                                                         this.setStyle('color',stili_sub_item['color']);
                                                         this.setStyle('background-color',stili_sub_item['bgColor']);
                                                         this.setStyle('border',stili_sub_item['border']);
                                                         this.setStyle('font-family',stili_sub_item['font-family']);
                                                         this.setStyle('font-size',stili_sub_item['font-size'] + 'px');
														 this.setStyle('font-weight',stili_sub_item['font-weight']);
														 this.setStyle('text-decoration',stili_sub_item['text-decoration']);
                                                     }
                                            
                                        }
                                      );
                                      
              
             $$('div.selected').each
			 				(
									function(item)
									{
										InitSelectedItem(item);	
									}
                    		);
      
      function InitItem(item)
      {
	  	
		if(item != null && item != undefined )
		{
	        item.style.fontFamily = stili_item['font-family'];
	        item.style.fontSize = stili_item['font-size'] + 'px';
	        item.style.paddingLeft = stili_item['padding-left'] + 'px';
	        item.style.paddingRight = stili_item['padding-right'] + 'px';
	        item.style.paddingTop = stili_item['padding-top'] + 'px';
	        item.style.paddingBottom = stili_item['padding-bottom'] + 'px';
	        item.style.border = stili_item['border'];
	        item.style.width = stili_item['item-width'] + 'px';
	        item.style.marginTop = stili_item['margin-top'] + 'px';
	        item.style.cursor = stili_item['cursor'];
	        item.style.color = stili_item['color'];
			item.style.backgroundColor = stili_item['bgColor'];
			item.style.fontWeight = stili_item['font-weight'];
			item.style.textDecoration = stili_item['text-decoration'];			
			
		}
      }
      
      function InitSubItem(item)
      {
	  	
		if(item != null && item != undefined)
		{
	        item.style.fontFamily = stili_sub_item['font-family'];
	        item.style.fontSize = stili_sub_item['font-size'] + 'px';
	        item.style.paddingLeft = stili_sub_item['padding-left'] + 'px';
	        item.style.paddingRight = stili_sub_item['padding-right'] + 'px';
	        item.style.paddingTop = stili_sub_item['padding-top'] + 'px';
	        item.style.paddingBottom = stili_sub_item['padding-bottom'] + 'px';
	        item.style.border = stili_sub_item['border'];
	        item.style.width = stili_sub_item['item-width'] + 'px';
	        item.style.marginTop = stili_sub_item['margin-top'] + 'px';
	        item.style.cursor = stili_sub_item['cursor'];
	        item.style.color = stili_sub_item['color'];
	        item.style.backgroundColor = stili_sub_item['bgColor'];
			item.style.fontWeight = stili_sub_item['font-weight'];
			item.style.textDecoration = stili_sub_item['text-decoration'];		
			
		}		

      }
      
      function InitSelectedItem(item)
      {
	  	
		if(item != null && item != undefined)
		{
			item.style.fontFamily = stili_selezione['font-family'];
        	item.style.fontSize = stili_selezione['font-size'] + 'px';
        	item.style.paddingLeft = stili_selezione['padding-left'] + 'px';
        	item.style.paddingRight = stili_selezione['padding-right'] + 'px';
        	item.style.paddingTop = stili_selezione['padding-top'] + 'px';
        	item.style.paddingBottom = stili_selezione['padding-bottom'] + 'px';
        	item.style.border = stili_selezione['border'];
        	item.style.width = stili_selezione['item-width'] + 'px';
        	item.style.marginTop = stili_selezione['margin-top'] + 'px';
        	item.style.cursor = stili_selezione['cursor'];
        	item.style.color = stili_selezione['color'];
        	item.style.backgroundColor = stili_selezione['bgColor'];
			item.style.fontWeight = stili_selezione['font-weight'];
			item.style.textDecoration = stili_selezione['text-decoration'];
			
		}
		
      }
	  