
$(function () {
	$("#home_splash_text").fadeIn(1000, function () {
		$("#t1").fadeIn(1500, function () {
			$("#t2").fadeIn(1500, function () {
				$("#t3").fadeIn(2500, function () {
					$("#t4").fadeIn(3000);
				  });
			  });
		});
	});

	$('#home-callouts h3 span').each(function () {
		var thisEl =  $(this);
		var thisId =  thisEl.attr('id');
		var thisParentId =  thisEl.parent().parent().attr('id');
		var thisHeading = thisEl.html();
		var thisColor = (thisParentId == "home-callout1")? "white" : "green";
		//thisHeading = "XXX: " + thisParentId;
		
		var myTitle = thisHeading.replace("&","%26");
		//alert('myTitle: ' + myTitle)


		var flashvars = {
			Text: myTitle
		};
		var params = {
			wmode: "transparent",
			salign: "TL"
		};
		var attributes = {
		};
		
		swfobject.embedSWF(thisTemplateDir + "/includes/headings/civil_dynamics_callout_hdg-" + thisColor + ".swf", thisId, "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes);


	});
	$('.content h1 span').each(function () {
		var thisEl =  $(this);
		var thisId =  thisEl.attr('id');
		var thisHeading = thisEl.html();
		// thisEl.html(thisHeading + " XXX");
		
		var myTitle = thisHeading.replace("&","%26");
		//alert('myTitle: ' + myTitle)


		var flashvars = {
			Text: myTitle
		};
		var params = {
			wmode: "transparent",
			salign: "TL"
		};
		var attributes = {
		};
		
		swfobject.embedSWF(thisTemplateDir + "/includes/headings/civil_dynamics_hdg-green.swf", thisId, "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes);


	});


	$('#nav ul ul').each(function () {
		$(this).parent().eq(0).hoverIntent({
			timeout: 100,
			over: function () {
				var current = $('ul:eq(0)', this);
				//alert(current);
				current.slideDown(100);
			},
			out: function () {
				var current = $('ul:eq(0)', this);
				current.fadeOut(200);
			}
		});
	});
	
	$('#nav ul ul a').hover(function () {
		$(this).stop(true).animate({paddingLeft: '5px'}, {speed: 100, easing: 'easeOutBack'});
	}, function () {
		$(this).stop(true).animate({paddingLeft: '20px'}, {speed: 100, easing: 'easeOutBounce'});
	});

	$(".portfolio .more a, .portfolio .thumb a").click(function(){
		thisContent = $(this).parent().parent().html();
		$("#inline_content").html(thisContent);
		$("#inline_content .hide").removeClass('hide');
		$(this).colorbox({opacity:.2, width:"800px", inline:true, href:"#inline_content"});
	});

	initContent = $("#notice").html();
	if(initContent){
		$("#inline_content").html(initContent);
		$("#inline_content .hide").removeClass('hide');
		$.fn.colorbox({opacity:.5, width:"600px", inline:true, href:"#inline_content"});
	}

});
