function addArrow_L (element, width, height, top, left) {
    var arrowLength = parseInt(width) + parseInt(height);
    $(element).append('<div id="Arrow_L_Embed"></div>');
    var Arrow_L_Embed = $("#Arrow_L_Embed");
    
    Arrow_L_Embed.css({
        'position'          : 'absolute',
        'top'               : top+'px',
        'left'              : left+'px',
        'height'            : height+'px',
        'width'             : width+'px'
    });
     
    for(var i=0; i < arrowLength; i++){
        Arrow_L_Embed.append('<div id="Arrow_L-'+i+'"></div>');
        var Arrow_L = $("#Arrow_L-"+i);
        
        if( i < height) {
            if(i%2 != 0){
                l = (Math.round(i/2));
                t = ( height - 1) / 2 + (Math.round(i/2));
            } else {
                l = (i/2);
                t = ( height - 1) / 2 - (i/2);
            }
        } else {
            var l = i - height;
            var t = ( height - 1) / 2;
        }
        Arrow_L.css({
            'position'          : 'absolute',
            'background-color'  : '#ffffff',
            'height'            :'1px',
            'width'             :'1px',
            'top'               :t+'px',
            'left'              :l + 250 +'px'
        })
        Arrow_L.delay(i*10).animate({
            'top'               :t,
            'left'              :l
        },500,'easeOutExpo');
    }
}

function addArrowNav_L (element, width, top, left, func, z) {
    var arrowLength = parseInt(width);
    $(element).append('<div id="ArrowNav_L_Embed"></div>');
    var ArrowNav_L_Embed = $("#ArrowNav_L_Embed");
    
    ArrowNav_L_Embed.css({
        'position'          : 'absolute',
        'top'               : top+'px',
        'left'              : left+'px',
        'height'            : width+'px',
        'width'             :(width+1)/2+'px',
        'z-index'           :z,
        'cursor'            :'pointer'
    });
     
    for(var i=0; i < arrowLength; i++){
        ArrowNav_L_Embed.append('<div id="ArrowNav_L-'+i+'"></div>');
        var ArrowNav_L = $("#ArrowNav_L-"+i);
        
        if(i==0){
            var l = 0;
            var t = (width + 1)/2;
        } else if(i%2 != 0){
            l = Math.round(i/2);
            t = (width + 1)/2 - Math.round(i/2);
        } else if(i%2 == 0){
            l = Math.round(i/2);
            t = (width + 1)/2 + Math.round(i/2);
        }
        
        ArrowNav_L.css({
            'position'          : 'absolute',
            'background-color'  : '#ffffff',
            'height'            :'1px',
            'width'             :'1px',
            'top'               :(width + 1)/2+'px',
            'left'              :'0px'
        })
        ArrowNav_L.delay(i*10).animate({
            'top'               :t,
            'left'              :l
        },500,'easeOutExpo');
    }
    
    ArrowNav_L_Embed.click(function() {
        if(!$(this).hasClass('inactive')){
            if(typeof(func) == "function"){
                func.call();
            }
        }
    });
    
    ArrowNav_L_Embed.hover(function() {
        if(!$(this).hasClass('inactive')){
            for(var i=0; i < arrowLength; i++){
                ArrowNav_L = $("#ArrowNav_L-"+i);
                if(i>=(width-1)/2-8){
                    l = i - (width-1)/2+8;
                    t = (width+1)/2;
                
                    ArrowNav_L.delay(i*5).animate({
                        'top'               :t,
                        'left'              :l
                    },100,'easeOutExpo');
                }
            }
            ArrowNav_L_Embed.css({'cursor':'pointer'});
        } else {
            ArrowNav_L_Embed.css({'cursor':'default'});
        }
    },function () {
            for(var i=0; i < arrowLength; i++){
                ArrowNav_L = $("#ArrowNav_L-"+i);
                if(i==0){
                    var l = 0;
                    var t = (width + 1)/2;
                } else if(i%2 != 0){
                    l = Math.round(i/2);
                    t = (width + 1)/2 - Math.round(i/2);
                } else if(i%2 == 0){
                    l = Math.round(i/2);
                    t = (width + 1)/2 + Math.round(i/2);
                }
                
                ArrowNav_L.delay(i*5).animate({
                    'top'               :t,
                    'left'              :l
                },100,'easeOutExpo');
            }
    });
}

function addArrowNav_R (element, width, top, left, func, z) {
    var arrowLength = parseInt(width);
    $(element).append('<div id="ArrowNav_R_Embed"></div>');
    var ArrowNav_R_Embed = $("#ArrowNav_R_Embed");
    
    ArrowNav_R_Embed.css({
        'position'          : 'absolute',
        'top'               : top+'px',
        'left'              : left+'px',
        'height'            : width+'px',
        'width'             : (width+1)/2+'px',
        'z-index'           : z,
        'cursor'            :'pointer'
    });
     
    for(var i=0; i < arrowLength; i++){
        ArrowNav_R_Embed.append('<div id="ArrowNav_R-'+i+'"></div>');
        var ArrowNav_R = $("#ArrowNav_R-"+i);

        if(i==0){
            var l = (width + 1)/2;
            var t = (width + 1)/2;
        } else if(i%2 != 0){
            l = (width + 1)/2 - Math.round(i/2);
            t = (width + 1)/2 - Math.round(i/2);
        } else if(i%2 == 0){
            l = (width + 1)/2 - Math.round(i/2);
            t = (width + 1)/2 + Math.round(i/2);
        }
        
        ArrowNav_R.css({
            'position'          : 'absolute',
            'background-color'  : '#ffffff',
            'height'            :'1px',
            'width'             :'1px',
            'top'               : (width + 1)/2+'px',
            'left'              : (width + 1)/2+'px'
        })
        
        ArrowNav_R.delay(i*10).animate({
            'top'               :t,
            'left'              :l
        },500,'easeOutExpo');
    }
    
    ArrowNav_R_Embed.click(function() {
        if(!$(this).hasClass('inactive')){
            if(typeof(func) == "function"){
                func.call();
            }
        }
    });
    
    ArrowNav_R_Embed.hover(function() {
        if(!$(this).hasClass('inactive')){
            for(var i=0; i < arrowLength; i++){
                ArrowNav_R = $("#ArrowNav_R-"+i);
                if(i>=(width-1)/2-8){
                    l = (width-1)/2-i+8;
                    t = (width+1)/2;

                    ArrowNav_R.delay(i*5).animate({
                        'top'               :t,
                        'left'              :l
                    },100,'easeOutExpo');
                }
            }
            ArrowNav_R_Embed.css({'cursor':'pointer'});
        } else {
            ArrowNav_R_Embed.css({'cursor':'default'});
        }
    },function () {
            for(var i=0; i < arrowLength; i++){
                ArrowNav_R = $("#ArrowNav_R-"+i);
                if(i==0){
                    var l = (width + 1)/2;
                    var t = (width + 1)/2;
                } else if(i%2 != 0){
                    l = (width + 1)/2 - Math.round(i/2);
                    t = (width + 1)/2 - Math.round(i/2);
                } else if(i%2 == 0){
                    l = (width + 1)/2 - Math.round(i/2);
                    t = (width + 1)/2 + Math.round(i/2);
                }

                ArrowNav_R.delay(i*5).animate({
                    'top'               :t,
                    'left'              :l
                },100,'easeOutExpo');
            }
    });
}

function addArrow_R (element, id, width, height, top, left) {
    var arrowLength = parseInt(width) + parseInt(height);
    $(element).append('<div id="'+id+'"></div>');
    var Arrow_R_Embed = $("#"+id+"");
    
    Arrow_R_Embed.css({
        'position'          : 'absolute',
        'top'               : top+'px',
        'left'              : left+'px',
        'height'            : height+'px',
        'width'             : width+'px'
    });
     
    for(var i=0; i < arrowLength; i++){
        Arrow_R_Embed.append('<div id="'+id+'-Arrow_R-'+i+'"></div>');
        var Arrow_R = $("#"+id+"-Arrow_R-"+i);
        
        if( i < height) {
            if(i%2 != 0){
                l = width - (Math.round(i/2));
                t = ( height - 1) / 2 + (Math.round(i/2));
            } else {
                l = width - (i/2);
                t = ( height - 1) / 2 - (i/2);
            }
        } else {
            var l = width - i + height;
            var t = ( height - 1) / 2;
        }
        Arrow_R.css({
            'position'          : 'absolute',
            'background-color'  : '#ffffff',
            'height'            :'1px',
            'width'             :'1px',
            'top'               : t+'px',
            'left'              : l - 250 +'px'
        })
        Arrow_R.delay(i*10).animate({
            'top'               :t,
            'left'              :l
        },500,'easeOutExpo');
    }
}

function removeArrow_R (element, id, width, height, top, left) {
    var arrowLength = parseInt(width) + parseInt(height);

     
    for(var i=0; i < arrowLength; i++){
        var Arrow_R = $("#"+id+"-Arrow_R-"+i);
        
        if( i < height) {
            if(i%2 != 0){
                l = width - (Math.round(i/2));
                t = ( height - 1) / 2 + (Math.round(i/2));
            } else {
                l = width - (i/2);
                t = ( height - 1) / 2 - (i/2);
            }
        } else {
            var l = width - i + height;
            var t = ( height - 1) / 2;
        }
        
        Arrow_R.delay(i*10).animate({
            'top'               :t,
            'left'              :l - 250 +'px',
            'opacity'           :0
        },500,'easeOutExpo', function (){
            if(i==arrowLength){
                $(this).parent().remove();
            }
        });
    }
}


/* Close ------------------------------------------------------------------*/
function addClose (element, size, top, left, func) {
    $(element).append('<div id="Close_Embed"></div>');
    var Close_Embed = $('#Close_Embed');
    var cl = '0';
    var ct = '0';
    var l  = '0';
    var t  = '0';
	
    Close_Embed.css({
        'width':((size-1)/2)+'px',
        'height':((size-1)/2)+'px',
        'position':'absolute',
        'z-index':'60',
        'top' : top + 'px',
        'left': left + 'px'
    });
	
    for(var i=0; i<size; i++) {
        Close_Embed.append('<div class="pixel" id="pixelClose-'+i+'"></div>');
        var pixelClose = $('#pixelClose-'+i);
        
        if(i == 0 ){
            cl = (size-1)/4;
            ct = (size-1)/4;
        }
		
        if ( i % 4 == 0 && i > 0 ) {
            cl = ((size-1)/4 + i/4);
            ct = ((size-1)/4 + i/4);
        }
		
        if ( (i-1) % 4 == 0 && i > 0 ) {
            cl = ((size-1)/4 - (i-1)/4)-1;
            ct = ((size-1)/4 - (i-1)/4)-1;
        }
		
        if ( (i-2) % 4 == 0 && i > 0 ) {
            cl = ((size-1)/4 - (i-2)/4)-1;
            ct = ((size-1)/4 + (i-2)/4)+1;
        }
		
        if ( (i-3) % 4 == 0 && i > 0 ) {
            cl = ((size-1)/4 + (i-3)/4)+1;
            ct = ((size-1)/4 - (i-3)/4)-1;
        }
		
		
        l = (size-1)/4 +'px';
        t = (size-1)/4 + 60 +'px';
		
        pixelClose.css({
            'width':'1px',
            'height':'1px',
            'background':'white',
            'position':'absolute',
            'left':l,
            'top':t,
            'opacity':0
        });
        pixelClose.delay(3*i).animate({
            top:ct, 
            left: cl, 
            opacity:1
        }, 130+i, "easeOutBack");
	
    }
	
    Close_Embed.click(function() {
        if(typeof(func) == "function"){
//            event.preventDefault();
            func.call();
            
            for(var i=0; i<size; i++) {
                pixelClose = $('#pixelClose-'+i);
                if(i == 0 ){
                    cl = (size-1)/4;
                    ct = (size-1)/4;
                }
		
                if ( i % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 + i/4 + 5*i);
                    ct = ((size-1)/4 + i/4 + 5*i);
                }
		
                if ( (i-1) % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 - (i-1)/4) - 1 - 5*i;
                    ct = ((size-1)/4 - (i-1)/4) - 1 - 5*i;
                }
		
                if ( (i-2) % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 - (i-2)/4) - 1 - 5*i;
                    ct = ((size-1)/4 + (i-2)/4) + 1 + 5*i;
                }
		
                if ( (i-3) % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 + (i-3)/4) + 1 + 5*i;
                    ct = ((size-1)/4 - (i-3)/4) - 1 - 5*i;
                }
		
		
                pixelClose.delay(3*i).animate({
                    top:ct, 
                    left: cl, 
                    opacity:1
                }, 130+i, "easeOutBack");
	
            }
        }
        $(this).delay(80).animate({
            'opacity':0
        },200, "easeOutSine", function (){
            $(this).remove();    
        });
    });
	
	
    Close_Embed.hover(
        function () {
            $(this).css({
                'cursor':'pointer'
            });
            for(var i=0; i < size; i++) {
                pixelClose = $('#pixelClose-'+i);
                if(i != 0 ){
                    ct = $('#pixelClose-'+[i-1]).position().top;	
                    cl = $('#pixelClose-'+[i-1]).position().left;
                }
                pixelClose.delay(2*i).animate({
                    top:ct, 
                    left: cl, 
                    opacity:1
                }, 80 + i, "easeInOutSine");
	
            }
        }, 
        function () {
            var cl     = 0;
            var ct     = 0;
            for(var i=0; i<size; i++) {
                pixelClose = $('#pixelClose-'+i);
                if(i == 0 ){
                    cl = (size-1)/4;
                    ct = (size-1)/4;
                }
		
                if ( i % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 + i/4);
                    ct = ((size-1)/4 + i/4);
                }
		
                if ( (i-1) % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 - (i-1)/4)-1;
                    ct = ((size-1)/4 - (i-1)/4)-1;
                }
		
                if ( (i-2) % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 - (i-2)/4)-1;
                    ct = ((size-1)/4 + (i-2)/4)+1;
                }
		
                if ( (i-3) % 4 == 0 && i > 0 ) {
                    cl = ((size-1)/4 + (i-3)/4)+1;
                    ct = ((size-1)/4 - (i-3)/4)-1;
                }
		
                pixelClose.delay(2*i).animate({
                    top:ct, 
                    left: cl, 
                    opacity:1
                }, 80+i, "easeOutQuint");
	
            }
        }
        );
}

/* AddListRoll*/
function addListRoll (element, texte, items, height, width, top, left, color, color2, color3, color4, color5, z){
    var padding = 6;
    texte = texte.split(' ');
    var texteTmp = '';
    for(var t=0;t<texte.length;t++){
        texteTmp = texteTmp + texte[t];
    }
    texte = texteTmp;
    items2 = null;
    it = null;
    
    $(element).append('<div id="embedListRoll-'+texte+'" class="requiredList">SELECTIONNER</div><input type="text" style="opacity:0; z-index:0;" id="inputEmbedRoll-'+texte+'"></input>');
    var embedListRoll = $("#embedListRoll-"+texte);
    var embedInput    = $("#inputEmbedRoll-"+texte)
    
    embedListRoll.css ({
        'height'        : height-padding+'px',
        'width'         : width-padding+'px',
        'z-index'       : z,
        'position'      : 'absolute',
        'font-family'   : 'GothamMedium',
        'font-size'     : '9px',
        'top'           : top+'px',
        'background'    : color3,
        'left'          : left+'px',
        'cursor'        : 'pointer',    
        'border'        :'1px solid '+color,
        'padding-top'   : padding,
        'padding-left'  : padding,
        'color'         : color2
    });
    
    for(var i=0; i<items.length; i++ ){
        $(element).append('<div id="listRoll-'+i+'-'+texte+'" data-id="'+i+'" data-texte="'+texte+'" class="listRoll-'+texte+'">'+items[i]+'</div>');
        var rollI = $('#listRoll-'+i+'-'+texte);
        rollI.css ({
            'height'        : height-padding+'px',
            'width'         : width-padding+'px',
            'z-index'       : 0,
            'position'      : 'absolute',
            'font-family'   : 'GothamMedium',
            'font-size'     : '9px',
            'color'         : color2,
            'background'    : color3,
            'top'           : top+'px',
            'opacity'       : '1',
            'left'          : left+'px',
            'cursor'        : 'pointer',
            'border'        :'1px solid '+color,
            'padding-top'   : padding,
            'padding-left'  : padding
        });
    }
    
    embedListRoll.hover(
        function () {
            cancelWaitForAction('repli()');
            it = $(this).parent().attr('data-id');
            items2 = formProject[it][3];
            texte2 = texte;
        }, 
        function  () {
            waitForAction("repli()",500);
            $(element).css({
                'z-index'   :z
            })
        }
        );
            
    embedListRoll.click(
        function () {
            for(var i=0; i<items.length; i++ ){
                var rollI = $('#listRoll-'+i+'-'+texte)
                rollI.animate({
                    'top'       :top+((height+1)*(i+1))+'px',
                    'opacity'   :1
                }, 250,'easeOutExpo');
                rollI.css({
                    'z-index'   :500+i
                })
            }
            });
            
    embedInput.focus(
        function () {
            for(var i=0; i<items.length; i++ ){
                var rollI = $('#listRoll-'+i+'-'+texte)
                rollI.animate({
                    'top'       :top+((height+1)*(i+1))+'px',
                    'opacity'   :1
                }, 250,'easeOutExpo');
                rollI.css({
                    'z-index'   :500+i
                })
            }
        });
            
    embedInput.focusout(
        function () {
            it = $(this).parent().attr('data-id');
            items2 = formProject[it][3];
            texte2 = texte;
            waitForAction("repli()",50);
        });

    
    $('.listRoll-'+texte).hover(
        function () {
            it = $(this).parent().attr('data-id');
            items2 = formProject[it][3];
            texte2 = texte;
            cancelWaitForAction('repli()');
            
            $(this).animate({
                'background-color'  :color5,
                'color'             :color4
            }, 50,'easeOutSine');
        }, 
        function () {
            waitForAction("repli()",500);
            $(this).animate({
                'background-color'  :color3,
                'color'             :color2
            }, 80,'easeOutQuart');
        }
        );
            
    $('.listRoll-'+texte).click(
        function () {
            embedListRoll.removeClass('emptyList');
            
            embedListRoll.css({
                'color'          :color2,
                'border-color'   :color
            });
            
            
            
            waitForAction("repli()",50);
            $("#embedListRoll-"+texte).empty();
            $("#embedListRoll-"+texte).append($(this).text());
            it = $(this).parent().attr('data-id');
            items2 = formProject[it][3];
            texte2 = texte;
            var selectedId      = $(this).attr('data-id');
            var selectedValue   = items2[selectedId];
            
            $("#embedListRoll-"+texte).attr('data-id',selectedId)  
            $(this).addClass('selected')
            
            
            $(this).animate({
                'background-color'  :color2,
                'color'             :color
            }, 50,'easeOutSine');
        });
    
    repli = function () {
        items2 = formProject[it][3];
        for(var i=0; i< items2.length; i++ ){
            var rollI = $(' #listRoll-'+i+'-'+texte2);
            rollI.animate({
                'top':top+'px',
                'opacity':0
            }, 250,'easeOutExpo',function () {
                $(this).css({
                    'z-index':'0'
                });
            });
        }
    }

    
}


/* AddLink ------------------------------------------------------------------*/
function addLink (element, texte, url, height, width, top, left, color, hoverColor, arrowW, arrowH, z, opacity, center, fill) {
    var baseTime     = 36;
    var baseTimeRatio = width / height;
    var marginL = 8;
    
    
    $(element).append('<div id="embedLink-'+texte+'"></div>');
    var embedLink = $("#embedLink-"+texte);
    
    embedLink.css ({
        'height'        : height+'px',
        'width'         : width+'px',
        'z-index'       : z,
        'position'      :'absolute',
        'font-family'   :'Standard0758',
        'font-size'     :'8px',
        'top'           : top+'px',
        'left'          : left+'px',
        'cursor'        :'pointer'
    });
    
    // Borders
    embedLink.append('<div id="embedLinkBTop-'+texte+'" class="embedLinkBorder"></div>')
    var embedLinkBTop = $("#embedLinkBTop-"+texte);
    
    embedLink.append('<div id="embedLinkBRight-'+texte+'" class="embedLinkBorder"></div>')
    var embedLinkBRight = $("#embedLinkBRight-"+texte);
    
    embedLink.append('<div id="embedLinkBBottom-'+texte+'" class="embedLinkBorder"></div>')
    var embedLinkBBottom = $("#embedLinkBBottom-"+texte);
    
    embedLink.append('<div id="embedLinkBLeft-'+texte+'" class="embedLinkBorder"></div>')
    var embedLinkBLeft = $("#embedLinkBLeft-"+texte);
    
    
    // Borders Hover
    embedLink.append('<div id="embedLinkHoverBTop-'+texte+'" class="embedLinkHoverBorder"></div>')
    var embedLinkHoverBTop = $("#embedLinkHoverBTop-"+texte);
    
    embedLink.append('<div id="embedLinkHoverBRight-'+texte+'" class="embedLinkHoverBorder"></div>')
    var embedLinkHoverBRight = $("#embedLinkHoverBRight-"+texte);
    
    embedLink.append('<div id="embedLinkHoverBBottom-'+texte+'" class="embedLinkHoverBorder"></div>')
    var embedLinkHoverBBottom = $("#embedLinkHoverBBottom-"+texte);
    
    embedLink.append('<div id="embedLinkHoverBLeft-'+texte+'" class="embedLinkHoverBorder"></div>')
    var embedLinkHoverBLeft = $("#embedLinkHoverBLeft-"+texte);
    
    // Texte
    if(url != null && typeof(url) != "function"){
        embedLink.prepend('<a href="'+url+'" target="_blank">&nbsp;</a>');
        $("#embedLink-"+texte+" a").css({
            'display'   :'block',
            'position'  :'absolute',
            'width'     :width+'px',
            'height'    :height+'px',
            'z-index'   :parseInt(z)-1
        });
    }
    var texteToDisplay = texte.split('_');
    var myText = '';
    for(var i = 0; i<texteToDisplay.length; i++){
        myText = myText + texteToDisplay[i]+' ';
    }
    embedLink.append('<div id="embedLinkTexte-'+texte+'">'+myText.toUpperCase()+'</div>');
    
    var embedLinkTexte = $("#embedLinkTexte-"+texte);
    
    var testWidth = function () {

        var tW = embedLinkTexte.width();
        if(!center){
            embedLinkTexte.css({
                'left'       : marginL*1.5
            });
        } else {
            embedLinkTexte.css({
                'left'       : ( width - tW ) / 2
            });
        }
    }
    
    setTimeout(testWidth, 10);
    
    if(!center){    
        embedLinkTexte.css({
            'color'      : color,
            'margin-top' : height/2 - 7+'px',
            'position'   :'absolute',
            'z-index'    : z+1,
            'text-align' :'center'
        });
    } else {
        embedLinkTexte.css({
            'color'      : color,
            'margin-top' : height/2 - 7+'px',
            'position'   :'absolute',
            'z-index'    : z+1,
            'text-align' :'center'
        });
    }

    if(fill){
        embedLink.append('<div id="embedLinkTexteBg-'+texte+'"></div>');
        var texteBg = $("#embedLinkTexteBg-"+texte);
        texteBg.css({
            'background': color,
            'width'     :'100%',
            'height'    :'100%',
            'position'  :'absolute'
        });
        embedLinkTexte.css({
            'color'     : hoverColor
        });
    }
    
    // Borders Down
    $("#embedLink-"+texte +" .embedLinkBorder").css({
        'position'        : 'absolute',
        'background-color': color,
        'opacity'         : opacity,
        'z-index'         : parseInt(z) + 1
    });
    embedLinkBTop.css({
        'height'    : '1px',
        'width'     : width+'px',
        'top'       : '0px',
        'left'      : '1px'
    });
    embedLinkBRight.css({
        'height'    : height-1+'px',
        'width'     : '1px',
        'top'       : '1px',
        'left'      : width+'px'
    });
    embedLinkBBottom.css({
        'height'    : '1px',
        'width'     : width-1+'px',
        'top'       : height-1+'px',
        'left'      : '1px'
    });
    embedLinkBLeft.css({
        'height'    : height+'px',
        'width'     : '1px',
        'top'       : '0px',
        'left'      : '0px'
    });
    
    // Borders Hover
    $("#embedLink-"+texte +" .embedLinkHoverBorder").css({
        'position'  : 'absolute',
        'background-color': hoverColor,
        'z-index'   : parseInt(z) + 2
    });
    embedLinkHoverBTop.css({
        'height'    : '1px',
        'width'     : '0px',
        'top'       : '0px',
        'left'      : '1px'
    });
    embedLinkHoverBRight.css({
        'height'    : '0px',
        'width'     : '1px',
        'top'       : '1px',
        'left'      : width+'px'
    });
    embedLinkHoverBBottom.css({
        'height'    : '1px',
        'width'     : '0px',
        'top'       : height-1+'px',
        'left'      : '1px'
    });
    embedLinkHoverBLeft.css({
        'height'    : '0px',
        'width'     : '1px',
        'top'       : '0px',
        'left'      : '0px'
    });
    
    embedLink.hover(
        function () {
            embedLinkHoverBTop.animate({
                'width':width+'px'
            }, baseTime * baseTimeRatio,'easeOutSine');
            embedLinkHoverBRight.delay(baseTime * baseTimeRatio).animate({
                'height':height-1+'px'
            }, baseTime,'easeOutSine');
            embedLinkHoverBBottom.delay(baseTime).animate({
                'width':width+'px'
            }, baseTime * baseTimeRatio,'easeOutSine');
            embedLinkHoverBLeft.animate({
                'height':height+'px'
            }, baseTime,'easeOutSine');

            if(fill){
                texteBg.animate({
                    'background-color':hoverColor
                },200,'easeOutQuint');
                embedLinkTexte.animate({
                    'color': color
                },baseTime * baseTimeRatio,'easeOutSine');
            } else {
                embedLinkTexte.animate({
                    'color': hoverColor
                },baseTime * baseTimeRatio,'easeOutSine');
            }
            $("#embedLink-"+texte + " #Arrow_R_Embed").children().css('background-color', hoverColor);
            
            if(arrowW != 0 ){
                addArrow_R ("#embedLink-"+texte, 'arrow'+texte, arrowW, arrowH, parseInt(height/2) - Math.round(arrowH/2) , marginL);
                embedLinkTexte.animate({
                'margin-left': parseInt(arrowW) + marginL*2
            },baseTime * baseTimeRatio,'easeOutSine')
            }

        }, 
        function () {
            embedLinkHoverBTop.animate({
                'width':'0px'
            }, baseTime * baseTimeRatio,'easeOutSine');
            embedLinkHoverBRight.animate({
                'height':'0px'
            }, baseTime,'easeOutSine');
            embedLinkHoverBBottom.delay(baseTime).animate({
                'width':'0px'
            }, baseTime * baseTimeRatio,'easeOutSine');
            embedLinkHoverBLeft.delay(baseTime * baseTimeRatio).animate({
                'height':'0px'
            }, baseTime,'easeOutSine');
            if(fill){
                texteBg.animate({
                    'background-color':color
                },200,'easeOutQuint');
                embedLinkTexte.animate({
                    'color': hoverColor
                },baseTime * baseTimeRatio,'easeOutSine');
            } else {
                embedLinkTexte.animate({
                    'color': color
                },baseTime * baseTimeRatio,'easeOutSine');
            }
            $("#embedLink-"+texte + " #Arrow_R_Embed").children().css('background-color', color);
            if(arrowW != 0 ){
                removeArrow_R("#embedLink-"+texte, 'arrow'+texte, arrowW, arrowH, parseInt(height/2) - Math.round(arrowH/2) , marginL);
                embedLinkTexte.animate({
                'margin-left': marginL*2
            },baseTime * baseTimeRatio,'easeOutSine')
            }
        });
        
    embedLink.click(function () {
        if(typeof(url) == "function"){
            url.call();
        }
    });
}


function removeLink (element, texte, width, height) {
    var baseTime     = 36;
    var baseTimeRatio = width / height;
    var embedLinkBTop = $("#embedLinkBTop-"+texte);
    var embedLinkBRight = $("#embedLinkBRight-"+texte);
    var embedLinkBBottom = $("#embedLinkBBottom-"+texte);
    var embedLinkBLeft = $("#embedLinkBLeft-"+texte);
    var embedLinkTexte = $("#embedLinkTexte-"+texte);
    
    embedLinkBTop.animate({
        'width':'0px'
    }, baseTime * baseTimeRatio,'easeOutSine');
    embedLinkBRight.animate({
        'height':'0px'
    }, baseTime,'easeOutSine');
    embedLinkBBottom.delay(baseTime).animate({
        'width':'0px'
    }, baseTime * baseTimeRatio,'easeOutSine');
    embedLinkBLeft.delay(baseTime * baseTimeRatio).animate({
        'height':'0px'
    }, baseTime,'easeOutSine');
    embedLinkTexte.animate({
        'opacity': 0
    }, baseTime * baseTimeRatio,'easeOutSine');
    
    
    var embedLink = $("#embedLink-"+texte);
    embedLink.remove();
}

/* addArrow_NavB -----------------------------------------------------------------*/
function addArrow_NavB (element, height, width, top, left, func, z) {
    var arrowNavLength = parseInt(width) + parseInt(height);
    $(element).append('<div id="addArrow_NavB_Embed"></div>');
    var addArrow_NavB_Embed = $('#addArrow_NavB_Embed');
    
    addArrow_NavB_Embed.css ({
        'position'          : 'absolute',
        'top'               : top+'px',
        'left'              : left+'px',
        'height'            : height+'px',
        'width'             : width+height+'px',
        'z-index'           :z
    });
	
    for(var i=0;i<arrowNavLength; i++) {
        $('#addArrow_NavB_Embed').append('<div class="pixel" id="arrowNavB-'+i+'"></div>');
        var arrowNavB = $("#arrowNavB-"+i);
        
        if(i%2 != 0){
            t = height-1 - (Math.round(i/2));
            l = ((width + height - 1)/2)  + (Math.round(i/2));
        } else {
            t = height-1 - (i/2);
            l = ((width + height - 1)/2)  - (i/2);
        }

        arrowNavB.css({
            'position'          : 'absolute',
            'background-color'  : '#ffffff',
            'height'            :'1px',
            'width'             :'1px',
            'top'               :t+'px',
            'left'              :l+'px'
        })
        arrowNavB.delay(i*2).animate({
            'top'               :t,
            'left'              :l
        },120,'easeOutExpo');	
    }
    
    addArrow_NavB_Embed.click(function() {
        if(typeof(func) == "function"){
//            if(!$(this).hasClass('inactive')){
                //event.preventDefault();
                func.call();
//            }
        }
    });
	
	
    addArrow_NavB_Embed.hover(
        function () {
            if(!$(this).hasClass('inactive')){
                $(this).css({
                    'cursor':'pointer'
                });
                for(var i=0;i<arrowNavLength; i++) {
                    arrowNavB = $("#arrowNavB-"+i);
                
                    if( i < width) {
                        if(i%2 != 0){
                            t = height-1 - (Math.round(i/2));
                            l = ((width + height - 1)/2)  + (Math.round(i/2));
                        } else {
                            t = height-1 - (i/2);
                            l = ((width + height - 1)/2)  - (i/2);
                        }
                    } else {
                        var t = i - width;
                        var l = ((width + height - 1)/2);
                    }

                    arrowNavB.delay(i*2).animate({
                        'top'               :t + 12,
                        'left'              :l
                    },120,'easeOutExpo');	
                }
            } else {
                $(this).css({
                    'cursor':'default'
                });
            }
        }, 
        function () {
            for(var i=0;i<arrowNavLength; i++) {
                arrowNavB = $("#arrowNavB-"+i);
                
                if(i%2 != 0){
                    t = height-1 - (Math.round(i/2));
                    l = ((width + height - 1)/2)  + (Math.round(i/2));
                } else {
                    t = height-1 - (i/2);
                    l = ((width + height - 1)/2)  - (i/2);
                }

                arrowNavB.delay(i*2).animate({
                    'top'               :t,
                    'left'              :l
                },120,'easeOutExpo');	
            }
    
        }
        );
}

/* addArrow_NavT -----------------------------------------------------------------*/
function addArrow_NavT (element, height, width, top, left, func,z) {
    var arrowNavLength = parseInt(width) + parseInt(height);
    $(element).append('<div id="addArrow_NavT_Embed"></div>');
    var addArrow_NavT_Embed = $('#addArrow_NavT_Embed');
    
    addArrow_NavT_Embed.css ({
        'position'          : 'absolute',
        'top'               : top+'px',
        'left'              : left+'px',
        'height'            : height+'px',
        'width'             : width+height+'px',
        'z-index'           :z
    });
	
    for(var i=0;i<arrowNavLength; i++) {
        addArrow_NavT_Embed.append('<div class="pixel" id="arrowNavT-'+i+'"></div>');
        var arrowNavT = $("#arrowNavT-"+i);

        if(i%2 != 0){
            t = (Math.round(i/2) + (width - 2));
            l = ((width + height - 1)/2)  + (Math.round(i/2));
        } else {
            t = (i/2) + (width - 2);
            l = ((width + height - 1)/2)  - (i/2);
        }

        arrowNavT.css({
            'position'          : 'absolute',
            'background-color'  : '#ffffff',
            'height'            :'1px',
            'width'             :'1px',
            'top'               :t+'px',
            'left'              :l+'px'
        })
        arrowNavT.delay(i*2).animate({
            'top'               :t,
            'left'              :l
        },120,'easeOutExpo');	
    }
    
    addArrow_NavT_Embed.click(function() {
        if(typeof(func) == "function"){
            func.call();
        }
    });
	
	
    addArrow_NavT_Embed.hover(
        function () {
            if(!$(this).hasClass('inactive')){
                $(this).css({
                    'cursor':'pointer'
                });
                for(var i=0;i<arrowNavLength; i++) {
                    arrowNavT = $("#arrowNavT-"+i);
                
                    if( i < width) {
                        if(i%2 != 0){
                            t = (Math.round(i/2) + (width - 2));
                            l = ((width + height - 1)/2)  + (Math.round(i/2));
                        } else {
                            t = (i/2) + (width - 2);
                            l = ((width + height - 1)/2)  - (i/2);
                        }
                    } else {
                        var t = i - width + (width - 2);
                        var l = ((width + height - 1)/2);
                    }

                    arrowNavT.delay(i*2).animate({
                        'top'               :t - 12,
                        'left'              :l
                    },120,'easeOutExpo');	
                }
            } else {
                $(this).css({
                    'cursor':'default'
                });
            }
            
        }, 
        function () {
            for(var i=0;i<arrowNavLength; i++) {
                arrowNavT = $("#arrowNavT-"+i);
                
                if(i%2 != 0){
                    t = (Math.round(i/2) + (width - 2));
                    l = ((width + height - 1)/2)  + (Math.round(i/2));
                } else {
                    t = (i/2) + (width - 2);
                    l = ((width + height - 1)/2)  - (i/2);
                }

                arrowNavT.delay(i*2).animate({
                    'top'               :t,
                    'left'              :l
                },120,'easeOutExpo');	
            }
    
        }
        );
}
