jQuery(document).ready(function(){
	doNewWin();
	listHover();
	doFlash();
});


/* =Open a new window
-----------------------------------------------------------------------------*/
function doNewWin() {
	$("a").each(function(){var x = $(this);
	if(x.hasClass("newWin")){
		var linkTitle = "(This link opens a new window)";
		var newTitle = (empty(x.attr("title"))) ? linkTitle : x.attr("title")+" "+linkTitle;
		x.removeClass("newWin").addClass("ext").click(function(){window.open(x.attr("href"));return false;});
	}});
}


/* =Add class "hover to all li's and buttons
-----------------------------------------------------------------------------*/
function listHover(){
	$("li, button")
		.mouseover(function(){$(this).addClass("hover")})
		.mouseout(function(){$(this).removeClass("hover")});
}


/* =Add Flash
-----------------------------------------------------------------------------*/
function doFlash(){
	if(!document.getElementById("flashStage")) return false;
	var bId = $('body').attr("id");
	switch(bId){
		case 'about':	so = new SWFObject("flashVid/fabricVid.swf", "About Fabric Supply Video", "480", "370", "8", "#ffffff");	break;
		case 'foam':	so = new SWFObject("flashVid/foamVid.swf", "Foam Fabrication Video", "480", "370", "8", "#ffffff");			break;
	}
	$("#flashStage").addClass("active");
	so.addParam("quality", "high");
	so.addParam("wmode", "transparent");
	so.addParam("pluginurl", "http://www.macromedia.com/go/getflashplayer");
	so.write("flashStage");
}

/* =Helper Functions
-----------------------------------------------------------------------------*/
function empty(x){	return ((x == '' || x == null) ? true : false);}
