/* Version: 12.0.4331 */
/*
	Copyright (c) Microsoft Corporation.  All rights reserved.
*/


function FChkSrchTxt(wz)
{
	var ws=/^[\s]*$/;
	return wz&&!ws.test(wz);
}

function FocSrchTxt(o)
{
	if (o && o.value)
	{
		if (strNonSearchString != null && strNonSearchString != 'undefined' && o.value == strNonSearchString && !fEnteredText)
		{
			o.value = '';
		}
		else
		{
			o.select();
		}
		setSearchOnColor(o);
		fEnteredText=true;
	}
}

function FTrySearch(e, strFormName, index)
{
	fSearchFocus = false;
	searchclose();

	//	var oSrchFrm = document.getElementById(strFormName);
	var oSrchFrm = document.forms[0];
	if ('undefined' != typeof(oSrchFrm) && null != oSrchFrm && SelectAction(oSrchFrm, index))
		{

		try {external.AutoCompleteSaveForm(oSrchFrm);} catch (err) {}
		oSrchFrm.submit();
		}

	if (e && e.stopPropagation)
		e.stopPropagation(); 

	return false;
}

function FEntTextbox(e, strFormName, index)
{
	if (e && 13 == e.keyCode)
		return FTrySearch(e, strFormName, index);

	return true;
}

function FBSCTrySearch(strFrmName, strSrchErr, strResultsUrl, iScope)
{
	var oSrchFrm = G(strFrmName);

	if (!oSrchFrm)
		return false;

	if (!FChkSrchTxt(G('BSCQU').value))
	{
		alert(strSrchErr);
		return false;
	}

	if (!oSrchFrm.av)
	{
		var inputAV = document.createElement("input");
		inputAV.id = "av";
		inputAV.name = "av";
		inputAV.type = "hidden";		
		oSrchFrm.appendChild(inputAV);
	}

	oSrchFrm.qu.value = G('BSCQU').value;
	oSrchFrm.av.value = G('BSCAV').value;
	oSrchFrm.sc.value = iScope;
	oSrchFrm.action = strResultsUrl;
	oSrchFrm.submit();
	return false;
}

function FOnClipartSearchKey(e)
{
	if (e && 13 == e.keyCode)
		SearchClipartFromCM();

	return true;
}

function SearchClipartFromCM()
{
	var nScope = 20; 

	if (document.getElementById("inputClpSrchClipart").checked)
		nScope = 21; 

	if (document.getElementById("inputClpSrchPhotos").checked)
		nScope = 22; 

	if (document.getElementById("inputClpSrchAnimations").checked)
		nScope = 23; 

	if (document.getElementById("inputClpSrchSounds").checked)
		nScope = 24; 

	var strQuery = document.getElementById("inputClpSrchText").value;
	if (null == strQuery || 0 >= strQuery.length || !FChkSrchTxt(strQuery))
	{
		alert(strClpSrchEmptyQuery);
		return;
	}

	var frm = document.getElementById("frmClipartSearch");
	frm.qu.value = strQuery;
	frm.sc.value = nScope.toString();
	frm.submit();
}

function FBSCEndTextbox(e, strFrmName, strSrchErr, strResultsUrl, iScope)
{
	if (e&&e.keyCode == 13) return FBSCTrySearch(strFrmName, strSrchErr, strResultsUrl, iScope);
	return true;
}

function FCheckElementID(strID)
{
	if ('undefined' == typeof(document.getElementById(strID)))
		return false;

	if (null == document.getElementById(strID))
		return false;

	return true;
}


function GetCookie(tName, DefaultReturn)
{
	if ("undefined" == typeof(DefaultReturn))
		DefaultReturn = "";

	var tArg = tName + "=";
	var nArgLen = tArg.length;
	var nCookieLen = document.cookie.length;
	var nStartPos = 0;

	while (nStartPos < nCookieLen)
		{
		var nEndPos = nStartPos + nArgLen;

		if (document.cookie.substring(nStartPos, nEndPos) == tArg)
			{
			var n2EndPos = document.cookie.indexOf(";", nEndPos);
			if (n2EndPos == -1)
				{
				n2EndPos = document.cookie.length;
				}
			return unescape(document.cookie.substring(nEndPos, n2EndPos));
			}

		nStartPos = document.cookie.indexOf(" ", nStartPos) + 1;
		if (nStartPos == 0)
			break;
		}

	return DefaultReturn;
}

function SetPersistentCookie(szName, szValue)
{
	var dateNow = new Date();
	var dateExpire = new Date();
	dateExpire.setTime(dateNow.getTime() + 1000 * 60 * 60 * 24 * 365);
	mSetCookie(szName, szValue, false, dateExpire);

	return;
}

function FIsVariableInCookie(szName, DefaultValue)
{
	if ("undefined" == typeof(DefaultValue))
		DefaultValue = "";

	return (DefaultValue != GetCookie(szName, DefaultValue));
}

function mSetCookie(tName, vValue)
{
	var aArgs = mSetCookie.arguments;
	var nArgs = mSetCookie.arguments.length;
	var bAppendToCurrentCookie = (nArgs > 2) ? aArgs[2] : false;
	var expires = (nArgs > 3) ? aArgs[3] : null;
	var path = (nArgs > 4) ? aArgs[4] : "/";
	var domain = (nArgs > 5) ? aArgs[5] : null;
	var secure = (nArgs > 6) ? aArgs[6] : false;

	if (bAppendToCurrentCookie && "" != GetCookie(tName))
		vValue = GetCookie(tName) + "," + vValue;

	document.cookie = tName + "=" + vValue +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");

	return;
}

function StrGetCookie(tName)
{
	return GetCookie(tName, "na");
}

function mDeleteCookie(tName)
{
	var exp = new Date();
	exp.setDate (exp.getDate() -10);
	mSetCookie(tName, "", false, exp);
}

function StrGetArgumentValue(strQueryName)
{
	var reQuery = new RegExp("[\\?&]" + strQueryName + "=([^&]*)", "i");

	if (!reQuery.test(location))
		return null;

	return reQuery.exec(location)[0].substring(strQueryName.length + 2);
}

function StrDisplayTitle()
{
	if ("undefined" == typeof(m_strDisplayTitle))
		return "?";

	return m_strDisplayTitle;
}


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 ShowElement(name)
{
	var objElement = ElmGetPageElementQuiz(name);
	if (objElement != null)
		{
		objElement.style.display = 'inline';
		}
}

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 modifyDisplayCount(nMaxLen, strTextBoxName, strSpanName)
{
	var txbBox = G(strTextBoxName);
	if (null == txbBox)
		return;

	var strDescr = txbBox.value;
	var nLen = nMaxLen - strDescr.length;
	var allSpans = document.body.getElementsByTagName("SPAN");	

	if (nLen >= 0) 
		{
		allSpans[strSpanName].className = 'OFLbl';
		allSpans[strSpanName].innerHTML = StrReplace(strGoDisplayCountOK, '{0}', '' + nLen)
		}
	else 
		{
		var strError = strGoDisplayCountOver;
		strError = StrReplace(strError, '{0}',  '' + (nMaxLen-nLen));
		strError = StrReplace(strError, '{1}',  '' + nMaxLen);
		allSpans[strSpanName].className = 'OILbl2';
		allSpans[strSpanName].innerHTML = strError;
		}	
}

function SetClipArtClientURLCookie()
{
	if (FIsMac() || null != StrGetArgumentValue("CAG"))
		mSetCookie("AWS_ClientURL_Sess", "CIL");

	return;
}

function ClipartPreviewCreateWMPControl()
{
	try
		{
		WMP7Obj = new ActiveXObject("WMPlayer.OCX.7");
		}
	catch(e)
		{

		}

	try
		{
		if (typeof(WMP7Obj) == "object") 
			{
			document.write('<OBJECT ID="MediaPlayer7" WIDTH="175" HEIGHT="175" CLASSID="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6">');
			document.write('<PARAM name="url" VALUE="' + sMediaURL + '">');
			document.write('<PARAM NAME="enablecontextmenu" VALUE="false">');
			document.write('<PARAM NAME="uimode" VALUE="mini">');
			document.write('<PARAM NAME="autostart" VALUE="true">');
			document.write('</OBJECT>');
			}
		else  
			{
			document.write('<OBJECT ID="MediaPlayer6" WIDTH="200" HEIGHT="200" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95">');
			document.write('<PARAM name="filename" VALUE="' + sMediaURL + '">');
			document.write('<PARAM NAME="animationatstart" VALUE="true">');
			document.write('<PARAM NAME="autorewind" VALUE="true">');
			document.write('<PARAM NAME="autostart" VALUE="true">');
			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="' + sMediaURL + '"');
			document.write('	NAME="MediaPlayer1"');
			document.write('	WIDTH="200"');
			document.write('	HEIGHT="200"');
			document.write('	ANIMATIONATSTART="true"');
			document.write('	AUTOREWIND="true"');
			document.write('	AUTOSTART="true"');
			document.write('	SHOWAUDIOCONTROLS="true"');
			document.write('	SHOWPOSITIONCONTROLS="false"');
			document.write('	SHOWSTATUSBAR="true">');
			document.write('</EMBED>');
			document.write('</OBJECT>');
			}
		}
	catch(e)
		{

		}
}

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 iVerMajor;
	var iVerMinor;
	var iVerBuild;
	var iVerRev;

	strVersion = GetCookie("AWS_ActivexVersion_Perm");
	if ("" == strVersion || "0" == strVersion)
		return false;

	rgstrVersion = strVersion.split(".");

	iVerMajor = Number(rgstrVersion[0]);
	iVerMinor = Number(rgstrVersion[1]);
	iVerBuild = Number(rgstrVersion[2]);
	iVerRev = Number(rgstrVersion[3]);

	var iReqVerMajor = 11;
	var iReqVerMinor = 0;
	var iReqRevMajor = 6006;
	var iReqRevMinor = 0;

	if (typeof(strOverwriteAXRequiredVersion) != 'undefined' &&
		null != strOverwriteAXRequiredVersion &&
		strOverwriteAXRequiredVersion.length > 0)
	{
		var rgstrReqVer = strOverwriteAXRequiredVersion.split(".");
		if (4 == rgstrReqVer.length)
		{
			iReqVerMajor = Number(rgstrReqVer[0]);
			iReqVerMinor = Number(rgstrReqVer[1]);
			iReqRevMajor = Number(rgstrReqVer[2]);
			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 fIsCorectVersion = FIsCorrectVersion();

	if (fIsCorectVersion)
		{

		document.write('<SPAN style="display:none"><OBJECT CLASSID="clsid:02BCC737-B171-4746-94C9-0D8A0B2C0089" ID="DCTRL" WIDTH="0" HEIGHT="0"></OBJECT></SPAN>');
		fIsActiveXInstalled = (typeof(DCTRL) != "undefined" &&	typeof(DCTRL.Version) != "undefined");

		if (!fIsActiveXInstalled)
			SetPersistentCookie("AWS_ActivexVersion_Perm", 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 (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 (typeof(strOverwriteAXRequiredVersion) != 'undefined' &&
			null != strOverwriteAXRequiredVersion &&
			strOverwriteAXRequiredVersion.length > 0)
		{
			if (strNewUrl.indexOf('?') < 0)
				strNewUrl += '?';
			else
				strNewUrl += '&';

			strNewUrl += "reqver=" + escape(strOverwriteAXRequiredVersion);
		}

		wnd.location.href = strNewUrl;

		return false;
		}

	return fIsActiveXInstalled;
}

function StrRemoveParameterFromUrl(strUrl, strParam)
{
	var strUpperUrl = strUrl.toUpperCase();
	var strUpperParam = strParam.toUpperCase();

	var iStart = strUpperUrl.indexOf("?" + strUpperParam);
	if (iStart < 0)
		iStart = strUpperUrl.indexOf("&" + strUpperParam);

	if (iStart < 0)
		return strUrl;

	var iEnd = strUpperUrl.indexOf("&", iStart+1);

	if (iEnd < 0)
		iStart--;

	var strRet = strUrl.substring(0, iStart+1);

	if (iEnd >= 0)
		strRet += strUrl.substring(iEnd+1, strUrl.length);

	return strRet;
}

function SetDontPrompt()
{
	if (chkDontPrompt.checked)
		{
		SetPersistentCookie("AWS_DontPrompt_Perm", "1");
		}
	else
		{
		mDeleteCookie("AWS_DontPrompt_Perm");
		}
}

function FIsActiveXInstalled()
{
	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";

	mSetCookie("AWS_DontPrompt_Sess", 1);

	if (FIsActiveXInstalled())
		mDeleteCookie("AWS_DontPrompt_Perm");

	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);
		location.replace("http://" + location.hostname + "/" + strReturn);
		}
}

function SetInstallStatus()
{
	document.getElementById("divStatus").style.display = "none";
	if (FIsActiveXInstalled())
		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 ElmGetSafeElement(strId)
{
	if (null == strId || 0 >= strId.length)
		return null;

	var element = document.getElementById(strId);
	if (typeof(element) == 'undefined')
		return null;

	return element;
}

function ResizeTabDivs(strCtrlId)
{

	if (typeof(navigator) != 'undefined' &&
		null != navigator &&
		typeof(navigator.appName) != 'undefined' &&
		null != navigator.appName)
		{
			if (navigator.appName.indexOf('Internet Explorer') >= 0 &&
				typeof(navigator.appVersion) != 'undefined' &&
				null != navigator.appVersion &&
				navigator.appVersion.indexOf('MSIE 7') >= 0)
			{
				return;
			}

			if (navigator.appName.indexOf('Netscape') >= 0)
				return;
	}

	var strExtraLinkDivId = null;
	eval("if (typeof(strExtraLinkDivId_" + strCtrlId + ") != 'undefined')" +
		"strExtraLinkDivId = strExtraLinkDivId_" + strCtrlId + ";");

	var nExtraLinkDivOrigHeight = -1;
	if (null != strExtraLinkDivId)
		eval("nExtraLinkDivOrigHeight = nExtraLinkDivOrigHeight_" + strCtrlId + ";");

	var strPrefix = "divTabCtrl_" + strCtrlId + "_";
	var fNeedDivs = false;
	var rgDivs = null;

	eval("if (null == rgTabCtrlDivs_" + strCtrlId + ") fNeedDivs = true;");
	if (fNeedDivs)
	{
		rgDivs = new Array();
		rgAllDivs = document.getElementsByTagName("div");
		for (var i=0; i < rgAllDivs.length; i++)
		{
			if (typeof(rgAllDivs[i].id) == "undefined" ||
				null == rgAllDivs[i].id ||
				0 != rgAllDivs[i].id.indexOf(strPrefix))
			{
				continue;
			}

			rgDivs[rgDivs.length] = rgAllDivs[i];
		}

		eval("rgTabCtrlDivs_" + strCtrlId + " = rgDivs;");
	}
	else
	{
		eval("rgDivs = rgTabCtrlDivs_" + strCtrlId + ";");
	}

	var nMaxHeight = 0;
	var nNewHeight = 0;
	for (var i=0; i < rgDivs.length; i++)
	{
		var nHeight = rgDivs[i].offsetHeight;
		if (nHeight > nMaxHeight)
			nMaxHeight = nHeight;

		if (null != strExtraLinkDivId && rgDivs[i].id == strExtraLinkDivId)
		{
			if (nHeight > 0 && nExtraLinkDivOrigHeight <= 0)
			{
				eval("nExtraLinkDivOrigHeight_" + strCtrlId + " = " + nHeight.toString() + ";");
				nExtraLinkDivOrigHeight = nHeight;
			}

			nNewHeight = nHeight;
		}
	}

	var strMaxHeight = nMaxHeight.toString();
	for (var i=0; i < rgDivs.length; i++)
		rgDivs[i].style.height = strMaxHeight + "px";

	if (nNewHeight > 0)
	{
		nNewHeight = nMaxHeight + 8 - nExtraLinkDivOrigHeight;
		var tdExtraLinkPadding = ElmGetSafeElement("tdExtraLinkPadding_" + strCtrlId);
		tdExtraLinkPadding.style.height = nNewHeight.toString() + "px";
	}
}



function DeleteChildElement(strChild)
{
	elmChild = document.getElementById(strChild);
	if ('undefined' == typeof(elmChild) || null == elmChild)
		return;

	var elmParent = elmChild.parentNode;
	if ('undefined' == typeof(elmParent) || null == elmParent)
		return;

	elmParent.removeChild(elmChild);
}

function offset(object, alignment) {
	var nOffset = 0;

	if (object == null)
		return nOffset;

	while (object.offsetParent) {
		nOffset += ((alignment == 'x') ? object.offsetLeft : object.offsetTop);
		object = object.offsetParent;
	}

	return nOffset;
}

function setNonSearchString(searchBox)
{
	if (searchBox != null && searchBox != 'undefined' && searchBox.value == '')
	{
		searchBox.value = strNonSearchString;
		setSearchOffColor(searchBox);
		fEnteredText = false;
	}
}

function setSearchOffColor(searchBox)
{
	searchBox.className = 'cdsearchbox cdSearchBoxOffColor';
}

function setSearchOnColor(searchBox)
{
	searchBox.className = 'cdsearchbox cdSearchBoxOnColor';
}

function delayedclose()
{
	fSearchFocus = false;
	window.setTimeout('searchclose()', 400);
}

function setSearchFocus()
{
	fSearchFocus = true;
}

function searchclose()
{
	var searchdrop = document.getElementById('cdsearchoutcdsdrop');
	if (searchdrop != null && searchdrop != 'undefined')
	{
		if (fSearchFocus == false)
		{
			searchdrop.style.display = 'none';
			fSearchOn = false;
		}
	}
}

function searchout()
{
	var searchdrop = document.getElementById('cdsearchoutcdsdrop');
	if (searchdrop != null && searchdrop != 'undefined' && fSearchOn == true)
	{
		searchdrop.style.display = 'none';
		fSearchOn = false;
	}
	else
	{
		var buttonleft = document.getElementById('cdsdropleft');
		var buttonmiddle = document.getElementById('cdsdrop');

		if (buttonleft != null && buttonleft != 'undefined' &&
			buttonmiddle != null && buttonmiddle != 'undefined' && 
			searchdrop != null && searchdrop != 'undefined')

		{
			var newleft = offset(buttonleft, 'x');
			var newtop = offset(buttonleft, 'y');

			searchdrop.style.display = 'none';
			searchdrop.style.position = 'absolute';

			if (fIsRTL)
			{				
				newleft = offset(buttonmiddle, 'x');
				searchdrop.style.left = newleft + 'px';
			}
			else
			{			
				searchdrop.style.left = newleft + 'px';
			}
			searchdrop.style.top = newtop + buttonmiddle.offsetHeight + 'px';

			searchdrop.style.display = 'block';

			fSearchOn = true;
		}
	}
}

function resizeSearchBox()
{
	var input = document.getElementById('frmSearch_tbQueryStr');
	var container = document.getElementById('tdSearchBox');
	if (input != null && input != 'undefined' && container != null && container != 'undefined')
	{
		var conwidth = container.offsetWidth;
		input.style.width = conwidth - 10 + 'px';

		if (input.value != strNonSearchString)
		{
			fEnteredText = true;
			setSearchOnColor(input);
		}
	}
}

function cacheImage(rgImgCache, strSrc) {
	var img = new Image();
	img.src = strSrc;
	rgImgCache.push(img);
}

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;
}