/* ***************************************************************** */
/*                                                                   */
/* IBM Confidential                                                  */
/*                                                                   */
/* OCO Source Materials                                              */
/*                                                                   */
/* Copyright IBM Corp. 2007, 2008                                    */
/*                                                                   */
/* The source code for this program is not published or otherwise    */
/* divested of its trade secrets, irrespective of what has been      */
/* deposited with the U.S. Copyright Office.                         */
/*                                                                   */
/* ***************************************************************** */

/* 5724-S31                                                          */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */
/*                                                                   */
/*********************************************************************/


/*supporting util to show quickr stuff*/
QuickrSetupSupportUtil = {

	currentPageType: "list.htm",

	init: function()
	{
		//override the css stuff for the OneUI
		QuickrLocaleUtil.loadCssFiles("/qphtml/skins/setup", "setup.css");
		
		if (typeof(dojo) !="undefined") {
			dojo.addOnLoad(function(){
				QuickrSetupSupportUtil.massageUi();

			});
		}
	},
	

	massageUi: function ()
	{
		try {
			//clean up the body tag
			document.body.removeAttribute("class");
			
			
			// Show TOC if not empty
			var tocList=document.getElementById("tocList");
			if (tocList) {
				var tocItems=tocList.getElementsByTagName("li");

				var bShowTocList = 0;
				for (var i = 0; i < tocItems.length; ++i) {
					var item = tocItems[i];
					var aNode = item.childNodes[0];
					if (aNode) {
						var divNode = aNode.childNodes[0];
						if (divNode) {
							if (divNode.style == undefined) {
								bShowTocList = 1;
							}
							else if (divNode.style.display == "block") {
								bShowTocList = 1;
							}
						}
					}
				}

				if (tocItems.length>0 && bShowTocList) {
					var toc = document.getElementById("menu1");
					toc.style.display="block";
				}
			}			
			

			if (this.currentPageType == "list.htm") {
			
			
				var navBot=document.getElementById("pageContentNavBot");
				if (h_SetReadScene.indexOf("h_MyPlaces")>-1) {
					navBot.style.display="block";
				}
				else {
					var actions=document.getElementById("actions");
					actions.style.display="block";
				}

				if (typeof(G_LdapSearchUIHint) != "undefined" && G_LdapSearchUIHint != null) {
					var elHint = document.getElementById("memberAddHint");
					if (elHint) {
						elHint.innerHTML = G_LdapSearchUIHint;
					}
				}


				var pTab=document.getElementById("placesTab");
				var sTab=document.getElementById("statsTab");
				if (pTab && sTab) {
					// Change test of usage stats because this SC does not respect replaceString
					var sTabA=sTab.getElementsByTagName("a");
					if (sTabA.length>0)
						sTabA[0].innerHTML=QuickrLocaleUtil.getStringResource("PAGE.USAGESTATISTICS");
					// Select correct places tab
					if (location.href.indexOf("MyPlacesDetails")>-1) {
						pTab.className="";
						sTab.className="lotusSelected";
					}
					else {
						sTab.className="";
						pTab.className="lotusSelected";
					}
				}


				if (h_SetReadScene == "h_MyPlacesList")
					QuickrGeneralUtil.showClassesIfTrue("lotusInfoBox", true );

				
			}
			else if (this.currentPageType == "edit.htm") {


				if (typeof(h_StepNumber) != "undefined") {
					if ((h_StepNumber == 2) && (h_SetEditNextScene == ""))
						QuickrGeneralUtil.showClassesIfTrue("lotusInfoBox", true );

					if ((h_StepNumber == 2) && (h_SetEditNextScene == "h_CreateAnimation"))
						QuickrGeneralUtil.hideClassesIfTrue("lotusHeader", true );
				}


			}
			else if (this.currentPageType == "page.htm") {


				if(h_SetReadScene =="h_AdminInstructions") {
					var siteadmin = document.getElementById("siteadmin");
					siteadmin.style.display="block";
				}


			}




			var SC_connDL = qp_getElementsByClassName("SC_conn_dl");
			var connDLs = qp_getElementsByClassName("conn_dl");
			if (SC_connDL) {
				for (var i = 0; i < connDLs.length; i++) {
					connDLs[i].href = SC_connDL[0].href;
				}
			}


			QuickrSetupUtil.showQuickrContent();

			QuickrGeneralUtil.hideClassesIfTrue("ConnectorSection", !h_ClientBrowser.isPlatformWin() );

			//SPR #LWOY7BZVQQ
			if (currentUserAccess >= 6)
				QuickrGeneralUtil.showClassesIfTrue("qpAdmin", true );



			var pNode = document.getElementById('pageTitlePlaces');
			var fNode = document.getElementById('pageTitleFiles');

			QuickrSetupUtil.fixPageTitle(pNode, 'PAGE.PLACES');
			QuickrSetupUtil.fixPageTitle(fNode, 'PAGE.FILES');			
			

			this.showMainFrame();
		}
		catch (e) {
			this.showMainFrame();
		}
	},
 
	showMainFrame: function() {
		// outermost tag in body
		var frame = dojo.byId("lotusFrame");
		if (frame) {
			frame.style.display = "block";
		}	
	}
}
