var allOpen = false;

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

	$('#home_middle h1 span, #home_callouts h2 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/meelheims_hdg-white.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/meelheims_hdg-blue.swf", thisId, "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes);


	});

	// VIDEO
	$("#video_link").colorbox({opacity:.5});

	// FAQ
	$("#faqs dt").click(function(){
	
		$(this).toggleClass("selected");
		$(this).next().slideToggle("slow");
	});
	$(".show_all").click(function(){
		if(allOpen) {
			$("#faqs dt").removeClass("selected");
			$("#faqs dd").slideUp("slow");
		} else {
			$("#faqs dt").addClass("selected");
			$("#faqs dd").slideDown("slow");
		}
		allOpen = (allOpen)? false : true;
		thisHTML = (allOpen)? "- Hide All Answers" : "+ Show All Answers";
		$(".show_all").html(thisHTML);
		return false;
	});

	// GALLERY
	$("#gallery a").colorbox({opacity:.7});

	// CALLOUTS
	$("#callout-quote").colorbox({width:"880px",height:"843px", transition:'fade', speed:500, opacity:.5, inline:true, href:"#lightbox-quote"});
	$("#callout-app").colorbox({width:"880px",height:"843px", transition:'fade', speed:500, opacity:.5, inline:true, href:"#lightbox-app"});
	$("#callout-calc").colorbox({width:"676px",height:"863px", transition:'fade', speed:500, opacity:.5, inline:true, href:"#lightbox-calc"});
	$(".cb_close").click(function(){
		$.fn.colorbox.close();
	});

}); 


