/**
Author: Eugen Andrasescu
mailto: only4seasons@gmail.com
*/

if(typeof omega == "undefined") var omega = new Object();

if(typeof omega.swfObject == "undefined") {
	omega.swfObject = function() {
		if (!document.getElementById) { return; }
		this.codebase	= "https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0";
		this.width		= "100%";
		this.height		= "100%";
		this.quality	= "high";
		this.pluginspage= "https://www.macromedia.com/go/getflashplayer";
		this.align		= "middle";
		this.autostart	= "true";
		this.loop		= "true";
		this.scale		= "noscale";
		this.wmode		= "window";
		this.devicefont	= "false";
		this.id			= "swfMovie";
		this.bgcolor	= "#ffffff";
		this.menu		= "false";
		this.scripting	= "sameDomain";
		this.movie		= "";
		this.salign		= "";
		this.flashvars	= "";
	}
	
	omega.swfObject.prototype.html = function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			var swfNode =
			"<embed type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" " +
			"width=\"" + this.width + "\" " +
			"height=\"" + this.height + "\" " +
			"id=\"" + this.id + "\" " +
			"name=\"" + this.id + "\" " +
			"align=\"" + this.align + "\" " +
			"allowScriptAccess=\"" + this.scripting + "\" " +
			"src=\"" + this.movie + "\" " +
			"menu=\"" + this.menu + "\" " +
			"quality=\"" + this.quality + "\" " +
			"scale=\"" + this.scale + "\" " +
			"wmode=\"" + this.wmode + "\" " +
			"devicefont=\"" + this.devicefont + "\" " +
			"bgcolor=\"" + this.bgcolor + "\" " +
			"play=\"" + this.autostart + "\" " +
			"loop=\"" + this.loop + "\" " +
			"salign=\"" + this.salign + "\" " +
			"flashvars=\"" + this.flashvars + "\" " +
			"style=\"z-index:-1\" />";
		}
		else { // IE
			var swfNode =
			"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + this.width + "\" height=\"" + this.height + "\" id=\"" + this.id + "\" name=\"" + this.id + "\" align=\"" + this.align + "\" style=\"z-index:-1\" >" +
			"<param name=\"allowScriptAccess\" value=\"" + this.scripting + "\" />" +
			"<param name=\"movie\" value=\"" + this.movie + "\" />" +
			"<param name=\"menu\" value=\"" + this.menu + "\" />" +
			"<param name=\"quality\" value=\"" + this.quality + "\" />" +
			"<param name=\"scale\" value=\"" + this.scale + "\" />" +
			"<param name=\"wmode\" value=\"" + this.wmode + "\" />" +
			"<param name=\"devicefont\" value=\"" + this.devicefont + "\" />" +
			"<param name=\"bgcolor\" value=\"" + this.bgcolor + "\" />" +
			"<param name=\"play\" value=\"" + this.autostart + "\" />" +
			"<param name=\"loop\" value=\"" + this.loop + "\" />" +
			"<param name=\"salign\" value=\"" + this.salign + "\" />" +
			"<param name=\"flashvars\" value=\"" + this.flashvars + "\" />" +
			"</object>";
		}
		return swfNode;
	}
	
	omega.swfObject.prototype.embed = function(container) {
		cObj	= document.getElementById(container);
		if (typeof cObj != "undefined") {
			cObj.innerHTML = this.html();
		}
	}
}

if(typeof omega.wmpObject == "undefined") {
	omega.wmpObject = function(swf, id, w, h, ver, c) {
		if (!document.getElementById) { return; }
		this.id			= "wmpMovie";
        this.height		= "100%";
        this.width		= "100%";
        this.showcontrols	= "true";
		this.uimode		= "none";
		this.autostart	= "true";
		this.url		= "";
		this.windowless	= "false";
		this.menu		= "false";
		this.volume		= "100";
	}

	omega.wmpObject.prototype.html = function() {
		var wmpNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			wmpNode =
			"<embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/\" " +
			"id=\"" + this.id + "\" " +
			"name=\"" + this.id + "\" " +
			"width=\"" + this.width + "\" " +
			"height=\"" + this.height + "\" " +
			"src=\"" + this.url + "\" " +
			"filename=\"" + this.url + "\" " +
			"autostart=\"" + this.autostart + "\" "+
			"uimode=\"" + this.uimode + "\" " +
			"windowlessVideo=\"" + this.windowless + "\" " +
			"enableContextMenu=\"" + this.menu + "\" " +
			"showcontrols=\"" + this.showcontrols + "\" " +
			"showstatusbar=\"" + this.showstatus + "\" " +
			"showdisplay=\"" + this.showdisplay + "\" " +
			"volume=\"" + this.volume + "\" " +
			"autorewind=\"" + this.autorewind + "\" style=\"z-index:-1\"> " +
			"</embed>";
		} else { // IE
			wmpNode =
			"<object type=\"application/x-oleobject\" id=\"" + this.id + "\" name=\"" + this.id + "\" classid=\"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6\" height=\"" + this.height + "\" width=\"" + this.width + "\" style=\"z-index:-1\" >" +
			"<param name=\"uiMode\" value=\"" + this.uimode + "\" />" +
			"<param name=\"autoStart\" value=\"" + this.autostart + "\" />" +
			"<param name=\"URL\" value=\"" + this.url + "\" />" +
			"<param name=\"windowlessVideo\" value=\"" + this.windowless + "\" />" +
			"<param name=\"enableContextMenu\" value=\"" + this.menu + "\" />" +
			"<param name=\"AllowChangeDisplaySize\" value=\"false\" />" +
			"<param name=\"AnimationAtStart\" value=\"true\" />" +
			"<param name=\"Volume\" value=\"" + this.volume + "\" />" +
			"<param name=\"stretchToFit\" value=\"true\" />" +
			"</object>";
		}
		return wmpNode;
	}
	
	omega.wmpObject.prototype.embed = function(container) {
		cObj	= document.getElementById(container);
		if (typeof cObj != "undefined") {
			cObj.innerHTML = this.html();
		}
	}
}


if(typeof omega.rmpObject == "undefined") {
	omega.rmpObject = function() {
		if (!document.getElementById) { return; }
		this.codebase	= "";
		this.width		= "100%";
		this.height		= "100%";
		this.pluginspage= "";
		this.align		= "middle";
		this.console	= "radio";
		this.controls	= "imagewindow";
		this.url		= "";
		this.autostart	= "true";
	}
	
	omega.rmpObject.prototype.html = function() {
		var rmpNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			var rmpNode =
			"<embed type=\"audio/x-pn-realaudio-plugin\" pluginspage=\"\" " +
			"width=\"" + this.width + "\" " +
			"height=\"" + this.height + "\" " +
			"id=\"" + this.id + "\" " +
			"name=\"" + this.id + "\" " +
			"align=\"" + this.align + "\" " +
			"console=\"" + this.console + "\" " +
			"controls=\"" + this.controls + "\" " +
			"autostart=\"" + this.autostart + "\" " +
			"src=\"" + this.url + "\" " +
			" />";
		}
		else { // IE
			var rmpNode =
			"<object classid=\"clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA\" codebase=\"\" width=\"" + this.width + "\" height=\"" + this.height + "\" id=\"" + this.id + "\" name=\"" + this.id + "\" align=\"" + this.align + "\">" +
			"<param name=\"console\" value=\"" + this.console + "\" />" +
			"<param name=\"controls\" value=\"" + this.controls + "\" />" +
			"<param name=\"autostart\" value=\"" + this.autostart + "\" />" +
			"<param name=\"src\" value=\"" + this.url + "\" />" +
			"</object>";
		}
		return rmpNode;
	}
	
	omega.rmpObject.prototype.embed = function(container) {
		cObj	= document.getElementById(container);
		if (typeof cObj != "undefined") {
			cObj.innerHTML = this.html();
		}
	}
}


if(typeof omega.cleanupOBJs == "undefined") {
	/* fix for video streaming bug */
	omega.cleanupOBJs = function() {
		if (window.opera || !document.all) return;
		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(){};
				}
			}
		}
	}
}

if(typeof omega.prepUnload == "undefined") {
	// bug fix for fp9 - http://blog.deconcept.com/2006/07/28/swfobject-143-released/
	omega.prepUnload = function() {
		__flash_unloadHandler = function(){};
		__flash_savedUnloadHandler = function(){};
		if (typeof window.onunload == 'function') {
			var oldUnload = window.onunload;
			window.onunload = function() {
				omega.cleanupOBJs();
				oldUnload();
			}
		} else {
			window.onunload = omega.cleanupOBJs;
		}
	}
}

if (typeof window.onbeforeunload == 'function') {
	var oldBeforeUnload = window.onbeforeunload;
	window.onbeforeunload = function() {
		omega.prepUnload();
		oldBeforeUnload();
	}
} else {
	window.onbeforeunload = omega.prepUnload;
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
