/*
	Active Lightning helper scripts
*/






/*
functions for toggling text
*/


var strIsRtl = '';
var allDivsInPage = null;
var allImagesInPage = null;
var fExpandedAssistance = false;
var popupWin;

function openWindow(url, example)
{
	if (typeof(popupWin) != "object" || null == popupWin) 
		popupWin = window.open(url, example, "width=452,height=572,top=0,left=0,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0");
	else
		{
		if (!popupWin.closed) 
			popupWin.location.href = url;
		else 
			popupWin = window.open(url, example, "width=452,height=572,top=0,left=0,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0");
		}	  

	popupWin.focus();
}

function ExpandDiv(theDivName)
{
	InitializeGlobalData();

	if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivsInPage[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return;
	theDiv.style.display = "block";

	var thePic = allImagesInPage[theDivName + "_img"];
	if (null != thePic && typeof(thePic) != "undefined")
		{
		thePic.src = "../h_images/hide.gif";
		thePic.alt = strHide;
		}
}

function CollapseDiv(theDivName)
{
	InitializeGlobalData();

	if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivsInPage[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return;
	theDiv.style.display = "none";

	var thePic = allImagesInPage[theDivName + "_img"];
	if (null != thePic && typeof(thePic) != "undefined")
		{
		thePic.src = "../h_images/show.gif";
		thePic.alt = strShow;
		}
}

function ToggleDiv(theDivName)
{
	InitializeGlobalData();

	if (null == theDivName || typeof(theDivName) == "undefined") return; var theDiv = allDivsInPage[theDivName]; if (null == theDiv || typeof(theDiv) == "undefined") return;

	if (theDiv.style.display.toUpperCase() != "BLOCK")
		ExpandDiv(theDivName);
	else
		CollapseDiv(theDivName);
}

function AlterAllDivs(displayStyle)
{
	InitializeGlobalData();

	if (null == allDivsInPage || typeof(allDivsInPage) == "undefined")
		return;

	if (typeof(allDivsInPage["divShowAll"]) != "undefined" &&
		typeof(allDivsInPage["divHideAll"]) != "undefined")
		{
		if (displayStyle == "block")
			{
			allDivsInPage["divShowAll"].style.display = "none";
			allDivsInPage["divHideAll"].style.display = "block";
			}
		else
			{
			allDivsInPage["divShowAll"].style.display = "block";
			allDivsInPage["divHideAll"].style.display = "none";
			}
		}

	AlterAllDivsSpans(document.body.getElementsByTagName("DIV"), displayStyle);
	AlterAllDivsSpans(document.body.getElementsByTagName("SPAN"), displayStyle);
}

function AlterAllDivsSpans(allDivsSpans, displayStyle)
{
	if (typeof(allDivsSpans) == "undefined" || null == allDivsSpans)
		return;

	for (i=0; i < allDivsSpans.length; i++)
	{
		if (typeof(allDivsSpans[i]) != "undefined" &&
			null != allDivsSpans[i] &&
			typeof(allDivsSpans[i].id) != "undefined" &&
			null != allDivsSpans[i].id &&
			allDivsSpans[i].id.length > 0)
		{
			if (0 == allDivsSpans[i].id.indexOf("divExpCollAsst_")) 
			{
				var thePic = allImagesInPage[allDivsSpans[i].id + "_img"];

				if (displayStyle == "block")
				{
					allDivsSpans[i].style.display = "block";

					if (typeof(thePic) != "undefined" && null != thePic)
					{
						thePic.src = "/global/images/default.aspx?AssetID=ZA790050011033";
						thePic.alt = strHide;
					}
				}
				else
				{
					allDivsSpans[i].style.display = "none";

					if (typeof(thePic) != "undefined" && null != thePic)
					{
						thePic.src = "/global/images/default.aspx?AssetID=ZA790050001033";
						thePic.alt = strShow;
					}
				}
			}

			if (0 == allDivsSpans[i].id.indexOf("divInlineDef_")) 
			{
				if (displayStyle == "block")
					allDivsSpans[i].style.display = "inline";
				else
					allDivsSpans[i].style.display = "none";
			}
		}
	}
}

function ToggleAllDivs()
{
	InitializeGlobalData();

	if (fExpandedAssistance)
		AlterAllDivs("none");
	else
		AlterAllDivs("block");

	fExpandedAssistance = !fExpandedAssistance;
}

function InitializeGlobalData()
{
	if ('undefined' != typeof(strRtl))
		strIsRtl = strRtl;

	var divs = document.body.getElementsByTagName("DIV");
	var spans = document.body.getElementsByTagName("SPAN");

	var countDiv = 0;
	var countSpan = 0;
	if (typeof(divs) != "undefined" && null != divs)
		countDiv = divs.length;

	if (typeof(spans) != "undefined" && null != spans)
		countSpan = spans.length;

	allDivsInPage = new Array();
	for (i=0; i < countDiv; i++)
		if (typeof(divs[i].id) != "undefined" &&
			null != divs[i].id &&
			divs[i].id.length > 0)
			allDivsInPage[divs[i].id] = divs[i];

	for (i=0; i < countSpan; i++)
		if (typeof(spans[i].id) != "undefined" &&
			null != spans[i].id &&
			spans[i].id.length > 0)
			allDivsInPage[spans[i].id] = spans[i];

	allImagesInPage = document.body.getElementsByTagName("IMG");
}

function OnSeeAlsoClicked()
{
	InitializeGlobalData();

	if (null == allDivsInPage || typeof(allDivsInPage) == "undefined")
		return;

	if (typeof(allDivsInPage["divSeeAlsoShowBullet"]) != "undefined" &&
		typeof(allDivsInPage["divSeeAlsoHideBullet"]) != "undefined")
		{
		if (allDivsInPage["divSeeAlsoShowBullet"].style.display.toUpperCase() == "INLINE")
			{
			allDivsInPage["divSeeAlso"].style.display = "block";
			allDivsInPage["divSeeAlsoShowBullet"].style.display = "none";
			allDivsInPage["divSeeAlsoHideBullet"].style.display = "inline";
			}
		else
			{
			allDivsInPage["divSeeAlso"].style.display = "none";
			allDivsInPage["divSeeAlsoShowBullet"].style.display = "inline";
			allDivsInPage["divSeeAlsoHideBullet"].style.display = "none";
			}
		}
}


/*
var QUIZ_COOKIE_NAME = "QUIZ_DATA";

function SetQuizCookie(strName, strValue)
{
	var strQuizCookie = GetCookie(QUIZ_COOKIE_NAME);
	if (null != strQuizCookie && 0 != strQuizCookie.length)
	{
		var iStart = strQuizCookie.indexOf(strName);
		if (iStart >= 0)
		{
			var iEnd = strQuizCookie.indexOf(" ", iStart + 1);
			var strEnd = (iEnd > 0 ? strQuizCookie.substr(iEnd) : "");
			var strCookie = (strValue == null ? "" : strName + ":" + strValue);
			strQuizCookie = strQuizCookie.substr(0, iStart) + strCookie + strEnd;
		}
		else if (strValue != null)
		{
			strQuizCookie += " " + strName + ":" + strValue;
		}
	}
	else
	{
		strQuizCookie = strName + ":" + strValue;
	}
	mSetCookie(QUIZ_COOKIE_NAME, strQuizCookie);
}

function StrGetQuizCookie(strName)
{
	var strQuizCookie = GetCookie(QUIZ_COOKIE_NAME);
	if (null != strQuizCookie && 0 != strQuizCookie.length)
	{
		var iStart = strQuizCookie.indexOf(strName);
		if (iStart >= 0)
		{
			iStart = strQuizCookie.indexOf(":", iStart + 1);
			if (iStart > 0)
			{
				iStart++;
				var	iEnd = strQuizCookie.indexOf(" ", iStart + 1);
				if (iEnd == -1)
				{
					return strQuizCookie.substr(iStart);
				}
				else
				{
					return strQuizCookie.substring(iStart, iEnd);
				}
			}
		}
	}
	return "";
}

function ShowElement(name)
{
	var objElement = ElmGetPageElementQuiz(name);
	if (objElement != null)
		{
		objElement.style.display = 'inline';
		}
}

function ElmGetPageElementQuiz(strElementID)
{
	if (document.all)
		{
		return document.all[strElementID];
		}
	else if (document.getElementById)
		{
		return document.getElementById(strElementID);
		}
	else if (document.layers)
		{
		return document.MainForm.elements[strElementID];
		}
	return null;
}



function StrXMLEncode(s)
{
	if (typeof(s) == 'undefined')
		return "";

	s = s.replace(/&/g, "&amp;");
	s = s.replace(/>/g, "&gt;");
	s = s.replace(/</g, "&lt;");
	s = s.replace(/'/g, "&apos;");
	s = s.replace(/"/g, "&quot;");	
	return s;
}

function StrXMLDecode(s)
{
	if (typeof(s) == 'undefined')
		return "";

	var re;

	re = /&amp;/g;
	s = s.replace(re, "&");

	re = /&gt;/g;
	s = s.replace(re, ">");

	re = /&lt;/g;
	s = s.replace(re, "<");

	re = /&apos;/g;
	s = s.replace(re, "'");

	re = /&quot;/g;
	s = s.replace(re, "\"");

	return s;
}



function StrTrim(str)
{
	if (typeof(str) == "undefined" || null == str)
		return null;

	while (str.length > 0 && str.charCodeAt(0) <= 32)
		str = str.substring(1);

	while (str.length > 0 && str.charCodeAt(str.length-1) <= 32)
		str = str.substring(0, str.length-1);

	return str;
}



function StrReplace(strSource, strWhat, strNew)
{
	if (typeof(strSource) == 'undefined' ||
		typeof(strWhat) == 'undefined' ||
		typeof(strNew) == 'undefined' ||
		null == strSource ||
		null == strSource ||
		null == strSource)
		{
		return strSource;
		}

	var iPos = strSource.indexOf(strWhat);
	if (iPos < 0)
		return strSource;

	return strSource.substring(0, iPos) + strNew + strSource.substring(iPos+strWhat.length);
}

function goDisplayCount(max_len, box, label, strSubmitButtonId)
{
	if ('undefined' == typeof(fDisableCounter) ||
		'undefined' == typeof(fDisableCounterFirst) ||
		'undefined' == typeof(fWasLastCountOver))
		{
		return;
		}

	var txbBox = document.getElementById(box);
	if ('undefined' == typeof(txbBox) || null == txbBox)
		return;

	var fDoCount = true;
	if (fDisableCounter)
		{
		if (fDisableCounterFirst)
			{
			document.getElementById(label).innerHTML =
				'<SPAN CLASS="FeedbackWizCounterText">' + strGoDisplayCountOK + '</SPAN>';

			fDisableCounterFirst = false;
			}

		fDoCount = false;
		}

	var strDescr = txbBox.value;
	var nLen = max_len - strDescr.length;

	var btnFeedback = null;
	var fFoundButton = false;
	if ('undefined' != typeof(strSubmitButtonId) && null != strSubmitButtonId)
		{
		btnFeedback = document.getElementById(strSubmitButtonId);
		if ('undefined' != typeof(btnFeedback) && null != btnFeedback)
			fFoundButton = true;
		}

	if (nLen >= 0) 
		{
		if (fDoCount)
			{
			document.getElementById(label).innerHTML = '<SPAN CLASS="FeedbackWizCounterText">' +
				StrReplace(strGoDisplayCountOK, '{0}', '' + nLen) + '</SPAN>';
			}
		else if (fWasLastCountOver)
			{
			document.getElementById(label).innerHTML =
				'<SPAN CLASS="FeedbackWizCounterText">' + strGoDisplayCountOK + '</SPAN>';
			}

		fWasLastCountOver = false;

		if (fFoundButton)
			{

			var fCanDisable = true;
			if ('undefined' != typeof(iFeedbackWizStarRated))
			{
				fCanDisable = (iFeedbackWizStarRated < 1 || iFeedbackWizStarRated > 5);
			}

			if (0 == strDescr.length && fCanDisable)
				btnFeedback.disabled = true;
			else
				btnFeedback.disabled = false;
			}
		}
	else
		{
		if (fDoCount)
			{
			var strError = strGoDisplayCountOver;
			strError = StrReplace(strError, '{0}',  '' + (max_len-nLen));
			strError = StrReplace(strError, '{1}',  '' + max_len);
			document.getElementById(label).innerHTML = '<SPAN CLASS="FeedbackWizCounterStar">' +
				strGoDisplayCountOverStar + '</SPAN><SPAN CLASS="FeedbackWizCounterOverText">' +
				strError + '</SPAN>';
			}
		else if (!fWasLastCountOver)
			{
			document.getElementById(label).innerHTML = '<SPAN CLASS="FeedbackWizCounterStar">' +
				strGoDisplayCountOverStar + '</SPAN><SPAN CLASS="FeedbackWizCounterOverText">' +
				strGoDisplayCountOK + '</SPAN>';
			}

		fWasLastCountOver = true;

		if (fFoundButton)
			btnFeedback.disabled = true;
		}
}



function FIsMac()
{
	if (typeof(window.navigator.platform) != 'undefined')
		return (-1 != window.navigator.platform.toUpperCase().indexOf("MAC"));
	else
		return (-1 != navigator.userAgent.toUpperCase().indexOf("MAC"));
}

function SetReturnParameterValue(strReturn)
{
	strAxInstallReturnParameter = escape(strReturn);
}

function FIsSupportedWindows()
{
	return ("Win32" == navigator.platform &&
		-1 == navigator.userAgent.indexOf("Windows 95") &&
		-1 == navigator.userAgent.indexOf("Windows 98") &&
		-1 == navigator.userAgent.indexOf("Windows ME") &&
		-1 == navigator.userAgent.indexOf("Windows NT 4") &&
		-1 == navigator.userAgent.indexOf("Windows CE"));
}

function FIsCorrectVersion()
{
	var rgstrVersion;
	var rgstrReqVer;
	var iVerMajor;
	var iVerMinor;
	var iVerBuild;
	var iVerRev;

	strVersion = GetCookie(strAxPermCookie);

	if ("" == strVersion || "0" == strVersion)
		return false;

	rgstrVersion = strVersion.replace(/,/g, '.').split(".");

	iVerMajor = Number(rgstrVersion[0]);
	iVerMinor = Number(rgstrVersion[1]);
	iVerBuild = Number(rgstrVersion[2]);
	iVerRev = Number(rgstrVersion[3]);

	rgstrReqVer = strReqVersion.split(",");

	var iReqVerMajor = Number(rgstrReqVer[0]);
	var iReqVerMinor = Number(rgstrReqVer[1]);
	var iReqRevMajor = Number(rgstrReqVer[2]);
	var iReqRevMinor = Number(rgstrReqVer[3]);

	if (iVerMajor > iReqVerMajor)
		return true;

	if (iVerMajor < iReqVerMajor)
		return false;

	if (iVerMinor > iReqVerMinor)
		return true;

	if (iVerMinor < iReqVerMinor)
		return false;

	if (iVerBuild > iReqRevMajor)
		return true;

	if (iVerBuild < iReqRevMajor)
		return false;

	if (iVerRev < iReqRevMinor)
		return false;

	return true;
}

function SetActiveXInstallStatus()
{
	fIsActiveXInstalled = false;

	if (!fSupportsActiveX || fDisableActivex)
		return;

	var fIsCorrectVersion = FIsCorrectVersion();

	if (fIsCorrectVersion)
		{

		document.write('<SPAN style="display:none"><OBJECT CLASSID="clsid:' + strAxClsid + '" ID="DCTRL" WIDTH="0" HEIGHT="0"></OBJECT></SPAN>');
		fIsActiveXInstalled = FIsActiveXInstalled(strAxID);

		if (!fIsActiveXInstalled)
			SetPersistentCookie(strAxPermCookie, "0");
		}
}

function FShouldPromptForAx()
{
	return !(FIsVariableInCookie("AWS_DontPrompt_Sess") ||
		FIsVariableInCookie("AWS_DontPrompt_Perm") ||
		fDisableActivex);
}

function FIsDCTRLInstalled()
{
	return fIsActiveXInstalled;
}

function FInstallActiveX(fIgnoreCookie, wnd, fUseWndUrl)
{
	var strAxInstallStyle = "";
	if ("undefined" != typeof(strActiveXInstallStyle))
		strAxInstallStyle = strActiveXInstallStyle;

	if ("undefined" == typeof(fIgnoreCookie) || null == fIgnoreCookie)
		fIgnoreCookie = false;

	if ("undefined" == typeof(wnd) || null == wnd)
		wnd = window;

	if ("undefined" == typeof(fUseWndUrl) || null == fUseWndUrl)
		fUseWndUrl = false;

	if (!fIsActiveXInstalled &&
		!fInstallingActiveX &&
		fSupportsActiveX &&
		(fIgnoreCookie || FShouldPromptForAx()))
		{

		fInstallingActiveX = true;

		var strNewUrl = strAxInstall;
		strNewUrl = strNewUrl.replace("{0}", strAxInstallStyle);
		strNewUrl = strNewUrl.replace("{2}", strAxInstallReturnParameter);

		if (strNewUrl.indexOf('?') < 0)
			strNewUrl += '?';
		else
			strNewUrl += '&';

		strNewUrl += strAxIDName + '=' + strAxID;

		if (fUseWndUrl)
			strNewUrl = strNewUrl.replace("{1}", escape(wnd.location.pathname.slice(1) + wnd.location.search + wnd.location.hash));

		else
			strNewUrl = strNewUrl.replace("{1}", escape(document.location.pathname.slice(1) + document.location.search + wnd.location.hash));

		if (fAxVersionOverride)
		{
			if (strNewUrl.indexOf('?') < 0)
				strNewUrl += '?';
			else
				strNewUrl += '&';

			strNewUrl += "reqver=" + escape(strReqVersion);
		}

		wnd.location.href = strNewUrl;

		return false;
		}

	return fIsActiveXInstalled;
}

function StrRemoveParameterFromUrl(strUrl, strParam)
{

	return StrReplaceParam(strUrl, strParam);
}

function SetDontPrompt()
{
	if (chkDontPrompt.checked)
		{
		SetPersistentCookie("AWS_DontPrompt_Perm", "1");
		}
	else
		{
		mDeleteCookie("AWS_DontPrompt_Perm");
		}
}

function FIsActiveXInstalled(strAxId)
{
	switch (strAxId)
		{
		case "1": 
			return (typeof(DCTRL) != "undefined" &&
				typeof(DCTRL.LegitCheck) != "undefined")
		default: 
			return (typeof(DCTRL) != "undefined" &&
				typeof(DCTRL.Version) != "undefined")
		}
}

function FActiveXSupportsStartEditEx()
{
	return (typeof(DCTRL) != 'undefined' && typeof(DCTRL.StartEditEx) != 'undefined');
}

function ReturnToCaller()
{
	var strReturn;
	strParameter = unescape(strQueryStringParameter);

	if (0 == strParameter.length)
		strParameter = "1";

	if (FIsActiveXInstalled(strAxID))
		mDeleteCookie("AWS_DontPrompt_Perm");
	else
		mSetCookie("AWS_DontPrompt_Sess", 1);

	strReturn = strQueryStringReturn;

	if (0 == strReturn.length)
		location.replace(".");
	else if ("{1}" == strReturn)
		history.back();
	else
		{
		var regExp = /&amp;/g;
		strReturn = strReturn.replace(regExp, "&");
		strReturn = StrRemoveParameterFromUrl(strReturn, "AxInstalled");
		strReturn += (-1 == strReturn.indexOf("?")) ? "?" : "&";
		strReturn += "AxInstalled=" + unescape(strParameter);
		strReturn = StrRemoveParameterFromUrl(strReturn, "c");
		strReturn += "&c=" + strAxID;
		location.replace("http://" + location.hostname + "/" + strReturn);
		}
}

function SetInstallStatus(strAxId)
{
	document.getElementById("divStatus").style.display = "none";
	if (FIsActiveXInstalled(strAxId))
		document.getElementById("divSuccess").style.display = "inline";
	else
		{
		document.getElementById("divFailure").style.display = "inline";
		document.getElementById("opnlRetry").style.visibility = "visible";
		document.getElementById("btnRetry").disabled = false;
		}
}

function SafePrintWindow()
{
	try
		{
		window.print();
		}
	catch(e)
		{

		}
}

function TryChapter(e)
{
	var oCNFrm = document.frmChapterNav;
	if (!oCNFrm) return false;

	var oChapter = oCNFrm.ChapterNav;
	if (!oChapter) return false;

	var nIndex = oChapter.selectedIndex;
	var strUrl = oChapter[nIndex].value;
	if (typeof(strUrl) != "undefined" &&
		null != strUrl && strUrl.length > 0)
	{
		window.location.href = strUrl;
	}
}

function SStyle(selector,style)
{
	if (window.navigator.appName.toUpperCase().indexOf("NETSCAPE") >= 0)
	{
		SStyleNetscape(selector,style);
	}
	else if (window.navigator.userAgent.toUpperCase().indexOf("OPERA") >= 0)
	{
		SStyleOpera(selector,style);
	}
	else
	{
		SStyleIE(selector,style);
	}
}

function SStyleNetscape(selector,style)
{
	var e=document.createElement('style');
	e.type='text/css';
	var h=document.getElementsByTagName('head')[0];
	h.appendChild(e);
	var s=e.sheet;
	s.insertRule(selector+' {'+style+'}',s.cssRules.length);
}

function SStyleOpera(selector,style)
{
	var e=document.createElement('style');
	e.type='text/css';
	var h=document.getElementsByTagName('head')[0];
	e.appendChild(document.createTextNode(selector+' {'+style+'}'));
	h.appendChild(e);
}

function SStyleIE(selector, style)
{
	var o=document.styleSheets[document.styleSheets.length - 1]
	o.addRule(selector,style);
}

function SStyleH(selector)
{
	SStyle(selector, 'display:none;');
}

function FixPageForPrinting()
{
	AlterAllDivs('block');
	SWdthNF('_TopHtmlTableCell');
	SWdthNF('_TopHtmlTableCellChild');
	SWdthNF('_TopTmpltHtmlTable');
	SDsplyH('_BottomHtmlRightSide');
	SDsplyH('_Ont_LeftNav_Cell');
	SDsplyH('OntTocCell');
	SDsplyH('tblRatings');
	SDsplyH('m_RightNav');
	SDsplyH('_Ont_BrowserNotice');
	SStyleH('.RightNavBackgroundNew');
	SStyleH('.BOSiblingNav');
}



function AppSetToggleDiv(version)
{
	var imgExp = document.getElementById("imgAppSetExp" + version.toString());
	var divExp = document.getElementById("divAppSetExp" + version.toString());

	if (typeof(imgExp) == "undefined" || null == imgExp ||
		typeof(divExp) == "undefined" || null == divExp)
	{
		return;
	}

	if (divExp.style.display != "block")
	{
		divExp.style.display = "block";
		imgExp.src = "/global/images/appset_expanded.gif";
	}
	else
	{
		divExp.style.display = "none";
		imgExp.src = "/global/images/appset_expandable" + (fIsRTL ? "_rtl" : "") + ".gif";
	}

	if (window.event != null)
			window.event.cancelBubble = true;
}

function AppSetCollapseAllDivs()
{
	for (var i=8; i <= 12; i++)
	{
		var imgExp = document.getElementById("imgAppSetExp" + i.toString());
		var divExp = document.getElementById("divAppSetExp" + i.toString());

		if (typeof(imgExp) == "undefined" || null == imgExp || 
			typeof(divExp) == "undefined" || null == divExp)
		{
			continue;
		}

		divExp.style.display = "none";
		imgExp.src = "/global/images/appset_expandable" + (fIsRTL ? "_rtl" : "") + ".gif";
	}
}

function AppSetExpandAllDivs()
{
	for (var i=8; i <= 12; i++)
	{
		var imgExp = document.getElementById("imgAppSetExp" + i.toString());
		var divExp = document.getElementById("divAppSetExp" + i.toString());

		if (typeof(imgExp) == "undefined" || null == imgExp || 
			typeof(divExp) == "undefined" || null == divExp)
		{
			continue;
		}

		divExp.style.display = "block";
		imgExp.src = "/global/images/appset_expanded.gif";
	}
}

function AppSetExpandDiv(strVersion)
{
	var imgExp = document.getElementById("imgAppSetExp" + strVersion);
	var divExp = document.getElementById("divAppSetExp" + strVersion);

	if (typeof(imgExp) != "undefined" && null != imgExp &&
		typeof(divExp) != "undefined" && null != divExp)
	{
		if (divExp.style.display != "block")
		{
			divExp.style.display = "block";
			imgExp.src = "/global/images/appset_expanded.gif";
		}
	}
}

function AppSetAutoDetect()
{
	strDetectedApps = "";

	if(!FInstallActiveX())
	{
		if (window.location.href.toLowerCase().indexOf("axinstalled=1") < 0)
		{
			mDeleteCookie("AWS_DontPrompt_Sess")
			mDeleteCookie("AWS_AXInstalled_Sess")
		}

		if(!FInstallActiveX())
			return;
	}

	if (typeof(DCTRL) == 'undefined' || typeof(DCTRL.GetInstalledVersion) == 'undefined')
		return;

	ClearDetectedAppCheckboxes();

	AppSetCollapseAllDivs();

	var strPrefix = "cbAppSet";
	var rgAppCodes = strAppCodesToDetect.split(",");
	var cFound = 0;
	for (var i=0; i < rgAppCodes.length; i++)
	{
		rgAppCodes[i] = StrTrim(rgAppCodes[i]);

		if (null == rgAppCodes[i] || 0 >= rgAppCodes[i].length)
			continue;

		var strAppCode = rgAppCodes[i];

		if (null != strAppCode && 3 == strAppCode.length && 'Z' == strAppCode.charAt(0))
			strAppCode = strAppCode.substring(1, 3);

		if ("IP" == strAppCode)
			strAppCode = "XD";

		else if ("SPD" == strAppCode)
			strAppCode = "SDR";

		var iVer = DCTRL.GetInstalledVersion(strAppCode);
		if (!(iVer >= 8 && iVer <= 12))
			continue;

		var strVer = "";
		if (iVer < 10)
			strVer += "0";
		strVer += iVer.toString();
		strVer += "0";

		var cb = document.getElementById(strPrefix + rgAppCodes[i] + strVer);
		if (typeof(cb) == 'undefined' || null == cb)
			continue;

		cb.checked = true;
		cFound++;

		strDetectedApps += rgAppCodes[i] + strVer + "-";

		AppSetExpandDiv(iVer.toString());
	}

	if (cFound <= 0)
		AppSetExpandAllDivs();

	if (strDetectedApps.length > 0 && '-' == strDetectedApps.charAt(strDetectedApps.length-1))
		strDetectedApps = strDetectedApps.substring(0, strDetectedApps.length-1);

	AppSetSetStatus(1); 
}

function ClearDetectedAppCheckboxes()
{
	var rgInputs = document.getElementsByTagName("input");
	if ("undefined" == typeof(rgInputs) || null == rgInputs || 0 >= rgInputs.length)
		return;

	var strPrefix = "cbAppSet";
	for (var i=0; i < rgInputs.length; i++)
	{
		if (null == rgInputs[i] || "undefined" == typeof(rgInputs[i].id))
			continue;

		if (0 != rgInputs[i].id.indexOf(strPrefix))
			continue;

		if (undefined == typeof(rgInputs[i].type) || null == rgInputs[i].type)
			continue;

		if ("checkbox" != rgInputs[i].type)
			continue;

		rgInputs[i].checked = false;
	}
}

function AppSetSubmitApps()
{
	var rgInputs = document.getElementsByTagName("input");
	if ("undefined" == typeof(rgInputs) || null == rgInputs || 0 >= rgInputs.length)
		return;

	var strPrefix = "cbAppSet";
	var strSelectedApps = "";

	for (var i=0; i < rgInputs.length; i++)
	{
		if (null == rgInputs[i] || "undefined" == typeof(rgInputs[i].id))
			continue;

		if (0 != rgInputs[i].id.indexOf(strPrefix))
			continue;

		if (undefined == typeof(rgInputs[i].type) || null == rgInputs[i].type)
			continue;

		if ("checkbox" != rgInputs[i].type)
			continue;

		if (!rgInputs[i].checked)
			continue;

		strSelectedApps += rgInputs[i].id.substring(strPrefix.length);
		strSelectedApps += "-";
	}

	if (strSelectedApps.length > 0 && '-' == strSelectedApps.charAt(strSelectedApps.length-1))
		strSelectedApps = strSelectedApps.substring(0, strSelectedApps.length-1);

	if (typeof(window) == 'undefined' ||
		typeof(window.location) == 'undefined' ||
		typeof(window.location.href) == 'undefined')
	{
		return;
	}

	var strNewUrl = window.location.href;
	if (strNewUrl.indexOf('?') < 0)
		strNewUrl += '?';
	else
		strNewUrl += '&';
	strNewUrl += "postback=1";

	if (strNewUrl.indexOf("prevurl=") < 0 && null != strAppSetPrevUrl)
	{
		strNewUrl += "&prevurl=";
		strNewUrl += StrEncodeUrlComponent(strAppSetPrevUrl);
	}

	if (null != strSelectedApps && strSelectedApps.length > 0)
	{
		strNewUrl += "&sapps=";
		strNewUrl += StrEncodeUrlComponent(strSelectedApps);
	}

	if (null != strDetectedApps && strDetectedApps.length > 0)
	{
		strNewUrl += "&dapps=";
		strNewUrl += StrEncodeUrlComponent(strDetectedApps);
	}

	strNewUrl += "&CTT=98"; 

	window.location.href = strNewUrl;
}

function AppSetParseCookieAndSetCheckboxes()
{
	var strApps = GetCookie("_ofcapp", "");
	if (typeof(strApps) == 'undefined' || null == strApps || strApps.length <= 0)
		return;

	AppSetCollapseAllDivs();

	var rgstrApps = strApps.toUpperCase().split('-');
	var cFound = 0;
	for (var i=0; i < rgstrApps.length; i++)
	{
		var cb = document.getElementById("cbAppSet" + rgstrApps[i]);
		if (typeof(cb) == 'undefined' || null == cb)
			continue;

		cb.checked = true;
		cFound++;

		var strVersion = rgstrApps[i];
		while (strVersion.length > 0 && ('0' > strVersion.charAt(0) || '9' < strVersion.charAt(0)))
			strVersion = strVersion.substring(1);

		if (strVersion.length >= 3)
			strVersion = strVersion.substring(0, 2);

		while (strVersion.length > 0 && '0' == strVersion.charAt(0))
			strVersion = strVersion.substring(1);

		AppSetExpandDiv(strVersion);
	}

	if (cFound <= 0)
		AppSetExpandAllDivs();
}

function AppSetSetStatus(iStatus)
{
	if (0 == iStatus) 
	{
		document.getElementById("tdStep2Label1").className = "cdAppSetStepDisabled";
		document.getElementById("tdStep2Label2").className = "cdAppSetStepDisabled";
		document.getElementById("tdStep2Story").className = "cdAppSetStepStoryDisabled";
		document.getElementById("tdStep3Label1_0").className = "cdAppSetStepDisabled";
		document.getElementById("tdStep3Label2_0").className = "cdAppSetStepDisabled";
		document.getElementById("spnStep3_1").style.display = "none";
		document.getElementById("btnAppSetSave_0").disabled = true;
		document.getElementById("spnAppList").style.display = "none";
	}
	else if (1 == iStatus) 
	{
		document.getElementById("tdStep2Label1").className = "cdAppSetStepEnabled";
		document.getElementById("tdStep2Label2").className = "cdAppSetStepEnabled";
		document.getElementById("tdStep2Story").className = "cdAppSetStepStoryEnabled";
		document.getElementById("tdStep3Label1_0").className = "cdAppSetStepEnabled";
		document.getElementById("tdStep3Label2_0").className = "cdAppSetStepEnabled";
		document.getElementById("spnStep3_1").style.display = "block";
		document.getElementById("btnAppSetSave_0").disabled = false;
		document.getElementById("spnAppList").style.display = "block";
		document.getElementById("spnLnkManual").style.visibility = "hidden";
	}
	else 
	{
		document.getElementById("tdStep2Label1").className = "cdAppSetStepEnabled";
		document.getElementById("tdStep2Label2").className = "cdAppSetStepEnabled";
		document.getElementById("tdStep2Story").className = "cdAppSetStepStoryEnabled";
		document.getElementById("tdStep3Label1_0").className = "cdAppSetStepEnabled";
		document.getElementById("tdStep3Label2_0").className = "cdAppSetStepEnabled";
		document.getElementById("spnStep3_1").style.display = "block";
		document.getElementById("btnAppSetSave_0").disabled = false;
		document.getElementById("spnAppList").style.display = "block";
	}
}

function ApplyAppScope(strAppScope)
{
	strUrl = location.href;

	strUrl = StrRemoveParameterFromUrl(strUrl, "stt");
	strUrl = StrRemoveParameterFromUrl(strUrl, "sb");
	strUrl = StrRemoveParameterFromUrl(strUrl, "av");

	if (strAppScope == null || strAppScope.length == 0)
		location.href = strUrl;
	else if (strUrl.indexOf('?') > 0)
		location.href = strUrl + "&av=" + strAppScope;
	else
		location.href = strUrl + "?av=" + strAppScope;
}



function wmpCreate()
{
	try
	{
		wmp7Obj = new ActiveXObject("WMPlayer.OCX.7");
	}
	catch (e)
	{
	}

	var strAudioPath = decodeURI(GetOneShotCookie());

	if (typeof(wmp7Obj) == "object")
	{
		wmpCreateActiveX(strAudioPath);
		g_fWmp7 = true;
		wmp7 = 1;
	}
	else
	{
		wmpCreateDownLevel(strAudioPath);
		wmp6 = 1;
	}
}

function wmpCreateActiveX(strAudioPath)
{
	document.write('<object id="wmp" width="100%" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">');
	document.write('<param name="url" value="' + strAudioPath + '">');
	document.write('<param name="uimode" value="mini">');
	document.write('<param name="enablecontextmenu" value="false">');
	document.write('<param name="autostart" value="false">');
	document.write('</object>');
}

function wmpCreateDownLevel(strAudioPath)
{
	document.write('<object id="wmpold" width="255" height="40" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95">');
	document.write('<param name="filename" value="' + strAudioPath + '">');
	document.write('<param name="animationatstart" value="true">');
	document.write('<param name="autorewind" value="true">');
	document.write('<param name="autostart" value="false">');
	document.write('<param name="showaudiocontrols" value="true">');
	document.write('<param name="showpositioncontrols" value="false">');
	document.write('<param name="showstatusbar" value="false">')
	document.write('<embed type="application/x-mplayer2"');
	document.write('	pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"');
	document.write('	src="' + strAudioPath + '"');
	document.write('	width="225"');
	document.write('	height="40"');
	document.write('	animationstart="true"');
	document.write('	autorewind="true"');
	document.write('	autostart="true"');
	document.write('	showaudiocontrols="true"');
	document.write('	showpositioncontrols="true"');
	document.write('	showstatusbar="true"');
	document.write(' />');
	document.write('</object>');
}

function wmpInitialize(rgImgCache)
{
	if (!g_fWmp7)
	{
		document.getElementById('cdWmpActiveX').style.display = "none";
		document.getElementById('cdWmpEmbedded').style.display = "block";
		return;
	}

	for (i = 0; i < rgHover.length; i++)
		cacheImage(rgImgCache, rgHover[i]);

	for (i = 0; i < rgDown.length; i++)
		cacheImage(rgImgCache, rgDown[i]);

	wmpVolumeRender();
}

function wmpPlay()
{
	document.getElementById('wmp').controls.play();
	document.getElementById('imgWmpPause').style.display = 'inline';
	document.getElementById('imgWmpPause').focus();
	document.getElementById('imgWmpPlay').style.display = 'none';
	wmpIconBtnUp('imgWmpStop', 2 );
}

function wmpPause()
{
	document.getElementById('wmp').controls.pause();
	document.getElementById('imgWmpPause').style.display = 'none';
	document.getElementById('imgWmpPlay').style.display = 'inline';
	document.getElementById('imgWmpPlay').focus();
}

function wmpStop()
{
	if (rgDownState[2 ])
		return;

	document.getElementById('wmp').controls.stop();
	wmpIconBtnDown('imgWmpStop', 2 );
	document.getElementById('imgWmpPause').style.display = 'none';
	document.getElementById('imgWmpPlay').style.display = 'inline';
}

function wmpMuteToggle()
{
	wmpMute(!rgDownState[3 ]);
}

function wmpMute(fMute)
{
	document.getElementById('wmp').settings.mute = fMute;

	if (fMute)
		wmpIconBtnDown('imgWmpMute', 3 );
	else
		wmpIconBtnUp('imgWmpMute', 3 );
}

function wmpVolumeRender()
{
	var wmp = document.getElementById('wmp');
	var volume = wmp.settings.volume / 20;
	var strImgBase = 'imgWmpVol';

	for (i = 1; i <= 5; i++)
	{
		var imgVolume = document.getElementById(strImgBase + i);

		if (i <= volume)
			imgVolume.src = "/_Services/Ont/images/wmp_vol_on.gif";
		else
			imgVolume.src = "/_Services/Ont/images/wmp_vol_off.gif";
	}
}

function wmpVolumeDown()
{
	var wmp = document.getElementById('wmp');

	volNew = wmp.settings.volume - 20;
	if (volNew < 0)
		volNew = 0;
	wmp.settings.volume = volNew;
	wmpVolumeRender();
	wmpMute(false);

	wmpIconBtnDown('imgWmpVolDown', 4 );
	setTimeout("wmpIconBtnUp('" + "imgWmpVolDown" + "'," + 4  + ");", 100);
}

function wmpVolumeUp()
{
	var wmp = document.getElementById('wmp');

	volNew = wmp.settings.volume + 20;
	if (volNew > 100)
		volNew = 100;
	wmp.settings.volume = volNew;
	wmpVolumeRender();
	wmpMute(false);

	wmpIconBtnDown('imgWmpVolUp', 5 );
	setTimeout("wmpIconBtnUp('" + "imgWmpVolUp" + "'," + 5  + ");", 100);
}

function wmpIconOver(strImg, i)
{
	if (rgDownState[i])
		return;

	ctrl = document.getElementById(strImg);
	ctrl.src = rgHover[i];
}

function wmpIconOut(strImg, i)
{
	if (rgDownState[i])
		return;

	ctrl = document.getElementById(strImg);
	ctrl.src = rgDefault[i];
}

function wmpIconBtnDown(strImg, i)
{
	if (rgDownState[i])
		return;

	ctrl = document.getElementById(strImg);
	ctrl.src = rgDown[i];
	rgDownState[i] = true;
}

function wmpIconBtnUp(strImg, i)
{
	ctrl = document.getElementById(strImg);
	ctrl.src = rgDefault[i];
	rgDownState[i] = false;
}

function cacheImage(rgImgCache, strSrc) {
	var img = new Image();
	img.src = strSrc;
	rgImgCache.push(img);
}

function tocToggle(strai, iLevel)
{
	var img = document.getElementById('img' + strai);
	var div = document.getElementById('div' + strai);
	var fVisible = div.style.display != "none";

	if (!fVisible && div.innerHTML == "")
	{

		strDiv = '<div style="';
		if (fIsRTL)
			strDiv += 'margin-right:';
		else
			strDiv += 'margin-left:';
		strDiv += '20px\">';
		strDiv += g_strUpdatingText;
		strDiv += '</div>';		
		div.innerHTML = strDiv;
		div.style.display = "block";

		xmlHttp = GetXMLHttp();
		xmlHttp.open("GET", "/search/catquery.aspx?CategoryId=" + strai, true);
		xmlHttp.onreadystatechange = function()
		{
			if (xmlHttp.readyState == 4)
				tocExpandAsync(xmlHttp.responseXML.documentElement, iLevel);
		}
		xmlHttp.send(null);
	}
	else
	{
		div.style.display = fVisible ? "none" : "block";
		img.src = fVisible ? "/global/images/plus.gif" : "/global/images/minus.gif";
	}
}

function tocExpandAsync(xd, iLevel)
{
	if (xd == null)
		return;

	rgCategories = xd.getElementsByTagName("category");

	if (rgCategories == null || rgCategories.length != 1)
		return;

	strCategory = rgCategories[0].firstChild.nodeValue;

	divCategory = document.getElementById("div" + strCategory);
	divCategory.innerHTML = tocRenderSubCategories(xd, iLevel);
	divCategory.innerHTML += tocRenderAssets(xd, iLevel);
	divCategory.style.display = "block";

	imgCategory = document.getElementById("img" + strCategory);
	imgCategory.src = "/global/images/minus.gif";
}

function tocRenderSubCategories(xd, iLevel)
{
	if (xd == null)
		return "";

	rgSubCategories = xd.getElementsByTagName("subcat");

	if (rgSubCategories.length == 0)
		return "";

	strRet = '<ul class="cdTOCCategory" style=\"';

	if (fIsRTL)
		strRet += 'margin-right:';
	else
		strRet += 'margin-left:';

	strRet += (iLevel * 15);
	strRet += 'px\">';

	for (i = 0; i < rgSubCategories.length; i++)
	{
		nnm = rgSubCategories[i].attributes;
		id = nnm.getNamedItem("id").value;
		strTitle = nnm.getNamedItem("name").value;

		strRet += '<li><nobr>';

		strRet += "<a href=\"javascript:tocToggle('";
		strRet += id;
		strRet += "',";
		strRet += (iLevel + 1);
		strRet += ");\">";

		strRet += '<img id="img';
		strRet += id;
		strRet += '" title="';
		strRet += g_strExpandoAltText;
		strRet += '" src="/global/images/plus.gif" />';
		strRet += "</a>";
		strRet += '&nbsp;&nbsp;';
		strRet += '<b><a href="';
		strRet += id;
		strRet += '.aspx" title="';
		strRet += strTitle;
		strRet += '">';
		strRet += strTitle;
		strRet += '</a></b>';
		strRet += '</nobr></li>';

		strRet += '<div id="div';
		strRet += id;
		strRet += '" style="display:none"></div>';
	}

	strRet += '</ul>';
	return strRet;
}

function tocRenderAssets(xd, iLevel)
{
	if (xd == null)
		return "";

	rgAssets = xd.getElementsByTagName("asset");
	if (rgAssets.length == 0)
		return "";

	strRet = '<ul class="cdTOCContent">';

	for (i = 0; i < rgAssets.length; i++)
	{
		nnm = rgAssets[i].attributes;
		strTitle = nnm.getNamedItem("name").value;

		strRet += '<li><nobr><a href="';
		strRet += nnm.getNamedItem("id").value;
		strRet += '.aspx" title="';
		strRet += strTitle;
		strRet += '">';
		strRet += strTitle;
		strRet += '</a></nobr></li>';
	}

	strRet += '</ul>';
	return strRet;
}

function ShowPracticeVerWarning(strOffice)
{
	var divVerWarning = document.getElementById('divVersionWarning');
	var spnVerText = document.getElementById('spnVersionText');

	if (divVerWarning == 'undefined' || spnVerText == 'undefined')
		return;

	divVerWarning.style.display = 'block';
	spnVerText.innerHTML = strOffice;
}

function ResetUser()
{
	var exp = new Date();
	exp.setDate (exp.getDate() -10);
	document.cookie = "dname=" +
		"; expires=" + exp +
		"; path=/" +
		"; domain=" + StrHostRoot();

	document.cookie = "_ofcapp=" +
		"; expires=" + exp +
		"; path=/" +
		"; domain=" + StrHostRoot();

	document.cookie = "_ofcappgrp=" +
		"; expires=" + exp +
		"; path=/" +
		"; domain=" + StrHostRoot();

	location.href = location.href;
}

function StrHostRoot()
{
	var dmn = document.location.hostname;
	var rgdmn = dmn.split(".");
	if (rgdmn.length > 3)
	{
		var i = rgdmn.length - 3;
		dmn = rgdmn[i] + "." + rgdmn[i + 1] + "." + rgdmn[i + 2];
	}
	return dmn;
}

function NSelBasketCalcSpeed()
{
	return 56;
}

function FIsMPFPrefered()
{
	return
		!("CIL" == GetCookie("AWS_DownloadMethod_Sess").toUpperCase() ||
		(0 == GetCookie("AWS_DownloadMethod_Sess").length &&
			"CIL" == GetCookie("AWS_ClientURL_Sess").toUpperCase()));
}

function OpenInNewWnd(strUrl, ctt)
{
	if (ctt >= 0)
	{
		if (strUrl.indexOf("?") < 0)
			strUrl += "?";
		else
			strUrl += "&";

		strUrl += strCurrentVideoLoggingInfo;
		strUrl += ctt.toString();
	}

	window.open(strUrl, '_blank');
}

function OpenVideoPage(strAssetID, iStartIndex, nWidth, nHeight, strOrigin)
{
	if (typeof(strAssetID) == 'undefined' || null == strAssetID ||
		typeof(iStartIndex) == 'undefined' ||
		typeof(nWidth) == 'undefined' || typeof(nHeight) == 'undefined')
	{
		return;
	}

	var fHX = (0 == strAssetID.toUpperCase().indexOf("HX"));

	if (fHX)
	{
		nWidth = 0;
		nHeight = 0;
	}

	if (isNaN(iStartIndex))
		iStartIndex = 0;

	if (isNaN(nWidth) || isNaN(nHeight))
		return;

	if (typeof(strOrigin) == 'undefined' || null == strOrigin)
		strOrigin = "";

	var fNSorFF =
		window.navigator.appName.toUpperCase().indexOf("NETSCAPE") >= 0 ||
		window.navigator.appName.toUpperCase().indexOf("FIREFOX") >= 0;

	if (fNSorFF && !fHX)
	{
		OpenVideo(
			"/assistance/asstvid.aspx" +
			"?assetid=" + strAssetID +
			"&vwidth=" + nWidth.toString() +
			"&vheight=" + nHeight.toString() +
			"&type=mediaplayer" +
			"&CTT=11" +
			"&Origin=" + strOrigin,
			nWidth, nHeight);

		return;
	}

	var strUrl = "/home/video.aspx" +
		"?assetid=" + StrEncodeUrlComponent(strAssetID) +
		"&width=" + StrEncodeUrlComponent(nWidth.toString()) +
		"&height=" + StrEncodeUrlComponent(nHeight.toString()) +
		"&startindex=" + StrEncodeUrlComponent(iStartIndex.toString()) +
		"&CTT=11" +
		"&Origin=" + StrEncodeUrlComponent(strOrigin);

	if (fNSorFF && fHX)
	{
		window.location.href = strUrl + "&asx=1";
		return;
	}

	window.open(strUrl, "_OfficeVideoWindow",
		"toolbar=0,status=0,menubar=0,resizable=1," +
		"width=756" + 
		",height=580").focus(); 
}

function RgiGetVideoControlSize(fBig, nWidth, nHeight)
{
	if (nWidth < nVideoControlBigWidthMin)
	{
		nHeight = (nHeight * nVideoControlBigWidthMin + nWidth/2) / nWidth;
		nWidth = nVideoControlBigWidthMin;
	}

	if (nHeight < nVideoControlBigHeightMin)
	{
		nWidth = (nWidth * nVideoControlBigHeightMin + nHeight/2) / nHeight;
		nHeight = nVideoControlBigHeightMin;
	}

	if (nWidth > nVideoControlBigWidthMax)
	{
		nHeight = (nHeight * nVideoControlBigWidthMax + nWidth/2) / nWidth;
		nWidth = nVideoControlBigWidthMax;
	}

	if (nHeight > nVideoControlBigHeightMax)
	{
		nWidth = (nWidth * nVideoControlBigHeightMax + nHeight/2) / nHeight;
		nHeight = nVideoControlBigHeightMax;
	}

	if (!fBig)
	{
		if (nWidth == nVideoControlBigWidth1 && nHeight == nVideoControlBigHeight1)
		{
			nWidth = nVideoControlWidth1;
			nHeight = nVideoControlHeight1;
		}
		else if (nWidth == nVideoControlBigWidth2 && nHeight == nVideoControlBigHeight2)
		{
			nWidth = nVideoControlWidth2;
			nHeight = nVideoControlHeight2;
		}
		else if (nWidth == nVideoControlBigWidth3 && nHeight == nVideoControlBigHeight3)
		{
			nWidth = nVideoControlWidth3;
			nHeight = nVideoControlHeight3;
		}
		else
		{
			nWidth = (nWidth * nVideoControlWidthMax + nVideoControlBigWidthMax/2) / nVideoControlBigWidthMax;
			nHeight = (nHeight * nVideoControlHeightMax + nVideoControlBigHeightMax/2) / nVideoControlBigHeightMax;
		}
	}

	var rgnSize = new Array(2);
	rgnSize[0] = nWidth;
	rgnSize[1] = nHeight;

	return rgnSize;
}

function ResizeVideoPage(fBig)
{
	G("trTopSmall").style.display = fBig ? "none" : "";
	G("trTopFull").style.display = fBig ? "" : "none";
	G("trLogo").style.display = fBig ? "none" : "";

	G("tdRightSide").style.display = fBig ? "none" : "";
	G("trHelpLinks").style.display = fBig ? "none" : "";
	G("trBottom").style.display = fBig ? "none" : "";
	G("tdMiddle").className = fBig ? "cdVideoPageMiddleFull" : "cdVideoPageMiddle";

	G("trButtonsSmall").style.display = fBig ? "none" : "";
	G("trButtonsFull").style.display = fBig ? "" : "none";

	G("tdVideoFrameMidRight").height = fBig ? 412 : 116;

	var trSeeAlsoHdr = G("trSeeAlsoHeader");
	if (typeof(trSeeAlsoHdr) != "undefined" && null != trSeeAlsoHdr)
	{
		trSeeAlsoHdr.style.display = fBig ? "none" : "";
		G("trSeeAlsoBody").style.display = fBig ? "none" : "";
	}

	ResizeClientArea(
		fBig ? nVideoPageBigWidth : nVideoPageSmallWidth,
		fBig ? nVideoPageBigHeight : nVideoPageSmallHeight);

	G("tdVideoControl").height =
		(fBig ? nVideoControlBigHeightMax : nVideoControlHeightMax) + 64 + 2;

	ShowOrHideReadMoreLink(fBig);
	ResizeVideoControl(fBig);
}

function ResizeVideoControl(fBig)
{
	if (iCurrentVideo >= 0)
	{
		var rgnSize = RgiGetVideoControlSize(fBig, rgnVideoWidths[iCurrentVideo], rgnVideoHeights[iCurrentVideo]);
		G("objMediaPlayer").width = rgnSize[0];
		G("objMediaPlayer").height = rgnSize[1] + 64; 
	}
	else
	{
		G("objMediaPlayer").width = nVideoControlWidthMax;
		G("objMediaPlayer").height = nVideoControlHeightMax + 64; 
	}
}

function PlayNextVideoAsset()
{
	if (iCurrentVideo+1 < cFirstSectionSize)
		PlayVideoAsset(iCurrentVideo+1);
}

function OnReadMoreAboutThisClip()
{
	OpenInNewWnd(rgstrArticleUrls[iCurrentVideo], 6);
}

function StrGetVideoAssetUrl(index)
{
	var strCookie = GetOneShotCookie();
	if (0 == strCookie.length)
		return "";
	var rgstrUrl = strCookie.split("|");
	if (rgstrUrl.length != cPlaylistSize)
		return "";
	return decodeURI(rgstrUrl[index]);
}

function PlayVideoAsset(index)
{
	if (index < 0 || index >= cPlaylistSize)
		index = 0;

	for (var i=0; i < cPlaylistSize; i++)
	{
		G("trVideoPlaylist" + i.toString()).className =
			(i == index ? "cdVideoPlaylistRowActive" : "");

		G("tdVideoPlaylist" + i.toString()).className =
			(i == index ? "cdVideoPlaylistCellActive" : "cdVideoPlaylistCell");
	}

	G("objMediaPlayer").controls.stop();
	G("objMediaPlayer").url = StrGetVideoAssetUrl(index);

	window.setTimeout("G(\"objMediaPlayer\").controls.play();", 200);

	var fBig = (G("tdRightSide").style.display == "none");
	iCurrentVideo = index;
	strCurrentVideoLoggingInfo = "Origin=" + rgstrVideoAssetIDs[iCurrentVideo] + "&CTT=";
	ShowOrHideReadMoreLink(fBig);
	ResizeVideoControl(fBig);
}

function ShowOrHideReadMoreLink(fBig)
{
	var fHasArticle = (iCurrentVideo >= 0 && rgstrArticleUrls[iCurrentVideo].length > 0);

	G("trReadMore").style.display = ((fBig || fHasArticle) ? "" : "none");
	G("tdVideoProblems").style.paddingTop = (fHasArticle ? "4px" : "0px");
}

function FOgaInstall()
{
	if (!FIsCorrectVersion() || !FIsActiveXInstalled("1"))
	{
		if (!FInstallActiveX())
		{
			if (!fInstallingActiveX)
			{

				GotoDirectDownloadURLTemplates(19)
			}
			return false;
		}

	}
	return true;
}

function SetOgaStatus(strHash)
{
	var strLegit = "99";
	try
	{
		DCTRL.HashCode = strHash;
		strLegit = DCTRL.LegitCheck();
	}
	catch(e)
	{
		;
	}

	mSetCookie("oga_status", strLegit);
}*/


