var flashVer = 0;

if (navigator.plugins["Shockwave Flash"]) {
	versionIndex = navigator.plugins["Shockwave Flash"].description.indexOf(".");
	var versionString = navigator.plugins["Shockwave Flash"].description.substring(versionIndex-2, versionIndex);
	flashVer = parseInt(versionString);
} else if (navigator.userAgent && (navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Win") != -1)) {
	document.writeln('<scr'+'ipt language=vbscript\>');
	document.writeln('on error resume next');
	document.writeln('for i = 12 to 5 step -1');
	document.writeln('SFlash = "ShockwaveFlash.ShockwaveFlash." & i');
	document.writeln('hasflash = isObject(CreateObject(SFlash))');
	document.writeln('if hasflash then');
	document.writeln('flashVer = i');
	document.writeln('exit for');
	document.writeln('end if');
	document.writeln('next');
	document.writeln('</scr'+'ipt\>');
}

function printFlash(src, id, width, height, bg, ver) {
	if (flashVer>=ver) {
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
		document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+',0,0,0" ');
		document.write('width="'+width+'" height="'+height+'" id="'+id+'" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="'+src+'" />');
		document.write('<param name="menu" value="false" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#'+bg+'" />');
		document.write('<embed src="'+src+'" menu="false" wmode="transparent" quality="high" ');
		document.write('bgcolor="#'+bg+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" ');
		document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ');
		document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	}
}

/* 
* TURN ON NOTICE - Remove "BAK" from the function below and add "BAK" to the function after, and update "notice_XXXX-XX-XX.gif"
* TURN OFF NOTICE - Add "BAK" to the function name below and remove "BAK" on the function after
*/

function printMarqueeBAK() {
	document.write('<img src="/images/home/notice_2008-09-10.gif" />');
}

function printMarquee() {
	if (flashVer>6) {
		var homeArray = new Array("big_boss_giveaway.swf", "f-110_marquee.swf", "v-drums_lessons.swf");
		var randInt = Math.floor(Math.random()*homeArray.length);
		var src = homeArray[randInt];
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
		document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
		document.write('width="806" height="272" id="marquee" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="/flash/home/'+src+'" />');
		document.write('<param name="menu" value="false" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#F4F5F6" />');
		document.write('<embed src="/flash/home/'+src+'" menu="false" wmode="transparent" quality="high" ');
		document.write('bgcolor="#F4F5F6" width="806" height="272" name="marquee" align="middle" ');
		document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ');
		document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	} else {
		document.write('<div><a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank"><span>Get Flash</span></a></div>');
	}
}

function printMFE(xmlPath, prodID) {
	if (flashVer>6) {
		var qs = parseQueryString();
		var page = (qs['page']) ? qs['page'] : "main";
		var fv = "xmlPath="+xmlPath+"&prodID="+prodID+"&page="+page;
		if (qs['skip']) {
			fv += "&skipPromo="+qs['skip'];
		}
		if (qs['file']) {
			fv += "&file="+qs['file'];
		}
		if(!blockReferrer(document.referrer)) {
			document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
			document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
			document.write('width="580" height="270" id="mfe" align="middle">');
			document.write('<param name="allowScriptAccess" value="sameDomain" />');
			document.write('<param name="movie" value="mfe.swf" />');
			document.write('<param name="flashVars" value="'+fv+'" />');
			document.write('<param name="wmode" value="transparent" />');
			document.write('<param name="quality" value="high" />');
			document.write('<param name="bgcolor" value="#FFFFFF" />');
			document.write('<embed src="mfe.swf" flashVars="'+fv+'" wmode="transparent" quality="high" ');
			document.write('bgcolor="#FFFFFF" width="580" height="270" name="mfe" align="middle" ');
			document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ');
			document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
		}
	} else {
		document.write('<a href="http://macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
		document.write('<img src="/images/products/get_flash.gif" alt="Get Flash" width="580" height="270" border="0" />');
		document.write('</a>');
	}
}

function printPlayer(path) {
	if (flashVer>6) {
		var fv = "path="+path;
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
		document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
		document.write('width="324" height="240" id="player" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="player.swf" />');
		document.write('<param name="flashVars" value="'+fv+'" />');
		document.write('<param name="menu" value="false" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="bgcolor" value="#000000" />');
		document.write('<embed src="player.swf" flashVars="'+fv+'" menu="false" quality="high" ');
		document.write('bgcolor="#000000" width="324" height="240" name="player" align="middle" ');
		document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ');
		document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	} else {
		document.write('<a href="http://macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
		document.write('<img src="get_flash.gif" alt="Get Flash" width="324" height="240" border="0" />');
		document.write('</a>');
	}
}

function printQT(src, width, height, control, ver) {
	if(control) height += 16;
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ');
	document.write('codebase="http://www.apple.com/qtactivex/qtplugin.cab#version='+ver+',0,0,0" ');
	document.write('width="'+width+'" height="'+height+'" align="middle">');
	document.write('<param name="src" value="'+src+'" />');
	document.write('<param name="controller" value="'+control+'" />');
	document.write('<embed src="'+src+'" width="'+width+'" height="'+height+'" controller="'+control+'" align="middle" ');
	document.write('pluginspage="http://www.apple.com/quicktime/download/" /></object>');
}

function parseQueryString() {
	var qs = new Object();
	var separator = ',';
	var query = ''+this.location;
	query = query.substring((query.indexOf('?'))+1);
	if (query.length<1) {
		return false;
	}
	var keypairs = new Object();
	var numKP = 1;
	while (query.indexOf('&')>-1) {
		keypairs[numKP] = query.substring(0, query.indexOf('&'));
		query = query.substring((query.indexOf('&'))+1);
		numKP++;
	}
	keypairs[numKP] = query;
	for (i in keypairs) {
		var keyName = keypairs[i].substring(0, keypairs[i].indexOf('='));
		var keyValue = keypairs[i].substring((keypairs[i].indexOf('='))+1);
		while (keyValue.indexOf('+')>-1) {
			keyValue = keyValue.substring(0, keyValue.indexOf('+'))+' '+keyValue.substring(keyValue.indexOf('+')+1);
		}
		keyValue = unescape(keyValue);
		if (qs[keyName]) {
			qs[keyName] = qs[keyName]+separator+keyValue;
		} else {
			qs[keyName] = keyValue;
		}
	}
	return qs;
}

function blockReferrer(ref) {
	var blacklist = new Array();
	blacklist.push("bossmusik.de");
	blacklist.push("rolandmusik.de");
	for(var i=0; i<blacklist.length; i++) {
		if(ref.indexOf(blacklist[i]) != -1) return true;
	}
	return false;
}
