
fs_an = navigator.appName;
fs_av = navigator.appVersion;
fs_ua = navigator.userAgent;

FlashSound.winIE = ((fs_an.indexOf("Microsoft") != -1) && (fs_av.indexOf("Windows") != -1) && (parseFloat(fs_av) >= 4) && (fs_ua.indexOf("Opera") == -1));
						
FlashSound.Mozilla = ((fs_an == "Netscape") && (fs_ua.indexOf("Mozilla") != -1) && (parseFloat(fs_av) >= 5));
						
FlashSound.Opera = ((fs_ua.indexOf("Opera") != -1) && (parseFloat(fs_av) >= 4));

FlashSound.NN4 = ((fs_an == "Netscape") && (fs_ua.indexOf("Mozilla") != -1) && (parseFloat(fs_av) >= 4) && (parseFloat(fs_av) < 5));

FlashSound.oldNN = ((fs_an == "Netscape") && (fs_ua.indexOf("Mozilla") != -1) && (parseFloat(fs_av) < 4));
	
FlashSound.unsupportedPluginBrowser = (FlashSound.oldNN);

FlashSound.Plugin = (navigator.mimeTypes && navigator.mimeTypes.length > 0 && !FlashSound.unsupportedPluginBrowser);

FlashSound.ActiveX = FlashSound.winIE;
FlashSound.LiveConnect = (FlashSound.NN4 || FlashSound.Opera);
FlashSound.XPConnect = FlashSound.Mozilla;
FlashSound.XPConnectInstallError = false;

if(FlashSound.ActiveX){
	document.write(
		'<scr' + 'ipt language=VBScript>' + '\n' +
			'On error resume next' + '\n' +
			'activeXEnabled = false' + '\n' +
			'activeXEnabled = IsObject(CreateObject(\"Microsoft.ActiveXPlugin.1\"))' + '\n' +
		'<\/scr' + 'ipt>'
		);
	FlashSound.ActiveXEnabled = activeXEnabled; 
} else {
	FlashSound.ActiveXEnabled = false;
}

FlashSound.ActiveXEnabled_Browser_Reports = FlashSound.ActiveXEnabled;

FlashSound.ActiveXEnabled = true; 

FlashSound.supportsPlayerDetection = ((FlashSound.ActiveX && FlashSound.ActiveXEnabled) || FlashSound.Plugin);

if(FlashSound.supportsPlayerDetection){ 
	FlashSound.supportsInteraction = (FlashSound.ActiveX ||(FlashSound.LiveConnect && navigator.javaEnabled()) || 		
										FlashSound.XPConnect);
} else {
	FlashSound.supportsInteraction = false;
}

fs_mt = "application/x-shockwave-flash";

function fs_checkForPlugIn(){
	if(FlashSound.Plugin && navigator.mimeTypes[fs_mt]){
		return (navigator.mimeTypes[fs_mt].enabledPlugin);
	} else {
		return false;
	}
}

function fs_getPlugInVers(){
	if(fs_checkForPlugIn()){
		p = navigator.mimeTypes[fs_mt].enabledPlugin;
		var pluginversion = parseInt(p.description.substring(p.description.indexOf(".")-1))
		return pluginversion;
	} else {
		return 0;
	}
}

function fs_getPlugInReleaseVers(){
	if(fs_checkForPlugIn()){
		p = navigator.mimeTypes[fs_mt].enabledPlugin;
		if(p.description.indexOf("r") != -1){
			var rversion = parseInt(p.description.substring(p.description.indexOf("r")+1, p.description.length));
		} else {
			rversion = 0;
		}
		return rversion;
	} else {
		return 0;
	} 
}

if(FlashSound.ActiveX){
	document.write(
		'<scr' + 'ipt language=VBScript>' + '\n' +
		'Function fs_getActiveXVersion()' + '\n' +
			'On Error Resume Next' + '\n' +
			'Dim hasPlayer, playerversion' + '\n' +
			'hasPlayer = false' + '\n' +
			'playerversion = 15' + '\n' +
			'Do While playerversion > 0' + '\n' +
				'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion)))' + '\n' +
				'If hasPlayer Then Exit Do' + '\n' +
				'playerversion = playerversion - 1' + '\n' +
			'Loop' + '\n' +
			'fs_getActiveXVersion = playerversion' + '\n' +
		'End Function' + '\n' +
		'<\/scr' + 'ipt>'
		);
}

FlashSound.playerVersion = 0;  
function fs_hasMinPlayer(){
	if(!FlashSound.supportsPlayerDetection) {return false;}
	if(FlashSound.Plugin) {FlashSound.playerVersion = fs_getPlugInVers();}
	if(FlashSound.ActiveX) {FlashSound.playerVersion = fs_getActiveXVersion();}

	if(FlashSound.playerVersion >= FlashSound.minPlayer) {return true}
	else{return false}
}

function fs_hasMinInteractivePlayer(){
	if(!FlashSound.hasMinPlayer() || !FlashSound.supportsInteraction) {return false;} 
	if(FlashSound.ActiveX || FlashSound.LiveConnect) { 
		return true; 
	}
	if(FlashSound.XPConnect){ 
		FlashSound.playerVersion = fs_getPlugInVers(); 
		releaseVers = fs_getPlugInReleaseVers(); 
		if(FlashSound.playerVersion > 6) { 
			return true; 
		} else if(FlashSound.playerVersion == 6 && releaseVers >=40){ 
			return true;
		} else {
			return false; 
		}
	}
}

function fs_configuredForInteraction(){
	return (FlashSound.supportsInteraction && !FlashSound.XPConnectInstallError && FlashSound.hasMinInteractivePlayer())
}

function fs_setMinPlayer(vers){
	if(FlashSound.supportsPlayerDetection){
		FlashSound.minPlayer = (vers != null && vers >= 4) ? vers : 4; 
	}
}

FlashSound.configuredForInteraction = fs_configuredForInteraction;
FlashSound.hasMinPlayer = fs_hasMinPlayer; 
FlashSound.hasMinInteractivePlayer = fs_hasMinInteractivePlayer;
FlashSound.setMinPlayer = fs_setMinPlayer; 
FlashSound.setMinPlayer(); 

function fs_setAttributeDefaultValues(){
	this.attributes = new Object();

	this.attributes["SRC"] = this.attributes["MOVIE"] = null;
	this.attributes["CLASSID"]="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	if(this.playerID != null) {this.attributes["NAME"]=this.attributes["ID"]=this.playerID;} 
	this.attributes["TYPE"]=fs_mt;
	this.attributes["HEIGHT"]="2";
	this.attributes["WIDTH"]="1";
	this.attributes["PLAY"]="true";
	this.attributes["LOOP"]="true";
	this.attributes["QUALITY"]="low";
	this.attributes["BGCOLOR"]=(document.bgColor != null) ? document.bgColor : "#ffffff";
	this.attributes["WMODE"]="Transparent";
	this.attributes["SWLIVECONNECT"]=(this.playerID != null) ? "true" : null 
	this.attributes["CODEBASE"]="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0";
	this.attributes["PLUGINSPAGE"]="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";
}

function fs_parseAttributes(embedStr){
	if(typeof RegExp == "undefined") { return; } 
	
	var sglqt = new RegExp("'","gi"); embedStr = embedStr.replace(sglqt, "");
	var dblqt = new RegExp('"',"gi"); embedStr = embedStr.replace(dblqt, "");
	var xtraspc = new RegExp("\\s+","gi"); embedStr = embedStr.replace(xtraspc," ");
	var eqspc = new RegExp("\\s*=\\s*","gi"); embedStr = embedStr.replace(eqspc, "=");
	
	var i = 0; while(embedStr.charAt(i) == " "){i++;} startpos = i; 
	var j = embedStr.length - 1; while(embedStr.charAt(j) == " "){j--;} endpos = j + 1; 
	embedStr = embedStr.substring(startpos,endpos); 

	var nvPairs = embedStr.split(" "); 
	var readOnlyAttributes = new Array("CLASSID","CODEBASE","ID","NAME","PLUGINSPAGE","SWLIVECONNECT");

	for(k=0; k<nvPairs.length; k++){
		var equalPos = nvPairs[k].indexOf("="); 
		
		if(equalPos > -1 && equalPos != nvPairs[k].length - 1){
			var attributeName = nvPairs[k].substring(0,equalPos).toUpperCase(); 
			var attributeValue = nvPairs[k].substring(equalPos + 1, nvPairs[k].length); 
			
			for(l=0; l<readOnlyAttributes.length; l++){
				var isReadOnly = (attributeName == readOnlyAttributes[l])
				if(isReadOnly) { break; }
			}
			
			if(!isReadOnly && attributeValue != null) {
				this.attributes[attributeName] = attributeValue; 
			}
		}
	}
	return;
}

function fs_getAttributeValue(attributeName){
	if(FlashSound.configuredForInteraction() && this.attributes[attributeName] != null){
		return this.attributes[attributeName.toUpperCase()];
	} else {
		return null; 
	}
}

function fs_createEmbedHTML(){
	if(arguments[0] != null && typeof(arguments[0]) != "undefined"){
		var src = arguments[0]
		this.attributes["SRC"] = src;
	}
	
	if(this.attributes["SRC"].charAt(0) == "/" && location.href.indexOf("http://") != -1) { 
		this.attributes["SRC"] = "http://" + location.host + this.attributes["SRC"];
	}
	this.attributes["MOVIE"] = this.attributes["SRC"];
	var objectAttributes = new Array("CLASSID","ID","HEIGHT","WIDTH","CODEBASE");
	var objectParams = new Array("MOVIE","WMODE");
	var embedAttributes = new Array("SRC","TYPE","NAME","SWLIVECONNECT","PLUGINSPAGE");
	
	var objectAttributesList = ""
	for(var i=0; i<objectAttributes.length; i++){
		if(typeof this.attributes[objectAttributes[i]] != "undefined"){
			if(this.attributes[objectAttributes[i]] != null){ 
				objectAttributesList += objectAttributes[i] + '="' + this.attributes[objectAttributes[i]] + '" ';
			}
		}
	}
	objectAttributesList = objectAttributesList.substring(0,objectAttributesList.length-1); 
	
	var nonParams = embedAttributes.join(" ") + " " + objectAttributes.join(" ");
	var objectParamsList = "";
	for(attname in this.attributes){ 
		if(attname == "BASE" || nonParams.indexOf(attname) == -1){ 
			if(this.attributes[attname] != null){
				objectParamsList += '<PARAM NAME="' + attname + '" VALUE="' + this.attributes[attname] + '">\n';
			}
		}
	}
	
	var nonEmbeds = objectParams.join(" ") + " " + objectAttributes.join(" ");
	var embedAttributesList = "";
	for(attname in this.attributes){ 
		if(attname == "WIDTH" || attname == "HEIGHT" || attname == "BASE" || nonEmbeds.indexOf(attname) == -1){
			if(this.attributes[attname] != null){ 
				embedAttributesList += '\t' + attname + '="' + this.attributes[attname] + '"\n';
			}
		}
	}
	
	embedAttributesList = embedAttributesList.substring(0,embedAttributesList.length-1); 
	
	HTML = '<OBJECT ' + objectAttributesList + '>\n' +
			objectParamsList + 
			'<EMBED\n' + 
			embedAttributesList + '>\n</EMBED>\n</OBJECT>';
	return HTML;
} 

function fs_embedSWF(srcURL){
	if (!FlashSound.configuredForInteraction()) {return "";}
	this.setAttributeDefaultValues(); 
	if(arguments[1] == false) {
		return this.createEmbedHTML(srcURL); 
	} else {
		document.write(this.createEmbedHTML(srcURL)); 
	}
	return "";
}

function fs_no_js_embedSWF(srcURL){
	if (!FlashSound.hasMinPlayer()) {return "";}
	this.setAttributeDefaultValues(); 
	if(arguments[1] == false) {
		return this.createEmbedHTML(srcURL); 
	} else {
		document.write(this.createEmbedHTML(srcURL)); 
	}
	return "";
}

function fs_customEmbedSWF(customEmbedStr){
	if (!FlashSound.configuredForInteraction()) {return "";}
	this.setAttributeDefaultValues(); 
	this.parseAttributes(customEmbedStr); 
	if(arguments[1] == false) {
		return this.createEmbedHTML(); 
	} else {
		document.write(this.createEmbedHTML()); 
	}
	return "";
}

function fs_no_js_customEmbedSWF(customEmbedStr){
	if (!FlashSound.hasMinPlayer()) {return "";}
	this.setAttributeDefaultValues(); 
	this.parseAttributes(customEmbedStr); 
	if(arguments[1] == false) {
		return this.createEmbedHTML(); 
	} else {
		document.write(this.createEmbedHTML()); 
	}
	return "";
}

function fs_checkForInstance(){
	if (window.document[this.playerID] == null) {return false;}
	return true;
}

function fs_recognizeMethod(objstr){
	if(!this.checkForInstance()){
		return false;
	} else if (typeof window.document[this.playerID][objstr] == "undefined") {
		FlashSound.XPConnectInstallError = true; 
		return false;
	} else {
		return true;
	}
}

function fs_isPlayerReady(){
	if(!FlashSound.configuredForInteraction()) {return false;}
	if(!this.engageInteraction) {return false;}
	if(!this.checkForInstance()) {return false;}
	if(!this.recognizeMethod("PercentLoaded")) {return false;} 
	if(window.document[this.playerID].PercentLoaded() > 0) {return true;}
	return false;
}

function fs_gotoAndPlay(target,frame){
	if(!this.isPlayerReady()) {return}
	if(typeof(frame) == "number"){
		window.document[this.playerID].TGotoFrame(target,frame - 1);
		window.document[this.playerID].TPlay(target);
	}
	if(typeof(frame) == "string"){
		window.document[this.playerID].TGotoLabel(target,frame);
		window.document[this.playerID].TPlay(target);
	}
}

function fs_gotoAndStop(target,frame){
	if(!this.isPlayerReady()) {return}
	if(typeof(frame) == "number"){
		window.document[this.playerID].TGotoFrame(target,frame - 1);
	}
	if(typeof(frame) == "string"){
		window.document[this.playerID].TGotoLabel(target,frame);
	}
}

function fs_api_PercentLoaded(){
	if(this.recognizeMethod("PercentLoaded")) {
		return parseInt(window.document[this.playerID].PercentLoaded());
	} else {
		return 0;
	}
}

function fs_api_TPlay(target){
	if(!this.isPlayerReady()) {return;}
	window.document[this.playerID].TPlay(target);
}

function fs_api_TStopPlay(target){
	if(!this.isPlayerReady()) {return;}
	window.document[this.playerID].TStopPlay(target);
}

function fs_api_IsPlaying(){
	if(!this.isPlayerReady()) {return false;}
	return window.document[this.playerID].IsPlaying();
}

function fs_api_LoadMovie(layerNumber,url){
	if(!this.isPlayerReady()) {return;}
	window.document[this.playerID].LoadMovie(layerNumber,url);
}

function fs_LoadMovieNum(url, layerNumber){
	if(!this.isPlayerReady()) {return;}
	window.document[this.playerID].LoadMovie(layerNumber,url);
}

function fs_checkPercent(){
	if(!this.isPlayerReady()){ return; }
	this.currentPercent = this.PercentLoaded();
	if(this.currentPercent >= 100){ 
		if(this.onLoadChange) {this.onLoadChange(100);} 
		clearInterval(this.monitorLoadLoop); 
		if(this.onLoadComplete){this.onLoadComplete();} 
	} else { 
		
		if(this.onLoadChange && (this.currentPercent > this.prevPercent)){
			this.onLoadChange(this.PercentLoaded());
		}
	}
	this.prevPercent = this.currentPercent;
}

function fs_monitorLoadProgress(){
	if(window.setInterval){ 
		var codestr = "FlashSound.players[" + this.playersIndex +"].checkPercent()"
		this.monitorLoadLoop = setInterval(codestr,100);
	}
}

FlashSound.playerCount = 0;
FlashSound.IDstringPrefix = "FlashSound_swf";
FlashSound.players = new Array(); 

function fs_engageInteraction(state){
	if(FlashSound.supportsPlayerDetection){
		state = (state == null) ? true : state; 
		for(var i=0; i<FlashSound.players.length; i++){
			FlashSound.players[i].engageInteraction = state;
		}
	}
}

FlashSound.embedSWF = fs_no_js_embedSWF; 
FlashSound.engageInteraction = fs_engageInteraction 
FlashSound.customEmbedSWF = fs_no_js_customEmbedSWF; 
FlashSound.createEmbedHTML = fs_createEmbedHTML; 
FlashSound.parseAttributes = fs_parseAttributes;
FlashSound.setAttributeDefaultValues = fs_setAttributeDefaultValues;

function FlashSound(){
	
	
	this.engageInteraction = true;
	this.playerID = FlashSound.IDstringPrefix + FlashSound.playerCount; 
	this.playersIndex = FlashSound.playerCount; 
	FlashSound.players[FlashSound.playerCount] = this;
	FlashSound.playerCount++;

	this.setAttributeDefaultValues = fs_setAttributeDefaultValues;
	this.parseAttributes = fs_parseAttributes;
	this.getAttributeValue = fs_getAttributeValue;
	this.createEmbedHTML = fs_createEmbedHTML; 
	this.embedSWF = fs_embedSWF; 
	this.customEmbedSWF = fs_customEmbedSWF; 
	this.checkForInstance = fs_checkForInstance;
	this.recognizeMethod = fs_recognizeMethod;
	this.isPlayerReady = fs_isPlayerReady; 
	this.gotoAndPlay = this.TGotoAndPlay = fs_gotoAndPlay; 
	this.gotoAndStop = this.TGotoAndStop = fs_gotoAndStop; 
	this.loadMovieNum = this.LoadMovieNum = fs_LoadMovieNum; 
	this.checkPercent = fs_checkPercent;
	this.monitorLoadProgress = fs_monitorLoadProgress; 
	
	this.PercentLoaded = fs_api_PercentLoaded; 
	this.play = this.TPlay = fs_api_TPlay; 
	this.stop = this.TStopPlay = fs_api_TStopPlay; 
	this.IsPlaying = fs_api_IsPlaying; 
	this.LoadMovie = fs_api_LoadMovie; 
}