if(!rarebrick) var rarebrick = new Object();

if(swfobject.hasFlashPlayerVersion("9.0.0")) swfobject.createCSS("img#headerPic", "visibility:hidden;");
else swfobject.createCSS("div#flashReplace", "height:366px;");

rarebrick.addFlash = function() {
	var flashvars = {};
	flashvars.introLinks = rarebrick.getIntroLinks();
	var params = {};
	params.allowScriptAccess = "always";
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = 'flashIntroSwf';
	
	swfobject.embedSWF('intro_1005a.swf', 'flashInside', '100%', '100%', '9.0.0', rarebrick.baseURL+'swf/expressInstall.swf', flashvars, params, attributes);
}

swfobject.addDomLoadEvent(rarebrick.addFlash);

rarebrick.soundIcon = 'http://www.dineatcurrans.com/images/sound_';

rarebrick.initSoundButton = function() {
	jQuery('a').click(rarebrick.soundOff);
	jQuery('area').click(rarebrick.soundOff);
	
	var img = '<img src="'+rarebrick.soundIcon+'on.gif" />'
	rarebrick.soundButton = jQuery('<a>').click(rarebrick.toggleSound).append(img).attr('class','soundButton');
	jQuery('#header').prepend(rarebrick.soundButton);
}

rarebrick.toggleSound = function() {
	var player = rarebrick.getFlashPlayer('flashIntroSwf');
	player.toggleSound();
}

rarebrick.soundOff = function() {
	var player = rarebrick.getFlashPlayer('flashIntroSwf');
	player.soundOff();
}

jQuery('document').ready(rarebrick.initSoundButton);

rarebrick.setSoundIcon = function(which) {
	jQuery('.soundButton img').attr('src', rarebrick.soundIcon+which+'.gif');
}

rarebrick.getFlashPlayer = function(which) {
	var flashPlayer;
	if(navigator.appName.indexOf("Microsoft") != -1) {
		flashPlayer = window[which];
	} else {
		flashPlayer = window.document[which];
	}
	return flashPlayer;
}
