$(document).ready(function () {

    //Use HoverIntent to check that the mouse if over the link for a while (interval) before loading the submenu

    var hoverconfig = {
        sensitivity: 7,
        interval: 1,
        timeout: 0,
        over: function () {
            //show its submenu  
            $(this).addClass('hovermenu');
            $(this).children('ul:first').delay(500).slideDown(100);

        },
        out: function () {
            //hide its submenu  
            $(this).children('ul:first').slideUp(100);
            $(this).removeClass('hovermenu');
        }
    }


    if ($('#subnav li').length) {
        $('#subnav li').hoverIntent(hoverconfig);

        //Still need normal hover handler to highlight current link immediately.
        $('#subnav li').hover(
	    function () {
	        //show its submenu  
	        $(this).addClass('hovermenu');
	        //$(this).children('ul:first').delay(500).slideDown(100);

	    },
	    function () {
	        //hide its submenu  
	        //$(this).children('ul:first').slideUp(100);
	        $(this).removeClass('hovermenu');
	    }
	    );

    };

});


$(window).load(function () {


	//Load the client logo
	var oClientImg = document.getElementById("customerimage");
	if (oClientImg) {
		$('#customerimagecontainer').css("background-image", "url(" + '/imagescustom/cubro/catalog/Clientlogos/' + oClientImg.alt + '.jpg' + ")");
		$('#customerimagecontainer').show();
	}
}

);



this.tooltip = function () {
	/* Credit: http://cssglobe.com*/

	/* CONFIG */
	xOffset = 10;
	yOffset = 20;
	// these 2 variable determine popup's distance from the cursor
	// you might want to adjust to get the right result		
	/* END CONFIG */
	$("a.tooltip").hover(function (e) {

		this.t = this.title;
		this.title = "";
		$("body").append("<p id='tooltip'>" + this.t + "</p>");
		$("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("slow");
	},
	function () {
		this.title = this.t;
		$("#tooltip").remove();
	});
	$("a.tooltip").mousemove(function (e) {
		$("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
	});
};



$(document).ready(function () {
	tooltip();

	if ($('.zoomableimage').length > 0) {
		$('.zoomableimage').lightBox();

		$('.zoomableimage').hover(function (e) {

			this.t = "Click the image to enlarge.";
			this.title = "";
			$("body").append("<p id='tooltip'>" + this.t + "</p>");
			$("#tooltip")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("slow");
		},
	function () {
		this.title = this.t;
		$("#tooltip").remove();
	});

	};

});


