$(document).ready(function(){
	
	$("#Navigation li a span.TopLevel span:last").css("border-right", "0");
	
	// REMOVE EMPTY <P> TAGS
	$('p:empty').remove();
	
	// IF NO BANNER IMAGE, REMOVE THE BANNER
	if($("#hdBanner img").length < 1)
	{
		$("#hdBanner").hide();
	}
	
	var leftDivHeight = $("#hdLeftColumn").height();
	var rightImageHeight = $("#ImageArea").height();
	var newHeight = leftDivHeight - rightImageHeight; 
		
	if($("#ImageArea img").length < 1)
	{
		$("#ImageArea").hide();
		$("#SoLUpdateContainer").css("min-height", leftDivHeight);
		
	}
	else if($("#ImageArea img").length > 1)
	{
		$("#SoLUpdateContainer").css("min-height", newHeight);
		$("#Next").show();
		$("#Prev").show();
	}
	
	var projects = 2
	$(".ProjectSquare").each(function(){
		$(".ProjectSquare").eq(projects).css("margin-right", "0");
		
		projects = projects + 3;
	});
	
	// NAVIGATION
	

	$(".rmSlide").each(function(){
		$(this).hover(function(){
			$(this).parent().toggleClass("Active");
		});
	});
	
	$("#pgImageList li.SmallImage img").live('mouseover', function(){
			var source = $(this).attr("src").replace("?width=100&height=65&decreaseOnly=false", "")
			$("#pgImageList li.MainImage img").attr({src : source});
			$("#pgImageList li.SmallImage img").removeClass("ImageFade");
			$(this).addClass("ImageFade");
			
	});
	
	
	$("#hdHeader #hdNavigation ul:first > li > a > span").append("<span style='border-right:2px solid #FFE14F; color:#FFE14F; display:block; height:15px; padding:0; position:absolute; right:0; top:12px;'> </span>");
	
	$("#hdHeader #hdNavigation ul:first > li").hover(
		function(){
			$(this).css("background", "#e3e3e3");
			$(this).find("li").css({"background":"#e3e3e3"});
		}, 
		function(){
			$(this).css("background", "#fff");
			$(this).find("li").css({"background":"#e3e3e3"});
	});
	
	$("#hdHeader #hdNavigation ul li ul:first-child > li").hover(
		function(){
			$(this).css({"background":"#666"});
			$(this).find("span:first").css({"color":"#fff"});
		}, 
		function(){
			$(this).css({"background":"#e3e3e3"});
			$(this).find("span").css({"color":"#666"});	});
	
	$("#hdHeader #hdNavigation ul:first > li:last a span span").remove("span");
	
	if($(".PrevButton").length == 1 && $(".NextButton").length == 1)
	{
		$(".PrevButton").after("&nbsp;&nbsp;|&nbsp;&nbsp;");
	}
	else
	{
		$(".pgRight h3:first").css("margin-top", "36px")
	}
	
	
	
	$(".SearchBox").css({"border":"0", "width":"103px", "height":"13px", "font-size":"11px"});
	
	if($("h1.ProjectCategory").length > 0)
	{
		$("#hdPortfolio .addthis_button_compact").css({"left":"863px"});
	}

	$("html *").replaceText( /Sol /gi, "SōL " );
	$("html *").replaceText( /Sol, /gi, "SōL, " );
	
	
	$('#newsletterLink').fancybox({'type': 'iframe','width': 400,'height': 350});
	
});
