/************************************************************************************
** infoBulle, crée le 19/12/2007 par d.guillard						            *****
** Cet objet permet d'afficher une infoBulle sur le mouseover d'un élément html ****/

function nv_infoBulle(Image, Position) 
{
	// On récupère l'élément image, ainsi que son target
	this.elmt_img = Image;
	this.elmt_target = document.getElementById(Image.getAttribute('target'));
	this.position = Position;
	
	var infoBulleLeft;
	var infoBulleTop;
	
	var itemCarousel_isTargeted = 0;
	var targetCarousel_isTargeted = 0;
	
	/* ***********| Permet d'afficher une infoBulle |****** */ 
	this.show = function() 
	{	
		this.elmt_target.style.display = "block";
		this.elmt_target.style.visibility = "visible";
		
		infoBulleLeft = 0;
		infoBulleTop = 0;
		this.getPosition('itemCarousel' + this.position); 
		var width = this.elmt_target.offsetWidth;
 
 
	 	if (infoBulleLeft + ((width * 2+ document.getElementById("maingutter").offsetLeft) ) > document.body.clientWidth)
	    {
	        this.elmt_target.style.left = infoBulleLeft + 'px';
	        this.elmt_target.className="infobulle infobulleBis";
	        this.elmt_target.setAttribute("class", "infobulle infobulleBis");
	    }
	    else
	    {
	        this.elmt_target.className="infobulle";
	        this.elmt_target.setAttribute("class", "infobulle");
	        
	        this.elmt_target.style.left = infoBulleLeft + width - 100 + 'px';
	    }
	}
	
	this.set_itemCarousel_isTargeted = function(ItemisTargeted)
	{
	    itemCarousel_isTargeted = ItemisTargeted;
	}
	
	this.set_targetCarousel_isTargeted = function(TargetisTargeted)
	{
	    targetCarousel_isTargeted = TargetisTargeted;
	}
	
	/* ***********| Masque l'infoBulle courante |********** */
	this.close = function()
	{
	    if (itemCarousel_isTargeted == 0 && targetCarousel_isTargeted == 0)
	    {
	        this.elmt_target.style.visibility = "hidden";
		    this.elmt_target.style.display = "none";	    
		}
	}
	
	/* ***********| Défini la position de l'infobulle a partir de son parent |********** */
	this.getPosition = function(element)
    {
        /*On récupère l'élément*/
        var e = document.getElementById(element);
            
       
        /*Tant que l'on a un élément parent*/
        while (e.offsetParent != undefined && e.offsetParent != null && e.offsetParent.getAttribute("id") != "maingutter")
        { 
            /*On ajoute la position de l'élément parent*/
             
            infoBulleLeft += e.offsetLeft + (e.clientLeft != null ? e.clientLeft : 0);
            infoBulleTop += e.offsetTop + (e.clientTop != null ? e.clientTop : 0);
            
            e = e.offsetParent;
        } 
        
     }    
     
     
      
    
} 



/************************************************************************************
** infoBulle, crée le 19/12/2007 par d.guillard						            *****
** Cet objet permet d'afficher une infoBulle sur le mouseover d'un élément html ****/

function nv_infoBulle2(Image, Position) 
{
	// On récupère l'élément image, ainsi que son target
	this.elmt_img = Image;
	this.elmt_target = document.getElementById(Image.getAttribute('target'));
	this.position = Position;
	
	var infoBulleLeft;
	var infoBulleTop;
	
	var itemCarousel_isTargeted = 0;
	var targetCarousel_isTargeted = 0;
	
	/* ***********| Permet d'afficher une infoBulle |****** */ 
	this.show_left = function() 
	{
		this.elmt_target.style.display = "block";
		this.elmt_target.style.visibility = "visible";
		
		infoBulleLeft = 0;
		infoBulleTop = 0;
		this.getPosition('itemCarousel' + this.position); 
		var width = this.elmt_target.offsetWidth;
 
	 	if (infoBulleLeft + ((width * 2+ document.getElementById("maingutter").offsetLeft) ) > document.body.clientWidth)
	    {
	       this.elmt_target.style.left = (document.getElementById('itemCarousel1').offsetLeft - width - 20) + 'px';
	       
	    }
	    else
	    {  
	       this.elmt_target.style.left = (document.getElementById('itemCarousel1').offsetLeft - width - 20) + 'px';
	       
	    }
	}
	
	this.show = function() 
	{	
		this.elmt_target.style.display = "block";
		this.elmt_target.style.visibility = "visible";
		
		infoBulleLeft = 0;
		infoBulleTop = 0;
		this.getPosition('itemCarousel' + this.position); 
		var width = this.elmt_target.offsetWidth;
 
	 	if (infoBulleLeft + ((width * 2+ document.getElementById("maingutter").offsetLeft) ) > document.body.clientWidth)
	    {
	       this.elmt_target.style.left = (document.getElementById('itemCarousel1').offsetLeft - 120) + 'px';
	       this.elmt_target.style.top = '180px';
	    }
	    else
	    {  
	       this.elmt_target.style.left = (document.getElementById('itemCarousel1').offsetLeft - 120) + 'px';
	       this.elmt_target.style.top = '180px';
	    }
	}
	
	this.set_itemCarousel_isTargeted = function(ItemisTargeted)
	{
	    itemCarousel_isTargeted = ItemisTargeted;
	}
	
	this.set_targetCarousel_isTargeted = function(TargetisTargeted)
	{
	    targetCarousel_isTargeted = TargetisTargeted;
	}
	
	/* ***********| Masque l'infoBulle courante |********** */
	this.close = function()
	{
	    if (itemCarousel_isTargeted == 0 && targetCarousel_isTargeted == 0)
	    {
	        this.elmt_target.style.visibility = "hidden";
		    this.elmt_target.style.display = "none";	    
		}
	}
	
	/* ***********| Défini la position de l'infobulle a partir de son parent |********** */
	this.getPosition = function(element)
    {
        /*On récupère l'élément*/
        var e = document.getElementById(element);
            
       
        /*Tant que l'on a un élément parent*/
        while (e.offsetParent != undefined && e.offsetParent != null && e.offsetParent.getAttribute("id") != "maingutter")
        { 
            /*On ajoute la position de l'élément parent*/
             
            infoBulleLeft += e.offsetLeft + (e.clientLeft != null ? e.clientLeft : 0);
            infoBulleTop += e.offsetTop + (e.clientTop != null ? e.clientTop : 0);
            
            e = e.offsetParent;
        } 
        
     }    
     
     
      
    
} 
