hardcore.toolbar_insertvideo = 'Code source vid&eacute;o Youtube Dailymotion';

if(Ext.PagingToolbar){
   Ext.apply(Ext.PagingToolbar.prototype, {
      beforePageText : "Page",
      afterPageText  : "sur {0}",
      firstText      : "Première page",
      prevText       : "Page précédente",
      nextText       : "Page suivante",
      lastText       : "Dernière page",
      refreshText    : "Actualiser la page",
      displayMsg     : "{1} fiche(s) sur {2}",
      emptyMsg       : 'Aucune donnée à afficher'
   });
}

if(Ext.ToolTip){
	Ext.apply(Ext.ToolTip.prototype, {
		trackMouse : true
	  	,hideDelay : 100
	  	,showDelay  : 200
	  	,mouseOffset : [0,0]
		,constrainPosition : true
		,getTargetXY : function(){
        if(this.delegate){
            this.anchorTarget = this.triggerElement;
        }
		if (this.trackMouse && this.constrainPosition){
			// hauteur et largeur de la page
			var dw = Ext.lib.Dom.getViewWidth() - 5,
				dh = Ext.lib.Dom.getViewHeight() - 5;
				
			// afficher en dehors de l'écran pour savoir la taille
			if(!this.isVisible()) this.showAt([-2000,-2000]);
  			var tipsize = this.getSize();
			var mouseOffset = this.getMouseOffset();
			var posx = this.targetXY[0]+mouseOffset[0];
			var posy = this.targetXY[1]+mouseOffset[1];
			if (posy +  tipsize.height > dh) posy = dh -  tipsize.height;
            return [posx,posy];	
		}
        if(this.anchor){
            this.targetCounter++;
            var offsets = this.getOffsets(),
                xy = (this.anchorToTarget && !this.trackMouse) ? this.el.getAlignToXY(this.anchorTarget, this.getAnchorAlign()) : this.targetXY,
                dw = Ext.lib.Dom.getViewWidth() - 5,
                dh = Ext.lib.Dom.getViewHeight() - 5,
                de = document.documentElement,
                bd = document.body,
                scrollX = (de.scrollLeft || bd.scrollLeft || 0) + 5,
                scrollY = (de.scrollTop || bd.scrollTop || 0) + 5,
                axy = [xy[0] + offsets[0], xy[1] + offsets[1]]
                sz = this.getSize();
                
            this.anchorEl.removeClass(this.anchorCls);

            if(this.targetCounter < 2){
                if(axy[0] < scrollX){
                    if(this.anchorToTarget){
                        this.defaultAlign = 'l-r';
                        if(this.mouseOffset){this.mouseOffset[0] *= -1;}
                    }
                    this.anchor = 'left';
                    return this.getTargetXY();
                }
                if(axy[0]+sz.width > dw){
                    if(this.anchorToTarget){
                        this.defaultAlign = 'r-l';
                        if(this.mouseOffset){this.mouseOffset[0] *= -1;}
                    }
                    this.anchor = 'right';
                    return this.getTargetXY();
                }
                if(axy[1] < scrollY){
                    if(this.anchorToTarget){
                        this.defaultAlign = 't-b';
                        if(this.mouseOffset){this.mouseOffset[1] *= -1;}
                    }
                    this.anchor = 'top';
                    return this.getTargetXY();
                }
                if(axy[1]+sz.height > dh){
                    if(this.anchorToTarget){
                        this.defaultAlign = 'b-t';
                        if(this.mouseOffset){this.mouseOffset[1] *= -1;}
                    }
                    this.anchor = 'bottom';
                    return this.getTargetXY();
                }
            }

            this.anchorCls = 'x-tip-anchor-'+this.getAnchorPosition();
            this.anchorEl.addClass(this.anchorCls);
            this.targetCounter = 0;
            return axy;
        }else{
            var mouseOffset = this.getMouseOffset();
            return [this.targetXY[0]+mouseOffset[0], this.targetXY[1]+mouseOffset[1]];
        }
    }
   });
}