$(function(){
	
	$("#nav img,#header li img,#l-nav img").scgrph_swapper();
	
	$("#nav>ul>li>a").each(function(){
		if(location.href.match(new RegExp(this.href))){
			try{
				var p = $(this).parent().find("ul").show().
					parent().find("img:first");
				p.attr("src",p.attr("src").split("top").join(""));
			}
			catch(e){
			}
			return false;
		}
	});
	
	$("#l-nav>ul>li>a").each(function(){
		var target = $(this).parent().find("ul");
		if(location.href.match(new RegExp(this.href))){
			target.find("li").show();
			target.css("padding-bottom","20px");
		}
		else{
			target.find("li").hide();
		}
		if(target.length==0){$(this).parent().append("<ul />");}

	});
	
	$("a.popup").openWin();
	
	if($("#main p:first").is(":first-child")) $("#main p:first").addClass("first-child");

	if(location.href.indexOf("/about/")>-1){
		$("#l-nav>ul>li:eq(3), #nav ul ul li:eq(3)").hide();
		
	}
});

