﻿var IE = (document.all) ? 1 : 0;
var wcUserAgent = window.navigator.userAgent;
var wcMSIE = wcUserAgent.indexOf("MSIE");
var IEVersion = (IE == 1 ? (wcMSIE > 0 ? parseInt(wcUserAgent.substring(wcMSIE + 5, wcUserAgent.indexOf(".", wcMSIE))) : 0) : 0);

var Today = new Date();
var Iteration = parseInt(
	Today.getFullYear().toString() + Today.getMonth().toString() + Today.getDay().toString() + Today.getHours().toString() + 
	Today.getMinutes().toString() + Today.getMilliseconds().toString());

var QueryString = new Object(); 
var query = location.search.substring(1); 
var pairs = query.split("&"); 

for (var iPair = 0; iPair < pairs.length; iPair++) 
{ 
	var pos = pairs[iPair].indexOf('='); 
	if (pos == -1) continue; 

	var argname = pairs[iPair].substring(0, pos); 
	var value = pairs[iPair].substring(pos + 1); 
	
	QueryString[argname] = unescape(value); 
}

var EncryptedUserId = (QueryString["u"] == undefined) ? "" : QueryString["u"];;

function __WallArtCore()
{
	function __HtmlElements()
	{
		this.FlashTimeOut = null;
		
		this.FlashObjects = function(pLastRun)
		{
			pLastRun = (pLastRun == null) ? false: pLastRun;
			
			var Style1 = "FlashingObject"
			var Style2 = "FlashingObjectOff";
			var AllFlashObjects = document.getElementsByTagName("flashingobject");

			if (AllFlashObjects != null)
			{

				for (iObject = 0; iObject < AllFlashObjects.length; iObject++)
				{
					var FlashObjectParent = AllFlashObjects[iObject].parentNode
					
					if (FlashObjectParent != null)
					{
						if (FlashObjectParent.className.indexOf("Hidden") < 0)
						{
							FlashObjectParent.className = (pLastRun ? Style1 : (FlashObjectParent.className == Style1 ? Style2 : Style1));
						}
					}
				}
				
				if (!pLastRun)
				{
					this.FlashTimeOut = setTimeout("WallArtCore.HtmlElements.FlashObjects()", 500);
				}
				else
				{
					clearTimeout(this.FlashTimeOut);
				}
			}
		}
		
		this.GetElementId = function(pId, pElement)
		{	
			var RetValue = "";
			var AllElements = document.getElementsByTagName(pElement);
				
			if (AllElements.length > 0)
			{
				for (var iElement = 0; iElement < AllElements.length; iElement++)
				{
					if (AllElements[iElement].id.indexOf(pId) >= 0)
					{
						RetValue = AllElements[iElement].id;
					}
				}
			}
			
			return RetValue;
		}

		this.GetHtmlText = function(pElement)
		{
			var Value = (document.all) ? pElement.innerText : pElement.textContent;
			
			return Value;
		}

		this.GetKeyPress = function(event)
		{
			var keyCode = null;
		
			if (event.which) 
			{
				keyCode = event.which;
			}
			else if (event.keyCode) 
			{
				keyCode = event.keyCode;
			} 
		
			return keyCode;
		}
		
		this.GetObjectAttribute = function(pObject, pName)
		{
			var RetValue = "";
			
			if (pObject != null)
			{
				if (pObject.attributes.getNamedItem(pName) != null)
				{
					RetValue = pObject.attributes.getNamedItem(pName).value;
				}
			}
			
			return RetValue;
		}
		
		this.GetObjectDimensions = function(pObject)
		{
			var Position = this.GetObjectPosition(pObject);
			var objWidth = pObject.offsetWidth;
			var objHeight = pObject.offsetHeight;
			
			return {Top:Position.Top, Left:Position.Left, Height:objHeight, Width:objWidth};
		}
		
		this.GetObjectPosition = function(pObject)
		{
			var iTop = -1;
			var iLeft = -1;
			
			if (pObject != null)
			{
				iTop = pObject.offsetTop;
				iLeft = pObject.offsetLeft;

				while (pObject.offsetParent)
				{
					pObject = pObject.offsetParent;
					iTop += pObject.offsetTop;
					iLeft += pObject.offsetLeft;
				}
			}
			
			return {Top:iTop, Left:iLeft};
		}
		
		this.SetHtmlText = function(pElement, pValue)
		{
			if (document.all)
			{
				pElement.innerText = pValue;
			}
			else
			{
				pElement.textContent = pValue;
			}
		}
		
		this.SelectOption = function(pControlName, pValue)
		{
			var CurrentControl = document.getElementById(pControlName);
			
			if (CurrentControl != null)
			{
				for (var iOptions = 0; iOptions < CurrentControl.length; iOptions ++)
				{
					if (CurrentControl.options[iOptions].value == pValue)
					{
						CurrentControl.options[iOptions].selected = true;
					}
				}
			}
		}
		
		this.Decode = function(pText)
		{
			while (pText.indexOf("&gt;") >= 0)
			{
				pText = pText.replace("&gt;",">");
			}
			while (pText.indexOf("&lt;") >= 0)
			{
				pText = pText.replace("&lt;","<");
			}
			while (pText.indexOf("+") >= 0)
			{
				pText = pText.replace("+"," ");
			}
			
			return pText;
		}
	}
	
	function __Math()
	{
		this.Round = function(pValue, pDecimals)
		{
			var thisDigits = Math.pow(10, pDecimals);
			var Value = pValue * thisDigits;
	 
			Value = Math.round(Value);
			Value = Value / thisDigits;

			return Value;
		}
		
		this.FormatCurrency = function(pNum) 
		{
			pNum = pNum.toString().replace(/\$|\,/g,'');
			if(isNaN(pNum))
			{
				pNum = "0";
			}
				
			var Sign = (pNum == (pNum = Math.abs(pNum)));
			pNum = Math.floor(pNum * 100 + 0.50000000001);
			
			var Cents = pNum % 100;
			pNum = Math.floor(pNum / 100).toString();

			if(Cents < 10)
			{
				Cents = "0" + Cents;
			}
				
			for (var i = 0; i < Math.floor((pNum.length - (1 + i)) / 3); i++)
			{
				pNum = pNum.substring(0,pNum.length - (4*i+3)) + ',' + pNum.substring(pNum.length-(4*i+3));
			}
			
			return (((Sign) ? '' : '-') + '$' + pNum + '.' + Cents);
		}
	}
	
	function __Menus()
	{
		this.Click = function(pCell)
		{
			if (pCell != null)
			{
				if (pCell.className.indexOf("Selected") < 0)
				{
					ResetAllMenus();
					ResetAllDivisions();
					
					if (pCell.className == "")
					{
						pCell.className = "Selected";
					}
					else
					{
						pCell.className += " Selected";
					}
					
					var divControl = document.getElementById(pCell.id.replace("tbc","div"));
					if (divControl != null)
					{
						divControl.className = divControl.className.replace("Hidden", "View");
					}
				}
			}
			
			function ResetAllMenus()
			{
				var AllCells = pCell.parentNode.getElementsByTagName("TD");
				
				if (AllCells != null)
				{
					for (var iCell = 0; iCell < AllCells.length; iCell++)
					{
						AllCells[iCell].className = AllCells[iCell].className.replace("Selected","");
					}
				}
			}
			
			function ResetAllDivisions()
			{
				var CellUI = document.getElementById("tdInterfaces");
				
				if (CellUI != null)
				{
					var AllDivs = CellUI.getElementsByTagName("DIV");
					
					if (AllDivs != null)
					{
						for (var iDiv = 0; iDiv < AllDivs.length; iDiv++)
						{
							AllDivs[iDiv].className = AllDivs[iDiv].className.replace("View","Hidden");
						}
					}
				}
			}
		}
		
		this.Hover = function(pCell)
		{
			if (pCell != null)
			{
				pCell.className += "Hover";
			}
		}
		
		this.HoverOut = function(pCell)
		{
			if (pCell != null)
			{
				pCell.className = pCell.className.replace("Hover","");
			}
		}
		
	}
	
	function __Text()
	{
		this.waReplaceParams = new Array
		(
			"[SP], ","[AM],&","[CR],\r\n","[AP],'","[PD],#","[PL],+","[SC],;","[BW],\\","[FW],/","[QU],\"","[LT],<","[GT],>","[QM],?","[CR],\n"
		);
		
		this.FormatToImage = function(pText, pReverse)
		{
			pReverse = (pReverse == null) ? false : pReverse;

			for (var iParam = 0; iParam < this.waReplaceParams.length; iParam++)
			{
				if (this.waReplaceParams[iParam].indexOf(",") > 0)
				{
					var Elements = this.waReplaceParams[iParam].split(",");

					if (Elements[0] != "" && Elements[1] != "")
					{
						var ReplaceWhat = (pReverse == false) ? Elements[1] : Elements[0];
						var ReplaceWith = (pReverse == false) ? Elements[0] : Elements[1];
						
						pText = this.ReplaceText(pText, ReplaceWhat, ReplaceWith);	
					}
				}
			}
			
			return pText;
		}
		
		this.ReplaceText = function(pOriginal, pReplaceWhat, pReplaceWith)
		{
			if (pOriginal.indexOf(pReplaceWhat) >= 0)
			{
				while (pOriginal.indexOf(pReplaceWhat) >= 0)
				{
					pOriginal = pOriginal.replace(pReplaceWhat, pReplaceWith);
				}
			}
			
			return pOriginal;
		}
	}
	
	function __Window()
	{
		this.GetMousePosition = function(pEvent)
		{
			var objNetscape = document.getElementById&&!document.all;
			var X = objNetscape ? pEvent.clientX : event.clientX;
			var Y = objNetscape ? pEvent.clientY : event.clientY;

			return {MouseX:X, MouseY:Y};
		}

		this.GetScrollPosition = function()
		{	
			var ScrollTop = 0;
			var ScrollLeft = 0;
			
			if (typeof window.pageYOffset != "undefined") 
			{
				ScrollLeft = window.pageXOffset;
				ScrollTop = window.pageYOffset;
			}
			else if (typeof document.documentElement.scrollTop != "undefined") 
			{
				if (document.documentElement.scrollLeft > 0) ScrollLeft = document.documentElement.scrollLeft;
				if (document.documentElement.scrollTop > 0) ScrollTop = document.documentElement.scrollTop;
			}
			else if (typeof document.body.scrollLeft != "undefined") 
			{
				ScrollLeft = document.body.scrollLeft;
				ScrollTop = document.body.scrollTop;
			}
				
			return {Left:ScrollLeft, Top:ScrollTop};
		}
		
		this.WindowSize = function()
		{
			var w = 0;
			var h = 0;
			
			if(!window.innerWidth)
			{
				if(!(document.documentElement.clientWidth == 0))
				{
					w = document.documentElement.clientWidth;
					h = document.documentElement.clientHeight;
				}
				else
				{
					w = document.body.clientWidth;
					h = document.body.clientHeight;
				}
			}
			else
			{
				w = window.innerWidth;
				h = window.innerHeight;
			}
			
			return {width:w,height:h};
		}
	}
	
	function __Xml()
	{
		this.Parse = function(pXml)
		{
			var xmlDoc = null;

			try
			{
				xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
				xmlDoc.async = "false";
				xmlDoc.loadXML(pXml);
			}
			catch(e)
			{
				try
				{
					parser = new DOMParser();
					xmlDoc = parser.parseFromString(pXml, "text/xml");
				}
				catch(e)
				{
					alert(e.message);
					return;
				}
			}

			return xmlDoc;
		}
		
		this.GetNodeValue = function(pNode)
		{
			var thisValue = pNode.textContent;
			
			if (IE)
			{
				thisValue = pNode.text;
			}
			
			return thisValue;
		}
	}
	
	this.HtmlElements = new __HtmlElements;
	this.Math = new __Math;
	this.Menus = new __Menus;
	this.Text = new __Text;
	this.Window = new __Window;
	this.Xml = new __Xml;
	
	this.AddJavaTimer = function(pUrl)
	{
		var Inclusion = "t=";
		var Base = pUrl.replace("&t=","ANDT=").replace("?t=","ANDT=").split("ANDT=");
		var thisDay = new Date();
		var Iteration = parseInt(
			thisDay.getFullYear().toString() + thisDay.getMonth().toString() + thisDay.getDay().toString() + thisDay.getHours().toString() + 
			thisDay.getMinutes().toString() + thisDay.getSeconds().toString() + thisDay.getMilliseconds().toString());

		var RetValue = Base[0] + (Base[0].indexOf("?") > 0 ? "&" : "?") + Inclusion + Iteration;
		
		if (Base.length > 1)
		{
			if (Base[1].indexOf("&") >= 0)
			{
				var Elements = Base[1].substring(Base[1].indexOf("&"));
				RetValue += Elements;
			}
		}

		return RetValue;
	}
		
	this.DoCallBack = function(strPageURL, pAsync) 
	{		
		strPageURL += (strPageURL.indexOf("?") > 0 ? "&" : "?") + "callback=true";
		
		if (EncryptedUserId != null)
		{
			if (strPageURL.indexOf("?u=") < 0 && strPageURL.indexOf("&u=") < 0)
			{
				strPageURL += "&u=" + EncryptedUserId;
			}
		}
		
		strPageURL	= this.AddJavaTimer(strPageURL);
		strObject	= "Microsoft.XMLHTTP";
		strApp		= "application/x-www-form-urlencode";
	    
		var xmlRequest = null;
		
		if (window.XMLHttpRequest)
		{
			xmlRequest = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			try
			{
				xmlRequest = new ActiveXObject("MSXML2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
				}
			}
		}
		
		if (pAsync == null) pAsync = true;
		
		if (xmlRequest != null)
		{
//alert(strPageURL);
			xmlRequest.open("GET", strPageURL, pAsync);	
			xmlRequest.setRequestHeader("Content-Type", strApp);
			xmlRequest.send(null);

			if (pAsync == false)
			{
				while (xmlRequest.readyState != 4)
				{
					window.status = "State=" + xmlRequest.readyState;
				}
				if (xmlRequest.status != 500)
				{
					if (xmlRequest.status == 404)
					{
						window.status = "404: " + strPageURL;
					}
					else
					{
						while (xmlRequest.status != 200)
						{
							window.status = "Status=" + xmlRequest.status;
						}
					}
					
					try
					{
						return xmlRequest.responseText;
					}
					catch (e)
					{
						return "";
					}
				}
				else
				{
					return xmlRequest.RepsonseText;
				}	
			}
		}
	}

	this.IsReturnPress = function(event)
	{
		var keyCode = null;
		var IsReturn = false;
		
		if (event.which)
		{
			keyCode = event.which;
		}
		else if (event.keyCode)
		{
			keyCode = event.keyCode;
		}
			
		if (keyCode != null)
		{
			if (keyCode == 13)
			{
				IsReturn = true;
			}
		}
			
		return IsReturn;
	}
	
	this.Fade = function(pControlId, pStart, pEnd, pTime)
	{
		var Speed = Math.round(pTime / 100);
		var Timer = 0;
		
		if (pStart > pEnd)
		{	
			for (var iFade = pStart; iFade >= pEnd; iFade--)
			{
				setTimeout("WallArtCore.SetOpacity(" + iFade + ",'" + pControlId + "')", (Timer * Speed));
				Timer++;
			}
		}
		else if (pStart < pEnd)
		{
			for (iFade = pStart; iFade <= pEnd; iFade++)
			{
				setTimeOut("WallArtCore.SetOpacity(" + iFade + ",'" + pControlId + "')", (Timer * Speed));
				Timer++;
			}
		}
	}
	
	this.Navigate = function(pUrl)
	{
		self.location.href = this.WrapUrl(pUrl);
	}
	
	this.SetOpacity = function(pValue, pControlId)
	{
		var Control = document.getElementById(pControlId);
		if (Control != null)
		{
			var ControlStyle = Control.style;
			
			if (pValue > 0)
			{
				ControlStyle.opacity = (pValue / 100);
				ControlStyle.MozOpacity = (pValue / 100);
				ControlStyle.KhtmlOpacity = (pValue / 100);
				ControlStyle.filter = "alpha(opacity=" + pValue + ")";
			}
			else
			{
				ControlStyle.display = "none";
			}
		}
	}
	
	this.WrapUrl = function(pUrl)
	{
		var UserId = (QueryString["u"] == undefined) ? "" : "u=" + QueryString["u"];
		
		if (pUrl.indexOf("&u=") < 0 && pUrl.indexOf("?u=") < 0 && UserId != "")
		{
			pUrl += (pUrl.indexOf("?") > 0 ? "&" : "?") + UserId;
		}
		
		return (this.AddJavaTimer(pUrl));
	}
}

var WallArtCore = new __WallArtCore;

function MediaPlayer()
{
	var Initialized = false;
		
	this.Browser = function()
	{
		var browser_name = navigator.userAgent;

		if (browser_name.indexOf("Opera")!= -1) browser_name = "Opera";
		else if (browser_name.indexOf("Firefox")!= -1) browser_name = "Firefox";
		else if (browser_name.indexOf("MSIE")!= -1) browser_name = "MSIE";
		else if (browser_name.indexOf("Netscape")!= -1) browser_name = "Netscape";
		else if (browser_name.indexOf("Safari")!= -1) browser_name = "Safari";

		return browser_name;
	};
	
	this.Init = function(pFileName)
	{
		var playerControl = document.getElementById('SamplePlayer'); 
		var playerContent = "";
		var Height = "320px";
		
		if (this.Browser() == "MSIE" || this.Browser() == "Netscape")
		{
			//if (IEVersion == "7") 
			Height = "240px";
			
			playerContent = 
				"<embed src=\"" + pFileName + "\" width=\"320px\" height=\"" + Height + "\" type=\"application/x-mplayer2\" controller=\"0\" autostart=\"true\" showcontrols=\"0\" showdisplay=\"0\"></embed>";
		}
		else
		{
			playerContent = 
				"<embed src=\"" + pFileName + "\" width=\"320px\" height=\"" + Height + "\" type=\"application/x-mplayer2\" controller=\"0\" autostart=\"true\" showcontrols=\"0\" showdisplay=\"0\"></embed>";
		}
		confirm(playerContent);
		playerControl.innerHTML = playerContent;
	};
	
	this.PlaySample = function(pFileName, pWidth, pHeight, pAutoStart, imgControl)
	{
		pAutoStart = pAutoStart || "true";
		pWidth = pWidth || "200";
		
		if (document.getElementById("SamplePlayer").innerHTML == "")
		{
			this.Init(pFileName, pWidth, pHeight, pAutoStart);
			//imgControl.src = imgControl.src.replace("ListenTo", "Stop");
			//imgControl.setAttribute("alt", imgControl.getAttribute("alt").replace("Play Sample", "Stop Sample"));
		}
		else 
		{
			this.StopSample(imgControl);
		}
	};
	
	this.StopSample = function(imgControl)
	{
		document.getElementById("SamplePlayer").innerHTML = "";
		//imgControl.src = imgControl.src.replace("Stop", "ListenTo");
		//imgControl.setAttribute("alt", imgControl.getAttribute("alt").replace("Stop Sample", "Play Sample"));
	};
	
	return this;
};

var $Player = function()
{
	return new MediaPlayer()
};

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
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
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;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
