var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 0 && navigator.userAgent.indexOf('Mac') < 0 ? 1 : 0;
var isIEMac = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Mac') > -1 ? 1 : 0;
var isMac = navigator.userAgent.toLowerCase().indexOf('mac') > -1 ? 1 : 0;
var isWin = navigator.userAgent.toLowerCase().indexOf('win') > -1 ? 1 : 0;
var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
var isSa = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') > 1 ? 1 : 0;
var isFF = navigator.userAgent.indexOf("Firefox/") > -1 ? 1 : 0;
var isDHTML = (document.getElementById || document.all || document.layers);

function scrollLayer(id, amount, time)
{
	var clipTop, clipBottom, topper;
	
	if (!isDHTML) 
		return;
		
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function getQueryString(params) {
	var variablePairs = new Array();
	for (var name in params) { 
    	if(name != "removeItems")
    	{
    		variablePairs.push(name + "=" + escape(params[name])); 
    	}
	}
	return (variablePairs.length > 0) ? variablePairs.join("&"):false;
}

//Cookies
var cookies = new Object();
function extractCookies()
{
	var name, value;
	var beginning, middle, end;
	for (name in cookies)
	{
		cookies = new Object();
		break;
	}
	beginning = 0;
	while (beginning < document.cookie.length)
	{
		middle = document.cookie.indexOf('=', beginning);
		end = document.cookie.indexOf(';', beginning);
		if (end == -1)
		end = document.cookie.length;
		if ( (middle > end) || (middle == -1) )
		{
		name = document.cookie.substring(beginning, end);
		value = "";
		}
		else
		{
			name = document.cookie.substring(beginning, middle);
			value = document.cookie.substring(middle + 1, end);
		}
		cookies[name] = unescape(value);
		beginning = end + 2;
	}
}
document.cookie = "cookiesenabled=true";
extractCookies();
	
//Macromedia
// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
//
// Accepts a variable number of arguments, in triplets as follows:
// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: ignored (for backward compatibility)
// arg 3: 'hide' or 'show'
// repeat...
//
// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}
function writeLayer(ID,parentID,sText)
{ 
	if (document.layers) 
	{ 
		var oLayer; 
		if(parentID)
		{ 
			oLayer = eval('document.' + parentID + '.document.' + ID + '.document'); 
		}
		else
		{ 
			oLayer = document.layers[ID].document; 
		} 
		oLayer.open(); 
		oLayer.write(sText); 
		oLayer.close(); 
	}
	else
	{
		var o = findObj(ID);
		if(o != null)
		{
			o.innerHTML = sText;
		}
	}
}

//OTHER
/*
a 
defines the action you want the function to perform. 
o 
the object in question. 
c1 
the name of the first class 
c2 
the name of the second class 
Possible actions are:

swap 
replaces class c1 with class c2 in object o. 
add 
adds class c1 to the object o. 
remove 
removes class c1 from the object o. 
check 
test if class c1 is already applied to object o and returns true or false. 
*/
function jscss(a,o,c1,c2)
{
  switch (a){
    case 'swap':
      o.className=!jscss('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
    break;
    case 'add':
      if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className);
    break;
  }
}

function setFullScreen()
{
	try
	{
	    window.moveTo(0,0);
		if(document.all) 
		{ 
  			window.resizeTo(screen.availWidth,screen.availHeight); 
		} 
		else if(document.layers || document.getElementById) 
		{ 
  			if(window.outerHeight < self.screen.availHeight || window.outerWidth < self.screen.availWidth)
			{ 
				window.outerHeight = self.screen.availHeight; 
				window.outerWidth = self.screen.availWidth; 
			} 
		}
	}
	catch(ex)
	{
	}
}

function calcTime(date1, date2)
{
	var diff  = new Date();
	var timediff = 0;
	
	diff.setTime(Math.abs(date1.getTime() - date2.getTime()));

	timediff = diff.getTime();

	var weeks = Math.floor(timediff / (1000 * 60 * 60 * 24 * 7));
	timediff -= weeks * (1000 * 60 * 60 * 24 * 7);

	var days = Math.floor(timediff / (1000 * 60 * 60 * 24)); 
	timediff -= days * (1000 * 60 * 60 * 24);

	var hours = Math.floor(timediff / (1000 * 60 * 60)); 
	timediff -= hours * (1000 * 60 * 60);

	var mins = Math.floor(timediff / (1000 * 60)); 
	timediff -= mins * (1000 * 60);

	var secs = Math.floor(timediff / 1000); 
	timediff -= secs * 1000;
}

function detectRealPlayer()
{
	var wmpInfo = {
		installed: false,
		scriptable: false,
		type: null,
		versionInfo: null
	};
	//var rp = "rmocx.RealPlayer G2 Control.1";
	var rp1 = "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)";
	var rp2 = "rmocx.RealPlayer G2 Control";
	if((window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) || window.GeckoActiveXObject)
	{
		//alert("");
		wmpInfo.type = "ActiveX";
		var player = null;
		player = createActiveXObject(rp1);
		if(player == null)
		{
			//alert("Real player not installed");
			player = createActiveXObject(rp2);
		}
		
		if(player != null)
		{
			//alert("Real player G2 not installed");
			wmpInfo.installed = true;
			wmpInfo.scriptable = true;
			try
			{
				wmpInfo.versionInfo = player.GetVersionInfo();
			}
			catch(e)
			{
				wmpInfo.versionInfo = "6";
			}
			
			player = null;
		}
		else if(navigator.plugins != null)
		{
			//alert("Real player G2 not installed");
			numPlugins = navigator.plugins.length;
			for (i = 0; i < numPlugins; i++)
			{
  				plugin = navigator.plugins[i];
  				if (plugin.name.substring(0,10)=="RealPlayer")
  				{
    				//alert("You have the RealPlayer Plug-in installed!")
    				wmpInfo.installed = true;
					wmpInfo.versionInfo = "G2";
    				break;
  				}
			}
		}
		else
		{
			wmpInfo.versionInfo = "none";
		}
	}
	else if(navigator.mimeTypes)
	{
		wmpInfo.type = "NetscapePlugin";
		
		var player = navigator.mimeTypes['applicationvnd.rn-realmedia'].enabledPlugin;
		if(player)
		{	
			wmpInfo.installed = true;
			//wmpInfo.scriptable = false;
			wmpInfo.versionInfo = "PluginVersion";
			player = null;
		}
	}
	
	return wmpInfo;
}
function detectWMP()
{
	var wmpInfo = {
		installed: false,
		scriptable: false,
		type: null,
		versionInfo: null
	};
	var wmp64 = "MediaPlayer.MediaPlayer.1";
	var wmp7 = "WMPlayer.OCX.7";
	if((window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) || window.GeckoActiveXObject)
	{
		wmpInfo.type = "ActiveX";
		var player = createActiveXObject(wmp7);
		if(player)
		{
			wmpInfo.installed = true;
			wmpInfo.scriptable = true;
			wmpInfo.versionInfo = player.versionInfo;
			//player = null;
			return wmpInfo;
		}
		else
		{
			player = createActiveXObject(wmp64);
			if(player)
			{
				wmpInfo.installed = true;
				wmpInfo.scriptable = true;
				wmpInfo.versionInfo = "6.4";
				//player = null;
				return wmpInfo;
			}
			else
			{
				if(!isIE)
				{
					var numPlugins = navigator.plugins.length;

					for (var i = 0; i < numPlugins; i++) {
						if (navigator.plugins[i].name.substring(0,20)=="Windows Media Player") {
							wmpInfo.type = "NetscapePlugin";
							wmpInfo.installed = true;
							wmpInfo.versionInfo = "7.0";
							break;
						}
					}
				}
				else
				{
					wmpInfo.versionInfo = "none";
				}
				
				return wmpInfo;
			}
		}
	}
	else if(navigator.mimeTypes)
	{
		wmpInfo.type = "NetscapePlugin";
		var player = navigator.mimeTypes['application/x-mplayer2'].enabledPlugin;
		if(player)
		{	
			
			wmpInfo.installed = true;
			//wmpInfo.scriptable = false;
			wmpInfo.versionInfo = "PluginVersion";
			return wmpInfo;
		}
		//player = null;
		return wmpInfo;
	}
}
function createActiveXObject(id)
{
  var error;
  var control = null;

  try
  {
    if (window.ActiveXObject)
    {
      control = new ActiveXObject(id);
    }
    else if (window.GeckoActiveXObject)
    {
      control = new GeckoActiveXObject(id);
    }
  }
  catch (error)
  {
    ;
  }
  return control;
}

function getMediaFormat(url)
{
	var format = null;
	if(url != null)
	{
		var ext = url.substring(url.lastIndexOf("."));
		switch(ext)
		{
			case ".wmv":
			case ".wma":
			case ".asx":
			case ".asf":
			{
				format = "WindowsMedia";
				break;
			}
			case ".rm":
			case ".smi":
			{
				format = "RealMedia";
				break;
			}
			case ".swf":
			case ".flv":
			{
				format = "Flash";
				break;
			}
		}
	}
	return format;
}
function getMediaPlayerFromUrl(url)
{
	var x = null;
	if(url != null)
	{
		var ext = url.substring(url.lastIndexOf("."));
		switch(ext)
		{
			case ".wmv":
			case ".wma":
			case ".asx":
			case ".asf":
			{
				x = "wmp";
				break;
			}
			case ".rm":
			case ".smi":
			{
				x = "rp";
				break;
			}
			case ".swf":
			case ".flv":
			{
				x = "fp";
				break;
			}
		}
	}
	return x;
}

function toSeconds(time)
{
	//hh:mm:ss or mm:ss
	var h = 0;
	var m = 0;
	var s = 0;
	var t = time.split(":");
	if(t.length == 3)
	{
		if(t[0].substring(0,1) == "0")
		{
			t[0] = t[0].substring(1);
		}
		h = parseInt(t[0]);
		
		if(t[1].substring(0,1) == "0")
		{
			t[1] = t[1].substring(1);
		}
		m = parseInt(t[1]);
		
		if(t[2].substring(0,1) == "0")
		{
			t[2] = t[2].substring(1);
		}
		s = parseInt(t[2]);
	}
	else if(t.length == 2)
	{
		if(t[0].length > 1 && t[0].substring(0,1) == "0")
		{
			t[0] = t[0].substring(1);
		}
		m = parseInt(t[0]);
		
		if(t[1].substring(0,1) == "0")
		{
			t[1] = t[1].substring(1);
		}
		s = parseInt(t[1]);
	}
	
	return h*3600+m*60+s;
}
	
function isClass(object, className) {
	return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
}

function getElementsWithClassName(elementName,className) {
	var allElements = document.getElementsByTagName(elementName);
	var elemColl = new Array();
	for (i = 0; i< allElements.length; i++) {
		if (isClass(allElements[i], className)) {
			elemColl[elemColl.length] = allElements[i];
		}
	}
	return elemColl;
}

function getElementsByClassName(obj,className) {
	var allElements = obj.childNodes;
	var elemColl = new Array();
	for (var i = 0; i< allElements.length; i++) {
		if (allElements[i].className == className) 
		{
			elemColl[elemColl.length] = allElements[i];
		}
	}
	return elemColl;
}

function getChildElementsByName(object, name)
{
	//alert(name);
	name = name ? name.toLowerCase() : "div";
	var o = object.childNodes;
	var c = new Array();
	if(o != null)
	{
		for(var i=0; i<o.length;i++)
		{
			if(o[i].nodeName.toLowerCase() == name)
			{
				c.push(o[i]);
			}
		}
	}
	return c;
}

function getMaxHeight(o)
{
	var h = o.offsetHeight;
	var c = o.childNodes.firstChild;
	for(var i=0; i<o.childNodes.length; i++)
	{
		if(o.childNodes[i].offsetHeight > h)
			h = o.childNodes[i].offsetHeight;
	}
	return h;
}

function getStyle(el, style) {
	if(!document.getElementById) 
		return;
    var value = el.style[toCamelCase(style)];
    if(!value)
    {
        if(document.defaultView)
        {
            value = document.defaultView.getComputedStyle(el, "").getPropertyValue(style);
        }
        else if(el.currentStyle)
        {
            value = el.currentStyle[toCamelCase(style)];
        }
     }
     return value;
}

/** toCamelCase(input)
 * Converts string input to a camel cased version of itself.
 * For example:
 * toCamelCase("z-index"); // returns zIndex
 * toCamelCase("border-bottom-style"); // returns borderBottomStyle.
 */
function toCamelCase( sInput ) {
    var oStringList = sInput.split('-');
    if(oStringList.length == 1)    
        return oStringList[0];
    var ret = sInput.indexOf("-") == 0 ? 
    	oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
    for(var i = 1, len = oStringList.length; i < len; i++){
        var s = oStringList[i];
        ret += s.charAt(0).toUpperCase() + s.substring(1);
    }
    return ret;
}

// file: pagequery_api.js
// javascript query string parsing utils
// pass location.search to the constructor: var page = new PageQuery(location.search)
// get values like: var myValue = page.getValue("param1") etc.
// djohnson@ibsys.com {{djohnson}}
// you may use this file as you wish but please keep this header with it thanks

function PageQuery(q) {
	q = q ? q : location.search;
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return null;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }	
}
/*
Object.prototype.addListener = function(o)
{
	if(this._listeners == null)
		this._listeners = [];
	if(o != null)
	{
		this._listeners.push(o);
	}
};
Object.prototype.sendEvent = function(obj, command, arg1, arg2)
{
	if(command != null)
	{
		for(var i=0; i<this._listeners.length; i++)
		{
			if(this._listeners[i][command] != null && arg1 != null)
			{
				this._listeners[i][command](obj, arg1);
			}
			else if(this._listeners[i][command] != null && arg2 != null)
			{
				this._listeners[i][command](obj,arg1,arg2);
			}
		}
	}
};
*/
// Implement function.apply for browsers which don't support it natively
// Courtesy of Aaron Boodman - http://youngpup.net
if (!Function.prototype.apply) {
      Function.prototype.apply = function(oScope, args) {
		    var sarg = [];
		    var rtrn, call;
		
		    if (!oScope) oScope = window;
		    if (!args) args = [];
		
		    for (var i = 0; i < args.length; i++) {
		            sarg[i] = "args["+i+"]";
		    }
		
		    call = "oScope.__applyTemp__(" + sarg.join(",") + ");";
		
		    oScope.__applyTemp__ = this;
		    rtrn = eval(call);
		    oScope.__applyTemp__ = null;
		    return rtrn;
      }
}

/*
 * EventManager.js
 * by Keith Gaughan <kmgaughan@eircom.net>
 *
 * This allows event handlers to be registered unobtrusively, and cleans
 * them up on unload to prevent memory leaks.
 *
 * Copyright (c) Keith Gaughan, 2005.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * (CPL) which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/cpl.php
 *
 * This software is covered by a modified version of the Common Public License
 * (CPL), where Keith Gaughan is the Agreement Steward, and the licensing
 * agreement is covered by the laws of the Republic of Ireland.
 */

// For implementations that don't include the push() methods for arrays.
if (!Array.prototype.push)
{
	Array.prototype.push = function(elem)
	{
		this[this.length] = elem;
	}
}

var EventManager =
{
	_registry: null,

	Initialise: function()
	{
		if (this._registry == null)
		{
			this._registry = [];

			// Register the cleanup handler on page unload.
			EventManager.Add(window, "unload", this.CleanUp);
		}
	},

	/**
	 * Registers an event and handler with the manager.
	 *
	 * @param  obj   Object handler will be attached to.
	 * @param  type  Name of event handler responds to.
	 * @param  fn    Handler function.
	 *
	 * @return True if handler registered, else false.
	 */
	Add: function(obj, type, fn)
	{
		this.Initialise();

		// If a string was passed in, it's an id.
		if (typeof obj == "string")
		{
			obj = findObj(obj);
		}
		if (obj == null || fn == null)
		{
			return false;
		}

		// Mozilla/W3C listeners?
		if (obj.addEventListener)
		{
			obj.addEventListener(type, fn, true);
			this._registry.push({obj: obj, type: type, fn: fn});
			return true;
		}

		// IE-style listeners?
		if (obj.attachEvent && obj.attachEvent("on" + type, fn))
		{
			this._registry.push({obj: obj, type: type, fn: fn});
			return true;
		}

		return false;
	},

	/**
	 * Cleans up all the registered event handlers.
	 */
	CleanUp: function()
	{
		for (var i = 0; i < EventManager._registry.length; i++)
		{
			with (EventManager._registry[i])
			{
				// Mozilla/W3C listeners?
				if (obj.removeEventListener)
					obj.removeEventListener(type, fn, false);
				// IE-style listeners?
				else if (obj.detachEvent)
					obj.detachEvent("on" + type, fn);
			}
		}

		// Kill off the registry itself to get rid of the last remaining
		// references.
		EventManager._registry = null;
	}
};

/*
 * FlashObject embed
 * by Geoff Stearns (geoff@deconcept.com, http://www.deconcept.com/)
 *
 * v1.1.0 - 03-31-2005
 *
 * writes the embed code for a flash movie, includes plugin detection
 *
 * Usage:
 *
 *	myFlash = new FlashObject("path/to/swf.swf", "swfid", "width", "height", flashversion, "backgroundcolor");
 *	myFlash.write("objId");
 *
 * for best practices, see:
 *  http://blog.deconcept.com/2005/03/31/proper-flash-embedding-flashobject-best-practices/
 *
 */

var FlashObject = function(swf, id, w, h, ver, c) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver;
	this.align = "middle";

	this.params = new Object();
	this.variables = new Object();

	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.bypassTxt = "<p>Already have Macromedia Flash Player? <a href='?detectflash=false&"+ this.sq +"'>Click here if you have Flash Player "+ this.version +" installed</a>.</p>";
	
	this.color = (c != null)?c:"#ffffff";
	
	//default params
	this.addParam('bgcolor', this.color);
	this.addParam('quality', 'high'); // default to high
	this.doDetect = getQueryParamValue('detectflash');
	
	this.installedVersion = getFlashVersion();
	if(this.installedVersion < this.version)
	{
	    	var updateMessage = "To see this webcast you need to update your flash player. Would you like to download Adobe flash player now?";
		var yes = confirm(updateMessage);
		if(yes)
		{
			window.location.href = "http://www.adobe.com/products/flashplayer/";
		}
	}
}

var FOP = FlashObject.prototype;

FOP.addParam = function(name, value) { this.params[name] = value.toString(); }

FOP.getParams = function() { return this.params; }

FOP.getParam = function(name) { return this.params[name]; }

FOP.addVariable = function(name, value) { this.variables[name] = value; }

FOP.getVariable = function(name) { return this.variables[name]; }

FOP.getVariables = function() { return this.variables; }

FOP.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '\n\t\t<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    return (paramTags == "") ? false:paramTags;
}

FOP.getHTML = function() {
	//alert(navigator.userAgent);
	var isIE = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 0 && navigator.userAgent.indexOf('Mac') < 0 ? 1 : 0;
	var isIEMac = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Mac') > -1 ? 1 : 0;
	var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
	var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
	var isSa = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') > 1 ? 1 : 0;
	
	var flashHTML = "";
	if(isIE && !isIEMac)
	{
		flashHTML += '\n\t<object id="'+this.id+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=' + this.version + ',0,0,0" width="' + this.width + '" height="' + this.height + '" align="' + this.align + '">';
		flashHTML += '\n\t\t<param name="movie" value="' + this.swf + '" />';
		if (this.getParamTags()) {
			flashHTML += this.getParamTags();
		}
		if (this.getVariablePairs() != null) {
			flashHTML += '\n\t\t<param name="flashVars" value="' + this.getVariablePairs() + '" />';
		}
		flashHTML += '\n\t</object>\n';
	}
	else{
		//fix for safari, ignoring parameter tags
		if(isSa && this.getVariablePairs() != null){
			this.swf = this.swf + "?" + this.getVariablePairs();
		}
		
		flashHTML += '\n\t<object id="' + this.id + '" data="' + this.swf + '" type="application/x-shockwave-flash" width="' + this.width + '" height="' + this.height + '" align="' + this.align + '">';
		
		for (var param in this.getParams()) {
			flashHTML += '\n\t\t<param name="' + param + '" value="' + this.getParam(param) + '" />';
		}
		
		//tell flash to use getURL
		//this.addVariable("usefs", "0");
		if (this.getVariablePairs() != null) {
			flashHTML += '\n\t\t<param name="flashVars" value="' + this.getVariablePairs() + '" />';
		}
		flashHTML += '\n\t\t<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />';
		flashHTML += '\n\t</object>\n';
	}
	//alert(flashHTML);
  return flashHTML;	
}

FOP.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) { 
    	variablePairs.push(name + "=" + escape(this.getVariable(name))); 
    }
    return (variablePairs.length > 0) ? variablePairs.join("&"):false;
}

FOP.write = function(elementId) {
	if(detectFlash(this.version) || this.doDetect=='false') {
		if (elementId) 
		{
			var o = document.getElementById(elementId);
			if(o != null)
			{
			    o.innerHTML = this.getHTML();
			}
		} else {
			document.write(this.getHTML());
		}
	} else {
		if (this.redirect != "") {
			document.location.replace(this.redirect);
		} else if (this.altTxt) {
			if (elementId) {
				document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
			} else {
				document.write(this.altTxt +""+ this.bypassTxt);
			}
		}
	}		
}

//detection functions
function getFlashVersion() {
	var flashversion = 0;
	if (navigator.plugins && navigator.mimeTypes.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			var y = x.description;
			var z = 1;
			for(var i=y.indexOf('.'); i>0; i--){
			    if(y.charAt(i) == ' '){
			        z = i+1;
			        break;
			    }
			}
			flashversion = parseInt(y.substring(z, y.indexOf('.')));
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	return flashversion;
}

function detectFlash(ver) {	return (getFlashVersion() >= ver) ? true:false; }

//get value of query string param
function getQueryParamValue(param) {
	var q = document.location.search || document.location.href.split("#")[1];
	if (q) {
		var detectIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", detectIndex) > -1) ? q.indexOf("&", detectIndex) : q.length;
		if (q.length > 1 && detectIndex > -1) {
			return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
		} else {
			return "";
		}
	}
}

//add Array.push if needed
if(Array.prototype.push == null)
{
	Array.prototype.push = function(item) { this[this.length] = item; return this.length; }
}

