////////////
////////////
////////////
////////////
//////////// PLAYER/FLASH/QT SYNC
////////////
////////////
////////////
////////////
if (idCount === undefined || isNaN(idCount)) {
	var idCount = 0;
	var PPwin;
}
//PROXY URL FOR XML FEEDS
var feedProxyURL = "http://www.gotcool.com/Podtrac/proxy.php?url=-";
//PROXY URL FOR MP3s
var mp3ProxyURL = "";//"http://www.gotcool.com/Podtrac/proxy.php?ext=mp3&url=-";
//PROXY URL FOR FLVs
var flvProxyURL = "";//"http://www.gotcool.com/Podtrac/proxy.php?ext=flv&url=-";
//PAGE FOR POP UP PLAYERS
var popUpURL = "http://www.gotcool.com/Podtrac/PodtracPlayer.php";
//SWF URL
var swfURL = "http://www.gotcool.com/Podtrac/PodtracPlayer.swf";
//IPHONE PAGE URL
var iPhoneURL = "http://www.gotcool.com/Podtrac/iPhone.php?feedURL=-";
//EXPRESS INSTALL URL (optional)
var expressInstallURL = "http://www.gotcool.com/Podtrac/expressInstall.swf";
//removes outline in FF3
document.write("<style type='text/css' media='screen'>object { outline:none; }</style>");
function drawQT(path, videoWidth, videoHeight, playerID) {
	clearQT(playerID);
	if (videoHeight < 1)
		videoHeight = 2;
	var qtSource = QT_GenerateOBJECTText(path, videoWidth, videoHeight, '',
										'name', 'qtMovie'+playerID,
										'obj#id', 'qtMovie'+playerID,
										'emb#id', 'qtMovie'+playerID+'Embed',
										'autoplay', 'false',
										'scale', 'aspect',
										'controller', 'false',
										'bgcolor', '#000000',
										'enablejavascript', 'true')
	findItem('qtLayer'+playerID).innerHTML = "<div id='qtHolder"+playerID+"'>"+qtSource+"</div>";
}
function sendPingback(htmlBox, feedURL, mode, playerID, width, height) {
	var url = "http://player.podtrac.com/tracker.aspx?feedURL="+feedURL+"&mode="+mode+"&num="+playerID+"&width="+width+"&height="+height+"&time="+new Date().getTime();
	htmlBox.innerHTML += "<img src=\""+url+"\" style=\"display: none\"/>";
}
function clearQT(playerID) {
	if (findItem('qtHolder'+playerID)) {
		var qtMovie = checkQT(playerID);
		if (qtMovie)
			qtMovie.Stop();
		findItem('qtLayer'+playerID).innerHTML = "";
	}
}
function clearOtherPlayers(playerID) {
	for (var i = 1; i <= idCount; i++) {
		if (i != playerID) {
			var fPlayer = findItem('fPlayer'+i);
			if (fPlayer)
				fPlayer.flashPause();
		}
	}
}
function setPosition(seconds, playerID) {
	var qtMovie = checkQT(playerID);
	if (qtMovie) {
		qtMovie.SetTime(seconds*qtMovie.GetTimeScale());
		return qtMovie.GetTime()/qtMovie.GetTimeScale();
	}
}
function setVolume(percent, playerID) {
	var qtMovie = checkQT(playerID);
	if (qtMovie) {
		qtMovie.SetVolume(percent*256);
		return qtMovie.GetVolume()/256;
	}
}
function playMovie(playerID) {
	var qtMovie = checkQT(playerID);
	if (qtMovie) {
		qtMovie.Play();
		return qtMovie.GetRate();
	}
}
function pauseMovie(playerID) {
	var qtMovie = checkQT(playerID);
	if (qtMovie) {
		qtMovie.Stop();
		return qtMovie.GetRate();
	}
}
function sendFlashData(playerID) {
	qtInfo = false;
	var qtMovie = checkQT(playerID);
	if (qtMovie) {
		qtInfo = new Object();
		qtInfo.position = qtMovie.GetTime()/qtMovie.GetTimeScale();
		qtInfo.loaded = qtMovie.GetMaxTimeLoaded()/qtMovie.GetTimeScale();
		qtInfo.duration = qtMovie.GetDuration()/qtMovie.GetTimeScale();
		qtInfo.volume = qtMovie.GetVolume()/256;
		qtInfo.playing = qtMovie.GetRate();
		qtInfo.status = qtMovie.GetPluginStatus();
	}
	return qtInfo;
}
function flashNewMedia(mediaID, playerID) {
	var fPlayer = findItem('fPlayer'+playerID);
	if (fPlayer)
		fPlayer.flashNewMedia(mediaID);
}
function checkQT(playerID) {
	var qtMovie = findItem('qtMovie'+playerID);
	if (qtMovie) {
		if ("GetPluginStatus" in qtMovie)
			return qtMovie;
		else
			return false;
	} else
		return false;
}
function newPPWin(url, target, page, widthP, heightP, scrollbarP) {
	var width = 0;
	var height = 0;
	var scrollbar = 0;
	var resizable = 1;
	switch (page) {
		case "help":
			width = 300;
			height = 350;
			scrollbar = 1;
			break;
		case "share":
			width = 750;
			height = 550;
			scrollbar = 1;
			break;
		case "subscribe":
			width = 250;
			height = 350;
			break;
		case "iphone":
			width = 300;
			height = 600;
			scrollbar = 1;
			break;
		default:
			width = widthP;
			height = heightP;
			scrollbar = scrollbarP;
			resizable = 0;
			break;
	}
	var winID = window.open(url, target, "width="+width+",height="+height+",scrollbars="+scrollbar+",resizable="+resizable+",status=0,toolbar=0,location=0,locationbar=0,titlebar=0,directories=0,menubar=0");
	winID.focus();
	return winID;
}
function drawPodtracPlayer(params) {
	//params holds an object {name: val, name: val, name: val, etc..}
	//I suggest placing single quotes around all values (even numbers) to keep things consistant
	//It is important to use 1 or 0 for true or false values respectively to ensure javascript doesn't confuse 'false' for a string and return true;
	//
	//feedURL: the URL of the feed, generally should be URI encoded, but will work with the majority of feed URLs without being encoded (no default, required)
	//videoWidth: the width of the video area in the player (default 448)
	//videoHeight: the height of the video area in the player (default 336)
	//player: the type of player, either "customer" (default), "ad", "opml", or "single"
	//-----These next 6 parameters are only used with a single player.  This data is necessary since the feed can't be relied on for it.
	//-----fileURL: the URL of the file for a single player (not required for streaming file)
	//-----streamFilename: the file name (no path, just file name, no .flv) of a streaming file for a single player (not required for progressive file)
	//-----streamServer: the server url (rtmp://) of a streaming file for a single player (not required for progressive file)
	//-----mime: the mime type of the file for a single player
	//-----title: the title of the episode for a single player
	//-----image: the image url for a single player
	//embed: either 0 (default, player embedded where code is) or 1 (player launched in a pop up)
	//autoPlay: either 1 (media plays when the player loads) or 0 (default, player waits for user input)
	//itemNum: used for the "ad" player, this specifies the item to be played based on the order of the episodes in top-down order.  ie 0 will use the data from the first set of <item> tags, 1 the second, and so on... (default is 0)
	//titleBar: either 1 (default, show the top title bar) or 0 (hide the bar)
	//uiColor: the general UI color in 0xFFFFFF format (default 0x173364)
	//visualPref: (currently obsolete)
	//mode: this number tracks the iterations the player has gone through via the share page (default is 1)
	//customID: this number is to tell the script to draw the player in pre-written <div> tags. ie 999 would attempt to draw the player in the <div id="podtracPlayer999"></div> tags instead of where the code is written (default is incremented automatically starting at 1); 
	
	//check if the user defined the videoWidth and videoHeight, if not define them default values, if so make sure they're in reasonable limits
	if ("videoWidth" in params)

		params.videoWidth = Math.max(210, Math.min(1200, params.videoWidth));
	else
		params.videoWidth = 448;
	if ("videoHeight" in params)
		params.videoHeight = Math.max(0, Math.min(900, params.videoHeight));
	else
		params.videoHeight = 336;
	if (!("mode" in params))
		params.mode = 1;
	//get the appropriate width and height for the flash object/popup window
	var fPlayerW = params.videoWidth;
	var fPlayerH = Number(params.videoHeight)+58;
	if (params.player == "opml")
		fPlayerH += 70;
	if (params.titleBar != 0) {
		fPlayerH += 25;
		if (params.player == "opml")
			fPlayerH += 25;
	}
	if (params.player != "single" )
		fPlayerH += 70;
	if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/blackberry/i) || navigator.userAgent.match(/nokia/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/Windows CE/i) || navigator.userAgent.match(/MOT/i)) { //if this is an iphone/ipod
		if (params.embed != 0) {//if it's an embed
			document.write("<table width='"+fPlayerW+"' height='"+fPlayerH+"' cellpadding='0' cellspacing='0'><tr><td align='center'>");
			var latestRatio = 370/57;
			var allRatio = 370/27;
			if (params.player == "single") {//single player
				document.write("<div align='left' style='position: relative' onClick=\"JavaScript:window.location.href='"+decodeURIComponent(params.fileURL)+"'\">");
				document.write("<img src='http://www.gotcool.com/Podtrac/iPhoneGraphics/button_singleplay_full.png' width='"+fPlayerW+"' height='"+(fPlayerW/latestRatio)+"' border='0'><br>");
				document.write("<table style='position: absolute; width: "+(fPlayerW-fPlayerW/370*60-5)+"; height: "+(fPlayerW/latestRatio)+"; top: 0; left: "+(fPlayerW/370*60)+"; color: #fff; font-family: Verdana; font-size: 11px' cellpadding='0' cellspacing='0'><tr><td valign='middle'><b>"+decodeURIComponent(params.title)+"</b></tr></td></table></div>");
			} else if (params.player == "opml")//opml player
				document.write("<a href='"+iPhoneURL+params.feedURL+"'><img src='http://www.gotcool.com/Podtrac/iPhoneGraphics/button_viewepisodes.png' width='"+fPlayerW+"' height='"+(fPlayerW/allRatio)+"' border='0'></a>");
			else
				document.write("<table cellspacing='2' cellpadding='0'><tr><td><a href='"+iPhoneURL+params.feedURL+"&playEpisode=0'><img src='http://www.gotcool.com/Podtrac/iPhoneGraphics/button_currentepisode.png' width='"+fPlayerW+"' height='"+(fPlayerW/latestRatio)+"' border='0'></a></td></tr><tr><td align='center'><a href='"+iPhoneURL+params.feedURL+"'><img src='http://www.gotcool.com/Podtrac/iPhoneGraphics/button_viewepisodes.png' width='"+fPlayerW+"' height='"+(fPlayerW/allRatio)+"' border='0'></a></tr></td></table>");
			document.write("</td></tr></table>");
		} else if (params.player == "single")//single player, send to exact file for safari's QT player to play
			window.location.href = decodeURIComponent(params.fileURL);
		else //pop up, non-single player, send to the iphone page
			window.location.href = iPhoneURL+params.feedURL;
	} else if (params.embed != 0) {//embed and not iphone/ipod
		var idToUse;
		//set idToUse to the customID defined in the parameters, or use the default incremented one
		if ("customID" in params)
			idToUse = params.customID;
		else {
			idCount++;
			idToUse = idCount;
			document.write("<div id='podtracPlayer"+idToUse+"'></div>");
		}
		//write HTML where the player lies
		findItem('podtracPlayer'+idToUse).style.position = "relative";
		findItem('podtracPlayer'+idToUse).style.backgroundColor = "#FFF";
		sendPingback(findItem('podtracPlayer'+idToUse), params.feedURL, params.mode, idToUse, params.videoWidth, params.videoHeight);
		findItem('podtracPlayer'+idToUse).innerHTML = "<div id='flQtHolder"+idToUse+"' style='position:relative; background-color: #000000'><div id='fPlayerHolder"+idToUse+"' style='position:absolute; left:0; top:0'><div id='fPlayer"+idToUse+"'></div></div><div id='qtLayer"+idToUse+"' style='position:relative; left:0; top:0'></div></div>";
		//if (params.FBComments) {
			//findItem('podtracPlayer'+idToUse).innerHTML += "<fb:comments width=\""+fPlayerW+"\" xid=\""+params.feedURL+"\"></fb:comments>";
			//FB.init("916572ad739c54d534a022cfb3095e1f", "http://www.gotcool.com/Podtrac/facebook/FB/xd_receiver.htm");
		//}
		//draw flash object and send flash variables, nocache keeps IE from caching the swfs
		var paramOb = new Object();
		paramOb.feedProxy = encodeURIComponent(feedProxyURL);
		paramOb.mp3Proxy = encodeURIComponent(mp3ProxyURL);
		paramOb.flvProxy = encodeURIComponent(flvProxyURL);
		paramOb.playerID = encodeURIComponent(idToUse);
		for (var i in params)
			paramOb[i] = encodeURIComponent(params[i]);
		swfobject.embedSWF(swfURL+"?nocache="+Math.random(), "fPlayer"+idToUse, fPlayerW, fPlayerH, "9.0.0", expressInstallURL, paramOb, {flashvars:"true", allowscriptaccess:"always", wmode:"transparent", allowfullscreen:"true"});
		findItem('podtracPlayer'+idToUse).style.width = fPlayerW+"px";
		findItem('flQtHolder'+idToUse).style.height = fPlayerH+"px";
		findItem('qtLayer'+idToUse).style.top = (params.player == "opml" ? 70: 0)+(params.titleBar != 0 ? 25+(params.player == "opml" ? 25 : 0) : 0)+"px";
	} else {
		//if the same player is already open, close it
		if (PPwin)
			PPwin.close();
		//this is the string appended to the pop up player URL to get the variables there
		var urlString = "?";
		for (var i in params)
			if (i != "embed")
				urlString += i+"="+(i == "feedURL" || i == "fileURL" || i == "image" ? "-" : "")+encodeURIComponent(params[i])+"&";
		urlString = urlString.substr(0, urlString.length-1);
		//launch the window
		PPwin = newPPWin(popUpURL+urlString, "_blank", "", fPlayerW, fPlayerH, 0);
	}
}
function clearPodtracPlayer(playerID) {
	if (PPwin)
		PPwin.close();
	if (findItem('podtracPlayer'+playerID)) {
		clearQT(playerID);
		if (findItem('fPlayer'+playerID))
			swfobject.removeSWF('fPlayer'+playerID);
		findItem('podtracPlayer'+playerID).innerHTML = "";
		findItem('podtracPlayer'+playerID).style.width = "auto";
		findItem('podtracPlayer'+playerID).style.height = "auto";
	}
}
////////////
////////////
////////////
////////////
//////////// FIND ITEM (at all costs =p)
////////////
////////////
////////////
////////////
function findItem(itemId) {
	if (window.document[itemId])
	    return window.document[itemId];
  	else if (document[itemId])
		return document[itemId];
	else if (window[itemId])
		return window[itemId];
	else if (document.getElementById(itemId))
		return document.getElementById(itemId);
	else
		return false;	
}
////////////
////////////
////////////
////////////
//////////// QUICKTIME
////////////
////////////
////////////
////////////
/*

File: AC_QuickTime.js

Abstract: This file contains functions to generate OBJECT and EMBED tags for QuickTime content.

Version: <1.1>

Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
Computer, Inc. ("Apple") in consideration of your agreement to the
following terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of these
terms.  If you do not agree with these terms, please do not use,
install, modify or redistribute this Apple software.

In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software. 
Neither the name, trademarks, service marks or logos of Apple Computer,
Inc. may be used to endorse or promote products derived from the Apple
Software without specific prior written permission from Apple.  Except
as expressly stated in this notice, no other rights or licenses, express
or implied, are granted by Apple herein, including but not limited to
any patent rights that may be infringed by your derivative works or by
other works in which the Apple Software may be incorporated.

The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.

IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Copyright © 2006 Apple Computer, Inc., All Rights Reserved

*/ 

/*
 * This file contains functions to generate OBJECT and EMBED tags for QuickTime content. 
 */

/************** LOCALIZABLE GLOBAL VARIABLES ****************/

var gArgCountErr =	'The "%%" function requires an even number of arguments.'
				+	'\nArguments should be in the form "atttributeName", "attributeValue", ...';

/******************** END LOCALIZABLE **********************/

var gTagAttrs				= null;
var gQTGeneratorVersion		= 1.0;

function AC_QuickTimeVersion()	{ return gQTGeneratorVersion; }

function _QTComplain(callingFcnName, errMsg)
{
    errMsg = errMsg.replace("%%", callingFcnName);
	alert(errMsg);
}

function _QTAddAttribute(prefix, slotName, tagName)
{
	var		value;

	value = gTagAttrs[prefix + slotName];
	if ( null == value )
		value = gTagAttrs[slotName];

	if ( null != value )
	{
		if ( 0 == slotName.indexOf(prefix) && (null == tagName) )
			tagName = slotName.substring(prefix.length); 
		if ( null == tagName ) 
			tagName = slotName;
		return '' + tagName + '="' + value + '"';
	}
	else
		return "";
}

function _QTAddObjectAttr(slotName, tagName)
{
	// don't bother if it is only for the embed tag
	if ( 0 == slotName.indexOf("emb#") )
		return "";

	if ( 0 == slotName.indexOf("obj#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("obj#", slotName, tagName);
}

function _QTAddEmbedAttr(slotName, tagName)
{
	// don't bother if it is only for the object tag
	if ( 0 == slotName.indexOf("obj#") )
		return "";

	if ( 0 == slotName.indexOf("emb#") && (null == tagName) )
		tagName = slotName.substring(4); 

	return _QTAddAttribute("emb#", slotName, tagName);
}


function _QTAddObjectParam(slotName, generateXHTML)
{
	var		paramValue;
	var		paramStr = "";
	var		endTagChar = (generateXHTML) ? ' />' : '>';

	if ( -1 == slotName.indexOf("emb#") )
	{
		// look for the OBJECT-only param first. if there is none, look for a generic one
		paramValue = gTagAttrs["obj#" + slotName];
		if ( null == paramValue )
			paramValue = gTagAttrs[slotName];

		if ( 0 == slotName.indexOf("obj#") )
			slotName = slotName.substring(4); 
	
		if ( null != paramValue )
			paramStr = '<param name="' + slotName + '" value="' + paramValue + '"' + endTagChar;
	}

	return paramStr;
}

function _QTDeleteTagAttrs()
{
	for ( var ndx = 0; ndx < arguments.length; ndx++ )
	{
		var attrName = arguments[ndx];
		delete gTagAttrs[attrName];
		delete gTagAttrs["emb#" + attrName];
		delete gTagAttrs["obj#" + attrName];
	}
}

		

// generate an embed and object tag, return as a string
function _QTGenerate(callingFcnName, generateXHTML, args)
{
	// is the number of optional arguments even?
	if ( args.length < 4 || (0 != (args.length % 2)) )
	{
		_QTComplain(callingFcnName, gArgCountErr);
		return "";
	}
	
	// allocate an array, fill in the required attributes with fixed place params and defaults
	gTagAttrs = new Object();
	gTagAttrs["src"] = args[0];
	gTagAttrs["width"] = args[1];
	gTagAttrs["height"] = args[2];
	gTagAttrs["classid"] = "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B";
		//Impportant note: It is recommended that you use this exact classid in order to ensure a seamless experience for all viewers
	gTagAttrs["pluginspage"] = "http://www.apple.com/quicktime/download/";

	// set up codebase attribute with specified or default version before parsing args so
	//  anything passed in will override
	var activexVers = args[3]
	if ( (null == activexVers) || ("" == activexVers) )
		activexVers = "6,0,2,0";
	gTagAttrs["codebase"] = "http://www.apple.com/qtactivex/qtplugin.cab#version=" + activexVers;

	var	attrName,
		attrValue;

	// add all of the optional attributes to the array
	for ( var ndx = 4; ndx < args.length; ndx += 2)
	{
		attrName = args[ndx].toLowerCase();
		attrValue = args[ndx + 1];

		// "name" and "id" should have the same value, the former goes in the embed and the later goes in
		//  the object. use one array slot 
		if ( "name" == attrName || "id" == attrName )
			gTagAttrs["name"] = attrValue;

		else 
			gTagAttrs[attrName] = attrValue;
	}

	// init both tags with the required and "special" attributes
	var objTag =  '<object '
					+ _QTAddObjectAttr("classid")
					+ _QTAddObjectAttr("width")
					+ _QTAddObjectAttr("height")
					+ _QTAddObjectAttr("codebase")
					+ _QTAddObjectAttr("name", "id")
					+ _QTAddObjectAttr("tabindex")
					+ _QTAddObjectAttr("hspace")
					+ _QTAddObjectAttr("vspace")
					+ _QTAddObjectAttr("border")
					+ _QTAddObjectAttr("align")
					+ _QTAddObjectAttr("class")
					+ _QTAddObjectAttr("title")
					+ _QTAddObjectAttr("accesskey")
					+ _QTAddObjectAttr("noexternaldata")
					+ '>'
					+ _QTAddObjectParam("src", generateXHTML);
	var embedTag = '<embed '
					+ _QTAddEmbedAttr("src")
					+ _QTAddEmbedAttr("width")
					+ _QTAddEmbedAttr("height")
					+ _QTAddEmbedAttr("pluginspage")
					+ _QTAddEmbedAttr("name")
					+ _QTAddEmbedAttr("align")
					+ _QTAddEmbedAttr("tabindex");

	// delete the attributes/params we have already added
	_QTDeleteTagAttrs("src","width","height","pluginspage","classid","codebase","name","tabindex",
					"hspace","vspace","border","align","noexternaldata","class","title","accesskey");

	// and finally, add all of the remaining attributes to the embed and object
	for ( var attrName in gTagAttrs )
	{
		attrValue = gTagAttrs[attrName];
		if ( null != attrValue )
		{
			embedTag += _QTAddEmbedAttr(attrName);
			objTag += _QTAddObjectParam(attrName, generateXHTML);
		}
	} 

	// end both tags, we're done
	return objTag + embedTag + '></em' + 'bed></ob' + 'ject' + '>';
}

// return the object/embed as a string
function QT_GenerateOBJECTText()
{
	return _QTGenerate("QT_GenerateOBJECTText", false, arguments);
}

function QT_GenerateOBJECTText_XHTML()
{
	return _QTGenerate("QT_GenerateOBJECTText_XHTML", true, arguments);
}

function QT_WriteOBJECT()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT", false, arguments));
}

function QT_WriteOBJECT_XHTML()
{
	document.writeln(_QTGenerate("QT_WriteOBJECT_XHTML", true, arguments));
}
////////////
////////////
////////////
////////////
//////////// SWFOBJECT
////////////
////////////
////////////
////////////
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();