this.imagePreview = function(){
	/* CONFIG */

		xOffset = 10;
		yOffset = 30;

		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result

	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";
		var slika = $(this).attr('rel');
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ slika +"' alt='Image preview' />"+ c +"</p>");
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#preview").remove();
    });
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};

$(function() {
	Cufon.replace('h1, #nav>li>a, #shops>p>span, .footer-menu, h2, #intro-nav', {hover: true});

	$('#nav li').reverseOrder();
	$('#nav li ul li').reverseOrder();

	$("#toggle").toggle(function() {
		$("#head").slideUp('slow');
	}, function() {
		$("#head").slideDown('slow');
	});

	// image tooltips
	imagePreview();

	// accordion
	$('#nav-left ul').hide();
	//$('#nav-left ul:first').show();
	$('#nav-left li a').click(function() {
		var checkElement = $(this).next();
		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			return false;
		}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$('#nav-left ul:visible').slideUp('normal');
			checkElement.slideDown('normal');
			return false;
		}
	});
    $(".added, #cart-info").css('top', '-500px');
    $("#empty_shopping_cart_message").css('display', 'none');

    // show/hide webshop step description
    $("#cart-step div").hover(function(){
        $(this).find("span").show();
    }, function(){
        $(this).find("span").hide();
    });
});

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);