$(document).ready(function(){
	$('.navitem').hover(function(){
		var thistitle = $(this).attr("title");
		if(thistitle == "gallery" || thistitle == "current-projects" || thistitle == "developments") {
			//$("#hor_line").stop().show().animate({top:$(this).offset().top,left:$(this).offset().left - 380},{queue:false,duration:900});
		} else {
			$("#hor_line").stop().show().animate({top:$(this).offset().top},{queue:false,duration:900});
		}
	});
});

$(window).load(function(eventData){
	if (window.navigator.userAgent.indexOf("MSIE 6") > -1) {
		DD_belatedPNG.fix("img, .tag");
	}
	
	$("#content_right h1").css("color", "black");
	if(document.getElementById("content_right"))
		startAnimation();
});

function startAnimation() {
	window.setTimeout(function(){
		var originalText = $("#content_right h1").html();
		var preProcessedText = "<span>" + originalText.split(/\s/).join("</span> <span>") + "</span>";
		$("#content_right h1").html(preProcessedText);
		$("#content_right h1").find("span").css({"opacity":0, "color": "white"}).each(function(count,DOMnode){
			$(DOMnode).animate({opacity:0},100 + (50 * count)).animate({opacity:1},500);
		});
	},200);
	showContent();
}

function showContent() {
	window.setTimeout(function(){
		$("#content_right_overlay").fadeOut(500);
	},1000);
}
