// Grub - jsAdRotator v 0.9
// Author: amhay
 
// Object NameSpace : Grub
var Grub = new Object();
 
 
/*     ----------     Class Function : SlidingPanels     -----------     */
 
 
// Class Constructor / Load Function()
Grub.SlidingPanels = function(panelContainer, panelGroup, panelIDPrefix, args) {
	this.currentSlide = 0;
	this.panelGroup = panelGroup;
	this.panelIDPrefix = panelIDPrefix;
 
	if (!args) this.slideSpeed = 0.5;
	else {
		if (args.indexOf('speed:') > -1) {
			this.slideSpeed = args.split('speed:')[1];
				this.slideSpeed = parseInt(this.slideSpeed.split(',')[0]);
		}
		else this.slideSpeed = 0.5;
 
		if (args.indexOf('fade:') > -1) {
			this.fade = args.split('fade:')[1];
				this.fade = toBoolean(this.fade.split(',')[0]);
			if (this.fade == true)
				this.slideSpeed = 0.0;
		}
		else this.fade = false;
 
		if (args.indexOf('showCurrent:') > -1) {
			this.showCurrent = args.split('showCurrent:')[1];
				this.showCurrentCSS = this.showCurrent.split(',')[0];
			this.showCurrent = true;
		}
		else this.showCurrent = false;
 
		if (args.indexOf('panelCSS:') > -1) {
			this.panelCSS = args.split('panelCSS:')[1];
				this.panelCSS = this.panelCSS.split(',')[0];
		}
		else this.panelCSS = false;
 
		if (args.indexOf('width:') > -1) {
			this.panelWidth = args.split('width:')[1];
				this.panelWidth = parseInt(this.panelWidth.split(',')[0]);
		}
		else this.panelWidth = $(panelIDPrefix+'0').offsetWidth;
	}
 
	if (this.showCurrent == true)
		changeCurrentCSS(null, this.currentSlide, this.panelIDPrefix, this.showCurrentCSS);
               
	if (this.panelCSS != false)
		this.totalPanels = $$('#'+this.panelGroup+' > div').length - 1;
	else
		this.totalPanels = $(panelGroup).getElementsByTagName('div').length - 1;
}
 
Grub.SlidingPanels.prototype.slideTo = function(elemID) {
	var nextSlide_n = elemID.split(this.panelIDPrefix)[1];
	var slideX = 0 - (this.panelWidth * nextSlide_n);
               
	if (nextSlide_n != this.currentSlide) {
		if (this.fade == true) new Effect.Fade($(this.panelGroup), { duration: 0.5, from: 0, to: 1 });
		new Effect.Move($(this.panelGroup), { x: slideX, y: 0, duration: this.slideSpeed, mode: 'absolute' });
 
		if (this.showCurrent == true)
			changeCurrentCSS(this.currentSlide, nextSlide_n, this.panelIDPrefix, this.showCurrentCSS);
 
		this.currentSlide = nextSlide_n;
	}
}
 
Grub.SlidingPanels.prototype.slideToFirst = function() {
	if (this.currentSlide != 0) {
		if (this.fade == true) new Effect.Fade($(this.panelGroup), { duration: 0.5, from: 0, to: 1 });
		new Effect.Move($(this.panelGroup), { x: 0, y: 0, duration: this.slideSpeed, mode: 'absolute' });
 
		this.currentSlide = 0;
	}
}
 
Grub.SlidingPanels.prototype.slideToLast = function() {
	var slideX = 0 - (this.panelWidth * this.totalPanels);
 
	if (this.currentSlide != this.totalPanels) {
		if (this.fade == true) new Effect.Fade($(this.panelGroup), { duration: 0.5, from: 0, to: 1 });
		new Effect.Move($(this.panelGroup), { x: slideX, y: 0, duration: this.slideSpeed, mode: 'absolute' });
 
		this.currentSlide = this.totalPanels;
	}
}
 
Grub.SlidingPanels.prototype.slideToNext = function() {
	if (this.currentSlide == this.totalPanels)
		var nextSlide_n = 0;
	else
		var nextSlide_n = parseInt(this.currentSlide) + 1;
               
	var slideX = 0 - (this.panelWidth * nextSlide_n);
               
	if (nextSlide_n != this.currentSlide) {
		if (this.fade == true) new Effect.Fade($(this.panelGroup), { duration: 0.5, from: 0, to: 1 });
		new Effect.Move($(this.panelGroup), { x: slideX, y: 0, duration: this.slideSpeed, mode: 'absolute' });
 
		this.currentSlide = nextSlide_n;
	}
}
 
Grub.SlidingPanels.prototype.slideToPrevious = function() {
	if (this.currentSlide == 0)
		var nextSlide_n = this.totalPanels;
	else
		var nextSlide_n = parseInt(this.currentSlide) - 1;
               
	var slideX = 0 - (this.panelWidth * nextSlide_n);
               
	if (nextSlide_n != this.currentSlide) {
		if (this.fade == true) new Effect.Fade($(this.panelGroup), { duration: 0.5, from: 0, to: 1 });
		new Effect.Move($(this.panelGroup), { x: slideX, y: 0, duration: this.slideSpeed, mode: 'absolute' });
 
		this.currentSlide = nextSlide_n;
	}
}
 
function changeCurrentCSS(currentSlide, nextSlide_n, panelIDPrefix, showCurrentCSS) {
	var sender = document.getElementsByTagName('a');
	var css_N = false;
 
	if (showCurrentCSS.charAt(showCurrentCSS.length-1) == '_')
		css_N = true;
 
	for (i = 0; i < sender.length; i++) {
		if (sender[i].onclick && (sender[i].onclick.toString()).indexOf(panelIDPrefix) > -1) {
			if (sender[i].onclick) {
				var onClick = sender[i].onclick.toString();
 
				if (onClick.indexOf(panelIDPrefix + currentSlide) > -1) {
					if (css_N == true)
						$(sender[i].id).removeClassName(showCurrentCSS + currentSlide);
					else
						$(sender[i].id).removeClassName(showCurrentCSS);
				}
			               
				if (onClick.indexOf(panelIDPrefix + nextSlide_n) > -1) {
					if (css_N == true)
						$(sender[i].id).addClassName(showCurrentCSS + nextSlide_n);
					else
						$(sender[i].id).addClassName(showCurrentCSS);
				}
			}
		}
	}
}
 
 
/*     ----------     Class Function : AdRotator     -----------     */
 
// Class Constructor / Load Function()
Grub.AdRotator = function(xml_URL, rotator_Div, rotator_Width, rotator_Height)
{
	// Generates a random iteration of the object
	this.N = Math.floor(Math.random()*101);
 
	// Path location of the XML file to be used
	this.xml_URL	     = new String;
	this.xml_URL	     = xml_URL;
 
	this.rotator_Div	= document.getElementById(rotator_Div);
	this.rotator_Width          = rotator_Width;
	this.rotator_Height         = rotator_Height;
 
	// xml_Request is defined later through a call to getXMLHttpObject()
	var xml_Request;
	var xml_Obj	       = new Object();
               
	// Flash_Capable determines if a browser has flash installed or not
	// Type Integer
	this.flash_Capable;
               
	// Create and initialize array items to contain XML data
	this.items_Name	             = new Array();
	var Names		          = new Array();
 
	this.items_Path		= new Array();
	var Paths		             = new Array();
 
	this.items_Link	 = new Array();
	var Links		               = new Array();
 
	this.items_Alt	    = new Array();   // alt text for imgs
	var Alts		 = new Array();
 
	this.items_Type	               = new Array();   // img or swf
	var Types		             = new Array();
 
	this.items_Seed	               = new Array();   // item weight
	var Seeds		            = new Array();
 
	// Speed of auto rotation feature
	this.timer_Speed;
	var tSpeed;
 
	// Total items in XML document
	this.total_Items;
	var nItems;
 
	// Navigation Control
	// Options are (Numerical), (Numerical, Overlay), (Side)
	this.NavigationType = "Numerical";
 
	// Slider properties
	this.Fade = true;
	this.EffectSpeed = 0.5;
 
	new Ajax.Request(this.xml_URL,
	{
		asynchronous: false,
		method: "get",
		onSuccess: function(transport)
		{
			// Get number of items
			nItems  = transport.responseXML.getElementsByTagName('items')[0].getElementsByTagName('item');
			nItems = nItems.length;
 
			// Get speed
			tSpeed = transport.responseXML.getElementsByTagName('items')[0].getAttribute("speed");
 
			// Grab HTMLCollection for each parameter
			Paths     = transport.responseXML.getElementsByTagName('items')[0].getElementsByTagName('path');
			Links      = transport.responseXML.getElementsByTagName('items')[0].getElementsByTagName('link');
			Alts        = transport.responseXML.getElementsByTagName('items')[0].getElementsByTagName('alt');
			Types    = transport.responseXML.getElementsByTagName('items')[0].getElementsByTagName('type');
			Seeds    = transport.responseXML.getElementsByTagName('items')[0].getElementsByTagName('seed');
		}
	});
	this.total_Items = nItems;
	this.timer_Speed = (tSpeed * 1000);
 
	// Test to see if browser supports flash
	this.flash_Capable = GetSwfVer();
 
	// if flash_Capable returns a false or '-1' then remove all swf instances
	if (this.flash_Capable == -1)
	{
		killSWFs();
	}
 
	for(var i = 0; i < this.total_Items; i++)
	{
		this.items_Path[i]            = Paths[i].text || Paths[i].textContent || Paths[i].innerText;
		this.items_Link[i]             = Links[i].text || Links[i].textContent || Links[i].innerText;
		this.items_Alt[i]               = Alts[i].text || Alts[i].textContent || Alts[i].innerText;
		this.items_Type[i]           = Types[i].text || Types[i].textContent || Types[i].innerText;
		this.items_Seed[i]           = Seeds[i].text || Seeds[i].textContent || Seeds[i].innerText;
	}
}
 
// Method Function : Create()
Grub.AdRotator.prototype.Create = function()
{
	var CSS;
 
	// Create panel_Window div
	var panel_Window = document.createElement("div");
	panel_Window.id = "panel_Window" + this.N;
	CSS = "overflow:hidden;position:relative;width:" + this.rotator_Width + "px;height:" + this.rotator_Height + "px;";
	isIE ? panel_Window.style.setAttribute("cssText", CSS) : panel_Window.setAttribute("style", CSS);
 
 
	// Create panel_Container div
	var panel_Container = document.createElement("div");
	panel_Container.id = "panel_Container" + this.N;
	CSS = "width:" + ((this.rotator_Width * this.total_Items) + this.rotator_Width) + "px;";
	isIE ? panel_Container.style.setAttribute("cssText", CSS) : panel_Container.setAttribute("style", CSS);
 
	// Begin item loop
	for (var i = 0; i < this.total_Items ; i++)
	{
		// For each item create a panel div
		var panel_Item = document.createElement("div");
		panel_Item.id = "panel_" + i;
		CSS = "float:left;width:" + this.rotator_Width + "px;height:" + this.rotator_Height + "px;";
		isIE ? panel_Item.style.setAttribute("cssText", CSS) : panel_Item.setAttribute("style", CSS);
 
		if (this.items_Type[i] == "img")
		{
			// Create an encapsulating link
			var a = document.createElement("a");
			a.setAttribute("href", this.items_Link[i]);
			a.setAttribute("target", "_self");
 
			// Create the image
			var img = document.createElement("img");
			img.setAttribute("src", this.items_Path[i]);
			img.setAttribute("alt", this.items_Alt[i]);
			img.setAttribute("border", 0)
 
			// add image inside link
			a.appendChild(img);
 
			// and linked image into panel
			panel_Item.appendChild(a);
		}
		if (this.items_Type[i] == "swf")
		{
			// Create an encapsulating link
			var object = document.createElement("object");
			object.setAttribute("type", "application/x-shockwave-flash");
			object.setAttribute("data", this.items_Path[i]);
			object.setAttribute("width", this.rotator_Width);
			object.setAttribute("height", this.rotator_Height);
 
			// Create the image
			var param = document.createElement("param");
			param.setAttribute("name", "movie");
			param.setAttribute("value", this.items_Path[i]);
 
			// add image inside link
			object.appendChild(param);
 
			// and linked image into panel
			panel_Item.appendChild(object);
		}
 
		// Add each panel into the panel container
		panel_Container.appendChild(panel_Item);
	}
               
	// Add panel_Container into panel_Window
	panel_Window.appendChild(panel_Container);
               
	// Add panel_Window into rotator_Div
	this.rotator_Div.appendChild(panel_Window);
 
	// Add slider navigation
	if (this.NavigationType == "Numerical")
		this.rotator_Div.appendChild(this.NumericalNavigation(false));
	else if (this.NavigationType == "Numerical, Overlay" && this.total_Items < 10)
		panel_Window.appendChild(this.NumericalNavigation(true));
	else if (this.NavigationType == "Side")
	{
		this.SideNavigation(panel_Window);
 
		$('nav_Previous').style.opacity = 0.01;
		$('nav_Previous').style.filter = "alpha(opacity=0.01)";
		$('nav_Next').style.opacity = 0.01;
		$('nav_Next').style.filter = "alpha(opacity=0.01)";
	}
	else
		this.rotator_Div.appendChild(this.NumericalNavigation(false));
 
	// Add slider_Script into rotator_Div to initialize sliding panel functionality
	window["sp" + this.N] = new Grub.SlidingPanels('panel_Window' + this.N, 'panel_Container' + this.N, 'panel_', '\'width:' + this.rotator_Width + ', fade:' + this.Fade + ', speed:' + this.EffectSpeed + '\'');
 
 
	/*     ----------     AUTO ROTATION     -----------     */
 
               
	// Begin auto-rotation functions
	this.rotate;
	this.StartRotation();
}
Grub.AdRotator.prototype.NumericalNavigation = function(Overlay)
{
	// Grabs object instance for use with external function calls
	var this_OBJECT = this;
	// Grabs slider instance for use with external function calls
	var this_SLIDER = "sp" + this.N;
 
	var CSS;
 
	// Create the numerical navigation for the slider
	var panel_Navigation = document.createElement("ul");
	if (Overlay != true)
		CSS = "float:left;display:block;list-style:none;margin:0;padding:0;overflow:auto;";
	else
		CSS = "position:absolute;display:block;list-style:none;margin:0;padding:0;bottom:5px;left:5px;";
	isIE ? panel_Navigation.style.setAttribute("cssText", CSS) : panel_Navigation.setAttribute("style", CSS);
 
	for (var i = 0; i < this.total_Items; i++)
	{
		var li = document.createElement("li");
		CSS = "display:block;float:left;margin-right:5px;margin-top:5px;background:url(resources/images/smoke.png);border:1px solid #454545;line-height:12pt;overflow:hidden;";
		isIE ? li.style.setAttribute("cssText", CSS) : li.setAttribute("style", CSS);
 
		var a = document.createElement("a");
		a.setAttribute("href", "javascript:void(0);");
		a.number = i;
		CSS = "display:block;padding:0 5px;text-decoration:none;color:#fff;font-size:8pt;font-family:arial;";
		isIE ? a.style.setAttribute("cssText", CSS) : a.setAttribute("style", CSS);
		a.innerHTML = (i + 1);
		if (isIE)
			a.onclick = function(){this_OBJECT.StopRotation(); window[this_SLIDER].slideTo('panel_' + this.number); this_OBJECT.StartRotation();};
		else
			a.addEventListener("click", function(){this_OBJECT.StopRotation(); window[this_SLIDER].slideTo('panel_' + this.number); this_OBJECT.StartRotation();}, false);
 
		li.appendChild(a);
		panel_Navigation.appendChild(li);
	}
 
	return panel_Navigation;
}
Grub.AdRotator.prototype.SideNavigation = function(panel_Window)
{
	// Grabs object instance for use with external function calls
	var this_OBJECT = this;
	// Grabs slider instance for use with external function calls
	var this_SLIDER = "sp" + this.N;
 
	var CSS;
	var navWidth = 50;
               
	var iconHeight = 50;
	var iconCSS = ""
		+ "padding-top: " + ((this.rotator_Height / 2) - (iconHeight)) + "px;"
		+ "color: #fff;"
		+ "font-size: " + iconHeight + "px;"
		+ "font-family: Arial Black;"
		+ "text-align: center;"
		+ "cursor: pointer;";
 
 
	// Create the side navigation for the slider
	var panel_Navigation_Container = document.createElement("div");
	CSS = "position:absolute;top:0px;left:0px;width:" + this.rotator_Width + "px;height:" + this.rotator_Height + "px;";
	isIE ? panel_Navigation_Container.style.setAttribute("cssText", CSS) : panel_Navigation_Container.setAttribute("style", CSS);
 
	// Previous
	var nav_Previous = document.createElement("div");
	nav_Previous.id = "nav_Previous";
	CSS = "position:absolute;top:0px;left:" + 0 + "px;background:#222;width:" + navWidth + "px;height:" + this.rotator_Height + "px;";
	isIE ? nav_Previous.style.setAttribute("cssText", CSS + iconCSS) : nav_Previous.setAttribute("style", CSS + iconCSS);
	nav_Previous.innerHTML = "&laquo;";
	if (isIE)
		nav_Previous.onclick = function(){this_OBJECT.StopRotation(); window[this_SLIDER].slideToPrevious(); this_OBJECT.StartRotation();};  
	else
		nav_Previous.addEventListener("click", function(){this_OBJECT.StopRotation(); window[this_SLIDER].slideToPrevious(); this_OBJECT.StartRotation();}, false);
 
	var nav_Previous_HitField = document.createElement("div");
	CSS = "position:absolute;top:0px;left:0px;width:" + navWidth + "px;height:" + this.rotator_Height + "px;";
	isIE ? nav_Previous_HitField.style.setAttribute("cssText", CSS) : nav_Previous_HitField.setAttribute("style", CSS);
	isIE ? nav_Previous_HitField.onmouseover = function(){slideNav(nav_Previous.id,"IN",null);} : nav_Previous_HitField.setAttribute("onMouseOver", "slideNav('" + nav_Previous.id + "','IN'," + null + ");");
	isIE ? nav_Previous_HitField.onmouseout = function(){slideNav(nav_Previous.id,"OUT",null);} : nav_Previous_HitField.setAttribute("onMouseOut", "slideNav('" + nav_Previous.id + "','OUT'," + null + ");");
	nav_Previous_HitField.appendChild(nav_Previous);
 
	// Next
	var nav_Next = document.createElement("div");
	nav_Next.id = "nav_Next";
	CSS = "position:absolute;top:0px;left:" + 0 + "px;background:#222;width:" + navWidth + "px;height:" + this.rotator_Height + "px;";
	isIE ? nav_Next.style.setAttribute("cssText", CSS + iconCSS) : nav_Next.setAttribute("style", CSS + iconCSS);
	nav_Next.innerHTML = "&raquo;";
	if (isIE)
		nav_Next.onclick = function(){this_OBJECT.StopRotation(); window[this_SLIDER].slideToNext(); this_OBJECT.StartRotation();};  
	else
		nav_Next.addEventListener("click", function(){this_OBJECT.StopRotation(); window[this_SLIDER].slideToNext(); this_OBJECT.StartRotation();}, false);
 
	var nav_Next_HitField = document.createElement("div");
	CSS = "position:absolute;top:0px;left:" + (this.rotator_Width - navWidth) + "px;width:" + navWidth + "px;height:" + this.rotator_Height + "px;";
	isIE ? nav_Next_HitField.style.setAttribute("cssText", CSS) : nav_Next_HitField.setAttribute("style", CSS);
	isIE ? nav_Next_HitField.onmouseover = function(){slideNav(nav_Next.id,"IN",null);} : nav_Next_HitField.setAttribute("onMouseOver", "slideNav('" + nav_Next.id + "','IN'," + null + ");");
	isIE ? nav_Next_HitField.onmouseout = function(){slideNav(nav_Next.id,"OUT",null);} : nav_Next_HitField.setAttribute("onMouseOut", "slideNav('" + nav_Next.id + "','OUT'," + null + ");");
	nav_Next_HitField.appendChild(nav_Next);
 
	panel_Window.appendChild(nav_Previous_HitField);
	panel_Window.appendChild(nav_Next_HitField);
}
Grub.AdRotator.prototype.StartRotation = function()
{
	this.rotate = setInterval("Tick(" + this.N + ")", this.timer_Speed);
}
Grub.AdRotator.prototype.StopRotation = function()
{
	clearInterval(this.rotate);
}
function slideNav(ID, Location, Width)
{
	if (Width != null)
	{
		if (Location == "IN")
		{
			slideX = 0;
		               
			new Effect.Move($(ID), { x: slideX, y: 0, duration: 0.25, mode: 'absolute' });
		}
		if (Location == "OUT")
		{
			if (ID == "nav_Previous")
				slideX = -Width;
			if (ID == "nav_Next")
				slideX = Width;
 
			new Effect.Move($(ID), { x: slideX, y: 0, duration: 0.25, mode: 'absolute' });
		}
	               
	}
	else
	{
		$(ID).style.display = "block";
		if (Location == "IN")
			new Effect.Fade($(ID), { duration: 0.25, from: 0.01, to: .4 });
		if (Location == "OUT")
			new Effect.Fade($(ID), { duration: 0.25, from: .4, to: 0.01 });
	}
}
function Tick(N)
{
	var this_SLIDER = 'sp' + N;
	window[this_SLIDER].slideToNext();
}
 
// Order By Functions
function orderASC(a, z)
{
	return (a - z);
}
function orderDESC(a, z)
{
	return (z - a);
}
 
// Kill instances of swf if browser does not support flash
function killSWFs()
{
	var killNum = new Array();
 
	// find any instance of swf and flag the position
	for (var i = 0; i < items_Type.length; i++)
	{
		if (ad_Type[i] == "swf")
		{
			killNum.push(i);
		}
	}
               
	// purge all instances previously flaged as swf
	for (var i = 0; i < killNum.length; i++)
	{
		var killFlag = parseInt(killNum[i]);
	               
		for (var i = 0; i < killNum.length; i++)
		{
			//items_Name.splice(killFlag, 1);
			items_Path.splice(killFlag, 1);
			items_Link.splice(killFlag, 1);
			items_Alt.splice(killFlag, 1);
			items_Type.splice(killFlag, 1);
			items_Seed.splice(killFlag, 1);
		}
	}
}
 
 
/*     ----------     DO NOT EDIT BELOW THIS LINE     -----------     */
 
// toBoolean(string) - (AMH)
function toBoolean(value) {
	var booleanValue;
 
	switch (value.toLowerCase()) {
		case "true": booleanValue = true; break;
		case "1": booleanValue = true; break;
 
		case "false": booleanValue = false; break;
		case "0": booleanValue = false; break;
 
		default: booleanValue = false; break;
	}
 
	return booleanValue;
}
 
// trim(string) - (AMH)
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
 
// getXMLHttpObject function - (3rd Party)
// Uses multiple try attempts to cover all browser specs
function getXMLHttpObject()
{
	var xmlRequest = null;
               
	try
	{
		xmlRequest = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlRequest = new ActiveXObject("MSXML2.XMLHTTP");
		}
		catch (e)
		{
			xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
               
	return xmlRequest;
}
 
// Flash Detection Script - (Adobe Inc.)
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
 
function ControlVersion()
{
	var version;
	var axo;
	var e;
 
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
 
	try
	{
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	}
	catch (e)
	{ }
 
	if (!version)
	{
		try
		{
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
		               
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful.
		               
			// default to the first public version
			version = "WIN 6,0,21,0";
 
			// throws if AllowScripAccess does not exist (introduced in 6.0r47)	          
			axo.AllowScriptAccess = "always";
 
			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");
 
		}
		catch (e)
		{ }
	}
 
	if (!version)
	{
		try
		{
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		}
		catch (e)
		{ }
	}
 
	if (!version)
	{
		try
		{
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		}
		catch (e)
		{ }
	}
 
	if (!version)
	{
		try
		{
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		}
		catch (e)
		{
			version = -1;
		}
	}
               
	return version;
}
 
// JavaScript helper required to detect Flash Player PlugIn version information - (3rd Party)
function GetSwfVer()
{
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
               
	if (navigator.plugins != null && navigator.plugins.length > 0)
	{
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"])
		{
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");		   
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
		               
			if (versionRevision == "")
			{
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d")
			{
				versionRevision = versionRevision.substring(1);
			}
			else if (versionRevision[0] == "r")
			{
				versionRevision = versionRevision.substring(1);
			               
				if (versionRevision.indexOf("d") > 0)
				{
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
		               
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}

	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1)
	{
		flashVer = 4;
	}
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1)
	{
		flashVer = 3;
	}
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1)
	{
		flashVer = 2;
	}
	else if ( isIE && isWin && !isOpera )
	{
		flashVer = ControlVersion();
	}
 
	return flashVer;
}