/**
 * SWFObject v2.0: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		deconcept.SWFObject.doPrepUnload = true;
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
if (deconcept.SWFObject.doPrepUnload) {
	deconcept.SWFObjectUtil.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
	}
	window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

http://www.jeroenwijering.com/extras/wizard.js

var defaults = {

	displayheight:'',

	file:'playlist.xml',

	height:0,

	image:'',

	width:0,

	frontcolor:'0x000000',

	backcolor:'0xffffff',

	lightcolor:'0x000000',

	autoscroll:false,

	displaywidth:'',

	largecontrols:false,

	location:'mediaplayer.swf',

	logo:'',

	overstretch:'false',

	showdigits:true,

	showdownload:false,

	showeq:false,

	showicons:true,

	showvolume:true,

	thumbsinplaylist:false,

	autostart:false,

	bufferlength:5,

	repeat:'false',

	rotatetime:10,

	shuffle:true,

	volume:80,

	audio:'',

	callback:'',

	captions:'',

	enablejs:false,

	fsbuttonlink:'',

	id:'',

	link:'',

	linkfromdisplay:false,

	linktarget:'_self',

	streamscript:'',

	type:'',

	useaudio:true,

	usecaptions:true,

	usefullscreen:true,

	usekeys:true

}

var examples = {

	defaults:{},

	single:{file:'http://www.jeroenwijering.com/upload/afraid.flv',height:'180',width:'320'},

	line:{file:'/upload/peterjones_sunshine_lofi.mp3',height:'20',width:'320'},

	nobar:{file:'http://www.jeroenwijering.com/upload/windmill_warriors.flv',height:'240',width:'320',displayheight:'240',image:'http://www.jeroenwijering.com/upload/windmill_dvd_rip.jpg'},

	botlist:{file:'http://www.jeroenwijering.com/upload/mediaplayer.xml',height:'340',width:'320',displayheight:'240'},

	rightlist:{file:'statistics.xml',height:'140',width:'320',displaywidth:'120'}

}

var advanced = true;

var embedcode = "";

var swfobjectcode = "";

var codeshown = "embed";





function $(name) {

	return document.getElementById(name);

};





function addEvent(obj, evType, fn) {

	if (obj.addEventListener){

		obj.addEventListener(evType, fn, false);

		return true;

	} else if (obj.attachEvent){

		var r = obj.attachEvent("on"+evType, fn);

		return r;

	} else {

		return false;

	}

};





function loadDefaults() {

	for(var prm in defaults) {

		if($(prm).checked) { 

			$(prm).checked = defaults[prm];

		} else {

			$(prm).value = defaults[prm];

		}

	}

};





function loadExample() {

	var idx = $('picker').value;

	loadDefaults();

	for(var prm in examples[idx]) {

		if($(prm).className == 'check') {

			$(prm).checked = examples[idx][prm];

		} else {

			$(prm).value = examples[idx][prm];

		}

	}

	loadPlayer();

}





function toggleAdvanced() {

	if(advanced == false) {

		$('advanced').style.display = 'block';

		advanced = true;

	} else {

		$('advanced').style.display = 'none';

		advanced = false;

	}

};





function loadPlayer() {

	var w = $('width').value;

	var h = $('height').value;

	var l = $('location').value;

	var so = new SWFObject(l,'mpl',w,h,'7');

	so.addParam('allowfullscreen',true);

	embedcode = "&lt;embed src=&quot;"+l+"&quot; width=&quot;"+w+"&quot; height=&quot;"+h+"&quot; allowfullscreen=&quot;true&quot; flashvars=&quot;";

	swfobjectcode = "&lt;script type=&quot;text/javascript&quot; src=&quot;swfobject.js&quot; /&gt\r\n\r\n&lt;div id=&quot;player&quot;&gt;This text will be replaced&lt;/div&gt;\r\n\r\n&lt;script type=&quot;text/javascript&quot;&gt;\r\nvar so = new SWFObject('mediaplayer.swf','mpl','"+w+"','"+h+"','7');\r\nso.addParam('allowfullscreen','true');\r\n";

	for(var prm in defaults) {

		if($(prm).className == 'check') {

			if($(prm).checked != defaults[prm]) {

				so.addVariable(prm,$(prm).checked+'');

				embedcode +="&amp;"+prm+"="+$(prm).checked;

				swfobjectcode +="so.addVariable('"+prm+"','"+$(prm).checked+"');\r\n";

			}

		} else {

			if($(prm).value != defaults[prm]) {

				so.addVariable(prm,$(prm).value);

				embedcode +="&amp;"+prm+"="+$(prm).value;

				swfobjectcode +="so.addVariable('"+prm+"','"+$(prm).value+"');\r\n";

			}

		}

	}

	embedcode += "&quot; /&gt;";

	swfobjectcode += "so.write('player');\r\n&lt;/script&gt;";

	so.write('player');

	$('codelabel').style.display = 'block';

	$('codefield').style.display = 'block';

	if(codeshown == "embed") { 

		$('codefield').innerHTML = embedcode;

	} else {

		$('codefield').innerHTML = swfobjectcode;

	}

};





function toggleCode() {

	if(codeshown == "embed") { 

		$('codelabel').innerHTML = "<a href='javascript:toggleCode();'>show embed code</a> | swfobject code to use";

		$('codefield').innerHTML = swfobjectcode;

		codeshown = "swfobject";

	} else {

		$('codelabel').innerHTML = "embed code to use | <a href='javascript:toggleCode();'>show swfobject code</a>";

		$('codefield').innerHTML = embedcode;

		codeshown = "embed";

	}

};





addEvent(window,'load',loadDefaults);

addEvent(window,'load',toggleAdvanced);

http://www.jeroenwijering.com/extras/colorpicker.js

//---------------------------------------------------------

// Color Picker Script from Flooble.com

// For more information, visit 

//http://www.flooble.com/scripts/colorpicker.php

// Copyright 2003 Animus Pactum Consulting inc.

// You may use and distribute this code freely, as long as

// you keep this copyright notice and the link to flooble.com

// if you chose to remove them, you must link to the page

// listed above from every web page where you use the color

// picker code.

//---------------------------------------------------------





var perline = 9;

var divSet = false;

var curId;

var colorLevels = Array('0','3','6','9','C','F');

var colorArray = Array();

var ie = false;

var nocolor = 'none';





if (document.all) { ie = true; nocolor = ''; }





function addColor(r, g, b) {

	var red = colorLevels[r];

	var green = colorLevels[g];

	var blue = colorLevels[b];

	addColorValue(red, green, blue);

}





function addColorValue(r, g, b) {

	colorArray[colorArray.length] = r + r + g + g + b + b;

}





function setColor(color) {

	var link = $(curId);

	var field = $(curId);

	var picker = $('colorpicker');

	field.value = color;

	if (color == '') {color = nocolor; }

	picker.style.display = 'none';

	eval($(curId).title);

	setResult();

}





function setDiv() {

	if (!document.createElement) { return; }

	var elemDiv = document.createElement('div');

	if (typeof(elemDiv.innerHTML) != 'string') { return; }

	genColors();

	elemDiv.id = 'colorpicker';

	elemDiv.innerHTML = getColorTable();

	document.body.appendChild(elemDiv);

	divSet = true;

}





function pickColor(id) {

	if (!divSet) { setDiv(); }

	var picker = $('colorpicker');

	if (id == curId && picker.style.display == 'block') {

		picker.style.display = 'none';

		return;

	}

	curId = id;

	var thelink = $(id);

	picker.style.top = getAbsoluteOffsetTop(thelink)+"px";

	picker.style.left = getAbsoluteOffsetLeft(thelink)+"px";

	picker.style.display = 'block';

}





function genColors() {

	addColorValue('0','0','0');

	addColorValue('3','3','3');

	addColorValue('6','6','6');

	addColorValue('8','8','8');

	addColorValue('9','9','9');

	addColorValue('A','A','A');

	addColorValue('C','C','C');

	addColorValue('E','E','E');

	addColorValue('F','F','F');

	for (a = 1; a < colorLevels.length; a++)

		addColor(0,0,a);

	for (a = 1; a < colorLevels.length - 1; a++)

		addColor(a,a,5);

	for (a = 1; a < colorLevels.length; a++)

		addColor(0,a,0);

	for (a = 1; a < colorLevels.length - 1; a++)

		addColor(a,5,a);

	for (a = 1; a < colorLevels.length; a++)

		addColor(a,0,0);

	for (a = 1; a < colorLevels.length - 1; a++)

		addColor(5,a,a);

	for (a = 1; a < colorLevels.length; a++)

		addColor(a,a,0);

	for (a = 1; a < colorLevels.length - 1; a++)

		addColor(5,5,a);

	for (a = 1; a < colorLevels.length; a++)

		addColor(0,a,a);

	for (a = 1; a < colorLevels.length - 1; a++)

		addColor(a,5,5);

	for (a = 1; a < colorLevels.length; a++)

		addColor(a,0,a);			

	for (a = 1; a < colorLevels.length - 1; a++)

		addColor(5,a,5);

  	return colorArray;

}





function getColorTable() {

	 var colors = colorArray;

 	 var tableCode = '';

	 tableCode += '<table>';

	 for (i = 0; i < colors.length; i++) {

		 if (i % perline == 0) { tableCode += '<tr>'; }

		 tableCode += '<td><a style="color:#' + colors[i] + 

			'; background:#' + colors[i] + 

			';" href="javascript:setColor(\'0x' + colors[i] + 

			'\');">&nbsp;</a></td>';

		 if (i % perline == perline - 1) { tableCode += '</tr>'; }

	 }

	 if (i % perline != 0) { tableCode += '</tr>'; }

	 tableCode += '</table>';

 	 return tableCode;

}





function getAbsoluteOffsetTop(obj) {

	var top = obj.offsetTop;

	var parent = obj.offsetParent;

	while (parent != document.body) {

		top += parent.offsetTop;

		parent = parent.offsetParent;

	}

	return top;

}





function getAbsoluteOffsetLeft(obj) {

	var left = obj.offsetLeft;

	var parent = obj.offsetParent;

	while (parent != document.body) {

		left += parent.offsetLeft;

		parent = parent.offsetParent;

	}

	return left;

}
