hs.graphicsDir = '/js/highslide/graphics/'; // used to be  'js/highslide/graphics/'
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.fadeInOut = true;
//hs.dimmingOpacity = 0.75;

// Add the controlbar
if (hs.addSlideshow) hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 3000,
	repeat: false,
	useControls: true,
	fixedControls: false,
	overlayOptions: {
		opacity: 1,
		position: 'top right',
		hideOnMouseOut: false
	}
});

function hintHide(id) {
	$("#"+id+"m").css("visibility", "hidden");
}

$(document).ready(function() {
	var hintShower = $("#mainMenu a");
	var hint = $("#mainImage .list");
	hint.css("visibility", "hidden");
	hintShower.hover(function(){
		hint.css("visibility", "hidden");
		var current_id = $(this).attr("id");
		$("#"+current_id+"m").css("visibility", "visible");
	}, function() {
		var current_id = $(this).attr("id");
		t = setTimeout("hintHide('"+current_id+"')", 200);
	});

	hint.hover(function() {
		clearTimeout(t);
	}, function() {
		$(this).css("visibility", "hidden");
	});
	
	var prodMenu = $("#productsMenu");
	prodMenu.find(".middle").children().find("ul").css("display","none");
	var selectedLink = prodMenu.find(".selected");
	var firstParentLI = selectedLink.parent().parent().parent("li");
	var firstParentLink = firstParentLI.children("a");
	var secondParentLI = firstParentLI.parent().parent("li");
	var secondParentLink = secondParentLI.children("a");
	selectedLink.parent().addClass("selectedLI").addClass("selectedBold");
	firstParentLI.addClass("selectedLI");
	firstParentLink.addClass("selected");
	secondParentLI.addClass("selectedLI");
	secondParentLink.addClass("selected");	
	var openedList = selectedLink.parents("ul");
	openedList.show();
	
	$(".menuShower").click(function() {
		var childrenList = $(this).next();
		var otherLists = $(this).parent().siblings().find("ul");
		if(childrenList.is(":hidden")) {
			otherLists.slideUp(200);
			childrenList.slideDown(200);
		}
		else {
			childrenList.slideUp(200);
		}
	});
	
	var currHeight = 0;
	var maxHeight = 0;
	var oneRowLevel = $(".oneRowLevel");
	oneRowLevel.each(function() {
		var levelContainer = $(this).find(".levelContainer");
		//console.log(levelContainer);
		levelContainer.each(function() {
			currHeight = $(this).height();
			if (currHeight > maxHeight) {
				maxHeight = currHeight;
			}
		});
		levelContainer.height(maxHeight);
		//console.log(maxHeight);
		currHeight = 0;
		maxHeight = 0;
	});
});