	var cur_topitem=new Array();
	    cur_topitem['img']=null;
	    cur_topitem['sub_container_id']='';
	var cur_subitem=new Array();
	    cur_subitem['img']=null;
	    cur_subitem['parent_id']='';
	var time_interval=2000;
	
	/**
	 * When the mouse enters a top item (image):
	 *
	 * - in-activate previous top item,
	 * - hide its sub if any,
	 * - activate current iop item,
	 * - show sub if any.
	 *
	 * @access public
	 * @param object Image object
	 * @param string Id of the sub conainer
	 * @param integer The left of the sub container
	 * @param integer The top of the sub container
	 * @return boolean TRUE when we activated successfully FALSE otherwise
	 */
	function entertopitem(topitem,sub_container_id){
	    if (cur_topitem['img']!=null) {
	      if (cur_topitem['img']!==topitem){	          
	          cur_topitem['img'].src=ar_inactive_images[cur_topitem['img'].id].src;
	          if (cur_topitem['sub_container_id']!='') {
	              sub_container=document.getElementById(cur_topitem['sub_container_id']);
	              if(sub_container) {
	                sub_container.style.display='none';
	                sub_container.timestamp=getTimestamp();
	              }
	              cur_topitem['img']=null;
	              cur_topitem['sub_container_id']='';

	          }
	      } else {
	          return false;
	      }
	    }
	    hideactive();
	    cur_topitem['img']=topitem;	    
	    cur_topitem['img'].src=ar_active_images[cur_topitem['img'].id].src;
	    try{
	        cur_topitem['sub_container_id']=sub_container_id;
	        sub_container=document.getElementById(sub_container_id);
	        sub_container.style.display='block';
	        sub_container.timestamp=getTimestamp();
	    } catch(e){ }
	    return true;
	} // end function

	/**
	 *
	 */
	function leavetopitem(topitem){
	    // if hovering over the sub do not hide...
	    try{
	        var el_sub=document.getElementById('sub_'+topitem.id)
	            if (el_sub.style.display=='block') return;
	    } catch(e){}
	    if (cur_topitem['img']) {	    	
	    	cur_topitem['img'].src=ar_inactive_images[cur_topitem['img'].id].src;
	    }
	    if (cur_topitem['sub_container_id']!='') {
	        sub_container=document.getElementById(cur_topitem['sub_container_id']);
	        if(sub_container) {
	            sub_container.style.display='none';
	            sub_container.timestamp=getTimestamp();
	        }
	    }
	    cur_topitem['img']=null;
	    cur_topitem['sub_container_id']='';
	    showactive();
	} // end function

	/**
	 *
	 */
	function leavesub(sub){
	    if (!cur_topitem['img']) return;
	    if (cur_topitem['sub_container_id']!='' && active_sub!=sub.id) {
	        sub_container=document.getElementById(cur_topitem['sub_container_id']);
	        if(sub_container) {
	            sub_container.style.display='none';
	            sub_container.timestamp=getTimestamp();
	        }	        
	        cur_topitem['img'].src=ar_inactive_images[cur_topitem['img'].id].src;
	        cur_topitem['img']=null;
	        cur_topitem['sub_container_id']='';
	    }
	} // end function

	/**
	 *
	 */
	function entersubitem(subitem){
	    cur_subitem['img']=subitem;	    
	    cur_subitem['img'].src=ar_active_images[cur_subitem['img'].id].src;
	    return false;
	} // end function

	/**
	 *
	 */
	function leavesubitem(subitem){
	    cur_subitem['img']=subitem;	    
	    cur_subitem['img'].src=ar_inactive_images[cur_subitem['img'].id].src;
	    cur_subitem['img']=null;
	    return false;
	} // end function

	/**
	 * Hides the active top element and sub
	 */
	function hideactive(){
		try{
		    if (active_topitem!=''){
		        el_active_topitem=document.getElementById(active_topitem);		        
		        el_active_topitem.src=ar_inactive_images[el_active_topitem.id].src;
		    }
		    if (active_sub!=''){
		        el_active_sub=document.getElementById(active_sub);
		        el_active_sub.style.display='none';
		        el_active_sub.timestamp=getTimestamp();
		    }
		    if (active_subitem!=''){
		        el_active_subitem=document.getElementById(active_subitem);		        
		        el_active_subitem.src=ar_inactive_images[el_active_subitem.id].src;
		    }
		}catch(e){}
	} // end function

	/**
	 * Shows the active top element and sub and set sub item active
	 */
	function showactive(){
		try{
		    if (active_topitem!=''){
		        cur_topitem['img']=document.getElementById(active_topitem);		        
		        cur_topitem['img'].src=ar_active_images[cur_topitem['img'].id].src;
		    }
		    if (active_sub!=''){
		    	cur_topitem['sub_container_id']=active_sub;
		        el_active_sub=document.getElementById(active_sub);
		        el_active_sub.style.display='block';
		    }
		    if (active_subitem!=''){
		        cur_subitem['img']=document.getElementById(active_subitem);		        
		        cur_subitem['img'].src=ar_active_images[cur_subitem['img'].id].src;
		        cur_subitem['parent_id']=active_topitem;
		    }
		} catch(e) {}
	} // end function

	/**
	 *
	 */
	function getTimestamp(){
	    var objDate=new Date();
	    return objDate.getTime();
	} // end function

	/**
	 *
	 */
	function hidesub(){		
	    if (cur_topitem['img']==null) {
	    	showactive();
	    	return;
	    }
	    try{	    	
	        objSub=document.getElementById(cur_topitem['sub_container_id']);
	        if (!objSub.timestamp)objSub.timestamp=getTimestamp();
	        if (objSub.timestamp>0 && ((getTimestamp()-objSub.timestamp)>time_interval) ) {	       
				var el=document.getElementById(cur_topitem['sub_container_id'])
				if (active_sub!=el.id){	        				
		            objSub.timestamp=getTimestamp();	            
		            cur_topitem['img'].src=ar_inactive_images[cur_topitem['img'].id].src;
		            el.style.display='none';
		            if (cur_subitem['img']) {	            	
		            	cur_subitem['img'].src=ar_inactive_images[cur_subitem['img'].id].src;
		            }
		            cur_topitem['img']=null;                            
		            cur_topitem['sub_container_id']='';
		            cur_subitem['img']=null;
		            cur_subitem['parent_id']='';
		            showactive();
	            }
	        }
	    }catch(e){}
	} // end function

	window.setInterval("hidesub()",100);
