$(document).ready(function() {
	$(".hd-rounded-nav>li").hover(function() {
		$(this).find(".hd-rounded-sub-nav").show();
	}, function() {
		$(this).find(".hd-rounded-sub-nav").hide();
	});
	// location bubble
	$("#location-bubble-trigger").click(function() {
		$("#location-bubble").toggle()
		return false
	});
	$("#location-bubble .close").click(function() {
		$("#location-bubble").hide()
		return false
	});
	// location bubble position
	var position = $("#location-bubble-trigger").position();
	var width = $("#location-bubble-trigger").width();
	$("#location-bubble").css({
		"left":position.left+width
	})
	// callback
	$("#callback-form-trigger").click(function() {
		$("#callback-form").toggle()
		$(this).parent().toggleClass("hd-callback-link-expanded")
		return false
	});
	$("#callback-form .close").click(function() {
		$(this).parents(".hd-callback-form").hide();
		$(".hd-callback-link").removeClass("hd-callback-link-expanded")
		return false
	});
	// brand selection
	$("#brand-selection-trigger").click(function() {
		$("#brand-selection-popup").toggle()
		return false
	});
	$("#brand-selection-popup a.close").click(function() {
		$("#brand-selection-popup").hide()
		return false
	});
// aside menu
	$(".aside-menu dd>span>a").click(function() {
		
		var dd = $(this).parents("dd");
		
		dd.nextAll("dd:not(.current)").removeClass();
		dd.prevAll("dd:not(.current)").removeClass();
		dd.nextAll("dd:not(.current)").find("ul").hide();
		dd.prevAll("dd:not(.current)").find("ul").hide();
		
		if (dd.hasClass("current") && dd.find("ul").length == 1) {
			// dd.removeClass("current");
			// dd.find("ul").hide();
			return false
		} else if(dd.hasClass("current") && dd.find("ul").length == 0) {} else if(dd.find("ul").length == 0) {} else {
			dd.find("ul").toggle();
			dd.toggleClass("expanded")
			return false
		};
		
	});
});

