   /**
    * @author Cedric Michaux (Lbi) :: cedric.michaux@lbigroup.be
    */
		
function initTooltip() {
	jQuery('.tooltipinfo').hide();
	jQuery('.tooltip').mouseenter(function () {
	    jQuery(this).parent().css("z-index", 60);
	    jQuery(this).parent().children('.tooltipinfo').show();
	    if (jQuery(this).hasClass("color")) {
	        var haut = ("-" + (jQuery(this).parent().children('.tooltipinfo').height() - 20));
	    }
	    else {
	        var haut = ("-" + (jQuery(this).parent().children('.tooltipinfo').height() + 10));
	    }

	    jQuery(this).parent().children('.tooltipinfo').css("top", (haut) + "px");

	    if (jQuery(this).parent().hasClass("tooltipContainer")) {
	        pWidth = jQuery(this).parent().width()
	        tWidth = jQuery(this).parent().children('.tooltipinfo').width()
	        jQuery(this).parent().children('.tooltipinfo').css("left", -((tWidth - pWidth) / 2) + "px");
	    }

	})
			jQuery('.tooltip').mouseout(function() {
				jQuery('.tooltipinfo').hide();
				jQuery(this).parent().css("z-index",50)
			})
	jQuery('.tooltip_link').mouseenter(function () {
			    jQuery(this).parent().css("z-index", 60);
			    jQuery(this).parent().children('.tooltipinfo').show();



			    if (jQuery(this).parent().hasClass("tooltipContainer")) {
			        pWidth = jQuery(this).parent().width()
			        tWidth = jQuery(this).parent().children('.tooltipinfo').width()
			        jQuery(this).parent().children('.tooltipinfo').css("left", -((tWidth - pWidth) / 2) + "px");
			    }


			    if (jQuery(this).hasClass("color")) {
			        var haut = ("-" + (jQuery(this).parent().children('.tooltipinfo').height() - 20));
			    }
			    else {
			        var haut = ("-" + (jQuery(this).parent().children('.tooltipinfo').height()));
			    }

			    jQuery(this).parent().children('.tooltipinfo').css("top", (haut) + "px");

                /* QUGY Added for Tooltips in carousel (Overflow problem) */
			    if (jQuery(this).parents('.jcarousel-container').length) {
			        addedClass = "";
			        positionTooltipTop = jQuery(this).next().offset().top;
			        positionTooltipLeft = jQuery(this).next().offset().left;
			        if (jQuery(this).parents('.jcarousel-item-1').length) { addedClass = "firstItem"; }
			        tooltipHtml = "<span class='tooltipinfo "+ addedClass +"' style='left:" + positionTooltipLeft + "px; top:" + positionTooltipTop + "px; z-index: 60'>" + jQuery(this).next().html() + "</span>";
			        jQuery(".associatedProducts").append(tooltipHtml);
			        jQuery(this).parent().children('.tooltipinfo').hide();
			    }

			})
			jQuery('.tooltip_link').mouseout(function() {
						jQuery('.tooltipinfo').hide();
						jQuery(this).parent().css("z-index",50)
					});				
}	


    var idExpr = /([-a-z0-9_]+)_container/i;

    (function(jQuery) {

        jQuery(function() {
				   
		 
			/*
            jQuery("div:not(.hide) > .jcarousel.horizontal").jcarousel({
                vertical: false,
                scroll: 1
            });

            jQuery("div:not(.hide) > .jcarousel.vertical").jcarousel({
                vertical: true,
                scroll: 1
            });
			
            jQuery(".trigger.toggleBox").each(function() {
                jQuery(this).bind("click", toggleBox)
            })
*/
            /*jQuery(".slider.range").slider({
                range: true,
                min: 0,
                max: 10000,
                values: [2000, 5000],
                slide: slideEvent
            });*/

			
			/*
            jQuery(".trigger.overlay").overlay();
*/
            jQuery(".trigger[rel=#associatedProducts]").bind("click", function() {
                setTimeout(function(){
					jQuery("#associatedProducts > .jcarousel.horizontal").jcarousel({
	                    vertical: false,
	                    scroll: 1
	                });
				}, 20);
				
            });

            if (jQuery(".zoomin").length > 0)
                jQuery(".zoomin").zoomin({
                    images: {
                        zoom: "/design/twyford/images/zoomIn/zoomin_zoomIcon.gif",
                        print: "/design/twyford/images/zoomIn/zoomin_printIcon.gif"
                    }
                });
			
			/*  QUGY fonction pour resetter l'advancedsearch */
			jQuery(".eraseSearch").click(function() {
            	jQuery("#productBrowser .content .textbox input").val('');
				jQuery(".selectbox").each(function(){
				  jQuery(this).val(jQuery('option:first', jQuery(this).parent().find('.styled')).text());
				});
				jQuery('#productBrowser .content input:checkbox').removeAttr('checked');
				jQuery("#price_1_slider_bValue_display").html("0"); jQuery("#price_1_slider_tValue_display").html("0");
				jQuery("#price_1_slider_bValue").val(0); jQuery("#price_1_slider_tValue").val(0);
				jQuery(".slider.range").slider( "destroy" );
				jQuery(".slider.range").slider({
					range: true,
					min: 0,
					max: 10000,
					values: [2000, 5000],
					slide: slideEvent
            	});
				/*jQuery(".slider.range").slider('values', [2000, 5000]);
				.slider( "option", "values", [2000, 5000] );*/
        	});
			
	
	
			// JS for Tooltip	(zoomin)	TRANSFERE DANS L'HTML (QUGY)
			/* jQuery('.zoomin-zoomicon').hover(function(){
				jQuery('<span class="tooltipinfo"><span class="top"></span><span class="content">Zoom</span><span class="bottom"></span></span>')		.appendTo('.zoomin-zoomlink');
			}, function() {
				jQuery('.zoomin-zoomlink .tooltipinfo').remove();
			});
			*/
			
			// non zoomin
			/* Affichage du tooltip - paramètres d'affichage */
			initTooltip();
			if (jQuery(".DisableNextButton").length != 0) {
                var toadjust= jQuery(".tooltip-div a").width()+30;
                jQuery(".tooltip-div").width(toadjust);
            }
        })


    })(jQuery);



