// Search form
var ffSuggest = new FFSuggest();
$(document).ready(function() {
	if ($("form[name=searchform]").size() > 0) {
		var searchURL = "ffSuggest.action";
		var formname = "searchform";
		var queryParamName = "query";
		var divLayername = "suggestLayer";
		var instanceName = "ffSuggest";
		var debugMode = false;
		var showImages = true;
		ffSuggest.init(searchURL, formname, queryParamName, divLayername, instanceName, debugMode, showImages);
		document.onmousedown = ffSuggest.hideLayerOutsideCall;
	}
});

// Main navigation menu
var IE6 = navigator.appVersion.indexOf("MSIE 6")!=-1;
$(document).ready(function() {
	$("#nav > li").each(function() {
		$(this).find(".sub1").html("<span>&nbsp;</span>");
		$(this).find(".sub1 > span").eq(0).css("left",
			Math.round(this.offsetLeft+this.offsetWidth/2-10)+"px");
	});

	if (IE6) {
		$("#nav > li").hover(function() {
			$(this).children("ul").show();
		}, function() {
			$(this).children("ul").hide();
		});
		$(".langSearch > li").hover(function() {
			$(this).children(".navlayer").show();
			$(this).children(".servicelayer").show();
		}, function() {
			$(this).children(".navlayer").hide();
			$(this).children(".servicelayer").hide();
		});
	}
});

// Shopping cart
$(document).ready(function() {
	$(".cartBot2 > span").removeAttr("title");
	$(".cartBot2").click(function() {
		if ($(this).parent().find(".table .content .tr").length >= 5) {
			$(this).parent().find(".table .content").height("248px");
		}
		$(this).removeClass("cartBot2").addClass("cartBot3");
		$(this).parent().find("#s_cart").slideDown("fast");
		$(this).parent().find("a.next").hide();
	});
	$(".shoppingCart:has(.cartBot2)").hover(function() {
	}, function() {
		$(this).find("#s_cart").slideUp("fast", function() {
			$(this).parent().find(".cartBot3").removeClass("cartBot3").addClass("cartBot2");
			$(this).parent().find("a.next").show();
		});
	});
});

