$(document).ready(function(){
	
	$("div.box_hp div:last").css("margin","0").css("float","right");
	$("div.buttons li:last").css("margin","0").css("width","200px");
	
	var url = document.location.href;
	$("#header div.menu a").each(function()
	{
		var href = $(this).attr("href").split("../").join("");
		var hrefPrefix = href.indexOf("/")!=-1 ? href.substring(0, href.lastIndexOf("/"))+"/" : href;

		if (href!="" && url.indexOf(href)!=-1)
		{
			$(this).closest("li").find("ul").show();
			$(this).addClass("current");
		}
		else if (hrefPrefix!="" && url.indexOf(hrefPrefix)!=-1)
		{
			$(this).closest("li").find("ul").show();
			$(this).addClass("active");
		}
	});
	
	$("div.buttons a, #header div.menu_promo a").each(function()
	{
		var href = $(this).attr("href").split("../").join("");
		var hrefPrefix = href.indexOf("/")!=-1 ? href.substring(0, href.lastIndexOf("/"))+"/" : href;

		if (href!="" && url.indexOf(href)!=-1)
		{
			$(this).closest("li").find("ul").show();
			$(this).addClass("current");
		}
		else if (hrefPrefix!="" && url.indexOf(hrefPrefix)!=-1)
		{
			$(this).closest("li").find("ul").show();
			$(this).addClass("");
		}
	});
	
	
	$("div.toggle a.link:first").addClass("active");
	$("div.toggle a.link:first").parent().find("p").css("display","block");
	$("div.toggle a.link").click(function(){				
		if($(this).hasClass("active")){
			$(this).parent().find("p").hide();
			$(this).removeClass("active");
		}
		else{
		$(this).addClass("active");
		$(this).parent().find("p").show();
		}
	});
	
});
