﻿/* ***************************************************************** */
/*                                                                   */
/* 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. */
/*                                                                   */
/*********************************************************************/

// QUICKR 8.1 THEME SUPPORT
var theme_name='quickr81';
var theme_imgLoc = '/qphtml/skins/quickr81/images/';

// CSS LOADER

function quickr81_preloadStyles()
{

	QuickrLocaleUtil.loadCssFiles("/qphtml/skins/quickr81", "Quickr81.css");
	
}


// SHOULD BE COMMON:

function _qp_isOkToAppend(newval, curval) {
	return (typeof(newval) != "undefined" && newval != "" && curval.indexOf(newval) == -1);
}
function _qp_hideIfTrue(id, yn) {
	if (yn) {
		var trg=dojo.byId(id);
		if (trg) {
			trg.style.display="none";
		}
	}
}
function _qp_showBreadcrumbs() {
	var frm=document.forms["h_PageUI"];
	if (frm && frm.h_SetEditCurrentScene && frm.h_SetEditCurrentScene.value) {
		if (frm.h_SetEditCurrentScene.value.indexOf("Animation") > -1) {
			return true;
		}
	}
	return false;
}

function twistAndCollapse(t,h)
{
	el=dojo.byId(h);
	if (el) {
		c=t.className;
		if (c.indexOf('lotusTwistyOpen')>=0) {
			el.style.display='none';
			t.title=t.title.replace(/collapse/,'expand');
			return c.replace(/Open/,'Closed');
		}
		else {
			el.style.display='block';
			t.title=t.title.replace(/expand/,'collapse');
			return c.replace(/Closed/,'Open');
		}
	}
}

function clearForm(id) 
{
	var els=dojo.byId(id).getElementsByTagName("input");
	var el;
	for (i=0; el=els.item(i); i++) {
		var type=el.getAttribute('type');
		if (type=="text" || type=="password") {
			el.value="";
		}
	}
}



// BREADCRUMB

function theme_writeCrumbSuffix() {
	var bc = dojo.byId("crumb");
	var bc_suffix = dojo.byId("crumb_suffix");

	var s="";
	if (bc && bc_suffix) {
		if (_qp_isOkToAppend(currentRoom.roomTitle, bc.innerHTML) ) {
			s=currentRoom.roomTitle;
		}
		//SPR #XCDL7AZE6E: h_Name is undefined
		//else if (_qp_isOkToAppend(h_Name , bc.innerHTML) ) {
		//	s=h_Name;
		//}
	}

	if (bc && s.length > 0) {
		bc_suffix.innerHTML=">"+s
	}
}


/*supporting util to show quickr stuff*/
Quickr81SupportUtil = {

	currentPageType: "listfolder.htm",
	bNewUsersAllowed: 1,

	init: function()
	{
		// Get preferences from cookie or defaults
		this.getPrefs();

		//override the css stuff for the OneUI
		quickr81_preloadStyles();
		
		Quickr81SupportUtil.loadBlogScripts();

		//load an external js file
		QuickrGeneralUtil.loadSupplementalScript("/qphtml/skins/quickr81/scripts/Quickr81_ext.js");
		
		if (typeof(dojo) !="undefined") {
			dojo.addOnLoad(function(){
				//init the locale stuff
				QuickrLocaleUtil.loadStringFiles("quickr81", "/qphtml/skins/quickr81", "Quickr81Strings");
				
				//load blog stuff if it is blog place
				Quickr81SupportUtil.loadBlogInfo();
				
				QuickrGeneralUtil.hideClassesIfTrue("ConnectorSection", !h_ClientBrowser.isPlatformWin() );
				
				Quickr81SupportUtil.massageUi();
				
				QuickrSetupUtil.adjustPrefilledTextBox("searchtext");
			});
		}
	},
	
	isBlogPlace: function () {
		var ret = false;
		
		if (!ret) ret = ( typeof(window.G_PlaceType) != "undefined" && window.G_PlaceType.toLowerCase() == "blog" );
		if (!ret) ret = ( typeof(window.c_BlogDate) != "undefined" );
		if (!ret) ret = this.isBlogPage();
		
		return ret;
	
	},
	
	isWikiPlace: function () {
		var ret = false;
		
		if (!ret) ret = ( typeof(window.G_PlaceType) != "undefined" && window.G_PlaceType.toLowerCase() == "wiki" );
		
		return ret;
	
	},	
	
	isBlogPage: function () {
		return ( typeof(window.c_Form) != "undefined" && (window.c_Form.toLowerCase() == "qpreference" || window.c_Form.toLowerCase() == "blogentry") );

	},
	
	loadBlogScripts: function() {
		if ( Quickr81SupportUtil.isBlogPlace() ) {
			//load the necessary JS Files
			var head = document.getElementsByTagName("head");
			if (head && head[0]) {

				var oLinkObj = document.createElement("link");
				oLinkObj.setAttribute("href", "/qphtml/html/templatecommon/QBlog.css");
				oLinkObj.setAttribute("type", "text/css");
				oLinkObj.setAttribute("rel", "stylesheet");

				var oJSStringsObj = document.createElement("script");
				oJSStringsObj.setAttribute("src", "/qphtml/html/templatecommon/qp_strings.js");
				oJSStringsObj.setAttribute("type", "text/javascript");

				var oJSAjaxObj = document.createElement("script");
				oJSAjaxObj.setAttribute("src", "/qphtml/html/templatecommon/qp_ajax.js");
				oJSAjaxObj.setAttribute("type", "text/javascript");

				var oJSPLObj = document.createElement("script");
				oJSPLObj.setAttribute("src", "/qphtml/html/templatecommon/qp_blog_pagelayout.js");
				oJSPLObj.setAttribute("type", "text/javascript");

				var oHeadLoc = head[0];
				oHeadLoc.appendChild(oLinkObj);
				oHeadLoc.appendChild(oJSStringsObj);
				oHeadLoc.appendChild(oJSAjaxObj);
				oHeadLoc.appendChild(oJSPLObj);			
			}
		}
	},
	
	loadBlogInfo: function () {

		if ( Quickr81SupportUtil.isBlogPlace() ) {
			
			//load the necessary JS Files
			var head = document.getElementsByTagName("head");
			if (head && head[0]) {

				var elImg;
				
				elImg = document.createElement("img");
				elImg.id = "icn_page_link"
				elImg.src = "/qphtml/html/common/images/page_link.png";
				elImg.style.display = "none";
				document.body.appendChild(elImg);
				
				elImg = document.createElement("img");
				elImg.id = "icn_email"
				elImg.src = "/qphtml/html/common/images/email.png";
				elImg.style.display = "none";
				document.body.appendChild(elImg);
				
				elImg = document.createElement("img");
				elImg.id = "icn_printer"
				elImg.src = "/qphtml/html/common/images/printer.png";
				elImg.style.display = "none";
				document.body.appendChild(elImg);
			
				var elCrumb = dojo.byId("crumb");
				if (elCrumb) {
					elCrumb.style.display = "none";
				}
				
				if ( Quickr81SupportUtil.isBlogPage() ) {
					var elHeader = qp_getElementsByClassName("lotusHeader","div",document.body);				
					if (elHeader && elHeader[0]) {
						elHeader[0].style.display = "none";
					}
				}
				
				//remove the advanced search link
				for (var i = document.links.length-1; i >= 0; i--) {
					var lnk = document.links[i];
					if (lnk.href == "javascript:AdvSearchFormSubmit()") {
						lnk.parentNode.removeChild(lnk);
					}
				}
				
				
			}
			
			if ( h_isBeingEdited ) {
				if (typeof(initPrefEdit) != "undefined") {
					initPrefEdit();
				}
			} else {
				if (typeof(initPrefRead) != "undefined") {
					initPrefRead();
				}
			}			
		}
	},

	prefs: {"fNav":0},
	prefsCookie: "prefs_quickr81_" + escape(haiku.userName),

	getPrefs: function() {
		var szPrefs=QuickrCookieUtil.getCookie(this.prefsCookie);
		if (szPrefs) {
			// folder has a prefs cookie - get prefs from it
			var p=eval(unescape('(' + szPrefs + ')')); 
			this.prefs=p;
		}
		else {
			// no cookie - get prefs from URL or use defaults
			this.prefs.fNav="0";
		}
	},

	setPrefs: function() {
		var dt=new Date(QuickrCookieUtil.getExpireDate("365"));
		var szPrefs = escape('{'
		+ '"fNav":"' + this.prefs.fNav + '"'
		+ '}');
		QuickrCookieUtil.setCookie(this.prefsCookie, szPrefs, dt);
	},

	toggleFNav: function() {
		this.prefs.fNav=(this.prefs.fNav==0 ? 1 : 0);
		this.setPrefs();
		this.showFNav();
	},

	showFNav: function() {
		var bShow=(this.prefs.fNav=="1");
		var el = dojo.byId("toc");
		if (el) {
			el.style.display=(bShow?"inline":"none");
			dojo.byId("fNavShow").style.display=(bShow?"none":"inline");
			dojo.byId("fNavHide").style.display=(bShow?"inline":"none");
		} else {
			dojo.byId("fNavShow").style.display="none";
			dojo.byId("fNavHide").style.display="none";
		}	
	},

	showNavRScenes: ["h_TailorIntroRead", "h_TailorDecorateMain", "h_TailorSkinIndex"],
	showNavEScenes: ["h_StdPageFormIndex", "h_TailorDecorateSkins"],

	massageUi: function ()
	{
		try {
			//clean up the body tag
			document.body.removeAttribute("class");
			
			// show/hide stuff if (not) offline
			if (typeof(h_InstallType)!="undefined" && h_InstallType == "2") {
				this.massageOffline();
			}
			
			//fix the imgs with the align attribute to wrap correctly in IE
			if (h_CurrentSkinType == "h_Page" && h_ClientBrowser && h_ClientBrowser.isIE() ) {
				var elRT = getElementsByClassName("richTextContainer", "*", document.body);
				if (elRT && elRT.length > 0) {
					var elImgs = elRT[0].getElementsByTagName("img");
					for (var ii = 0; ii < elImgs.length; ii++) {
						var attAlign = elImgs[ii].getAttribute("align").toLowerCase();
						if (attAlign == "right" || attAlign == "left") {
							elImgs[ii].setAttribute("style","float:" + attAlign);
							elImgs[ii].style.styleFloat = attAlign;							
						}
					}					
				}
			}

			if (typeof(h_SystemName)!="undefined") {
				switch (h_SystemName) {
					case "h_Welcome":
					case "h_RoomInstructions":
					case "h_PageLibraryInstructions":
					case "h_TeamGoals":
					case "h_TeamTasks":
					case "h_Accessories":
					
						/*********************************
						* SPR #PNOT7JD3FK - bbarber
						* We do not want the default font 
						* for the editor for these pages.
						* Remove the id attribute.
						*********************************/
						var elRead = dojo.byId("HaikuEditorRead");
						if (elRead) elRead.removeAttribute("id");					

						if (document.body.dir == 'rtl') {

							elImgs = document.images;
							if (elImgs && elImgs.length > 0) {
								for (var ii = 0; ii < elImgs.length; ii++) {
									if (elImgs[ii].src && elImgs[ii].src.indexOf("silverbullet.gif") > -1) {
										if (elImgs[ii].src.indexOf("/") == 0) {
											elImgs[ii].src = ximg.src.replace(/silverbullet.gif/,"silverbullet_rtl.gif");
										} else {
											elImgs[ii].src = "/qphtml/html/common/silverbullet_rtl.gif";
										}
									}
								}
							}
						}
						break;
				}
			}
			
			//if we are in animation, don't show the title...
			var elHeader = dojo.byId("lotusMainHeader");
			if (elHeader && h_SetEditNextScene != "h_StdPageAnimation") {
				elHeader.style.display = "block";
			}			

			var nI=0;
			var m2ul=dojo.byId("menu2ul");
			var m2items=dojo.byId("menu2items");
			if (m2ul && m2items) {
				var el=qp_getElementsByClassName("item", "ul", m2items);
				for (var i=0; i < el.length; i++) {
					 m2ul.innerHTML += el[i].innerHTML;
					 nI++;
				}
				if (nI>0) {
					 var m2=dojo.byId("menu2");
					 if (m2)
							m2.style.display="block";
				}
			}

			if (this.currentPageType == "listfolder.htm") {
				// SPR #XHKG7BG9LD
				var tags = getElementsByClassName("lotusFirst", "*", document.body);
				for(var i = 0; i < tags.length; i++) {
					QP_ContextMenu_attachMenus(tags[i]);
				}
				switch (fieldNames.h_SetReadScene) {
				case "h_MembersView":
					MM.init();
					// Fix SPR #AGAI7AXQGH "TAP: Local Users can be created when New Users Disallowed"
					if (!this.bNewUsersAllowed) {
						var btn = dojo.byId("createMembersBtn");
						if (btn) {
							btn.style.display = "none";
						}
					}
					FM.view.reqData(); // load the initial view
					break;
				case "h_StdFolderRead":
				case "h_AbstractsFolderRead":
					var fS = getFolderStyle();
					if (fS=="5" || fS=="h_Index" || fS=="7" || fS=="1") {
						this.showFNav();
					}
					FM.view.init();
					FM.view.displayView();
					break;
				case "h_GanttView":
				case "h_TaskList":
					FV.tasks.init();
					// show paging skin components
					this.useSkinComponent("itemsPerPage");
					this.useSkinComponent("pgButtons");
					break;
				case "h_CalendarRead":
					FV.calendar.init();
					break;
				case "h_StdPageRead":
					// e.g., What's New
					if (fieldNames.h_SetEditScene=="h_SearchResults") {
						// search results: show paging buttons & hide itemsPerPage i.e. 10, 20, 30...
						dojo.byId("pageNavBar").style.display="block";
						dojo.byId("itemsPerPage").style.display="none";
						this.useSkinComponent("pgButtons");
					} else {
						QuickrGeneralUtil.hideClassesIfTrue("lotusPaging",true,true);
					}
					break;
				case "h_SearchPlacesResults":
					// results from Search All Places
					this.massagePgBtns();
					break;
				default:
					break;
				}
			}
			else if (this.currentPageType == "edit.htm") {

				//if for some reason we have an issue displaying the page, reload it.
				//SPR #KABS7G5NAU	
				if (	typeof(theForm) != "undefined" && 
					typeof(h_NoSceneTrail) != "undefined" && h_NoSceneTrail == "1" &&
					typeof(h_SetEditScene) != "undefined" && h_SetEditScene == "h_StdPageEdit" && 
					typeof(abPreSubmit) == "undefined") {
						window.location.href = window.location.href;

				}

				// Nav hidden; show for certain pages using Edit skin
				if (this.showNavRScenes.indexOf(h_SetReadScene) > -1 || this.showNavEScenes.indexOf(h_SetEditScene) > -1) {
					dojo.byId("lotusColLeft").style.display="block";
					dojo.byId("lotusFooter").style.display="block";
				}

// BEGIN MAYETIC CODE =>  MCH 02/03/2010
				if ((h_SetEditScene == "h_FolderCreate") || (h_SetEditScene == "h_FolderEditOrderedPages")) {
					dojo.byId("lotusColLeft").style.display="block";
				}	// <=  END MAYETIC CODE

				//if wiki, reassign the jump presubmit
				if ( Quickr81SupportUtil.isWikiPlace() ) {
					window.abPreSubmit_orig = window.abPreSubmit;
					window.abPreSubmit = function(stype) {
						var bCopyOrig = false;
						window.bSubmit = true;
						if (typeof(theForm.c_IsCurrentRevision) != "undefined") {
							if (stype == "h_Jump" && window.h_PublishedVersionUNID != "") {
								bCopyOrig = true;
							} else
							if (stype == "h_Next" && theForm.h_getPublishAction) {
								var fld = theForm.h_getPublishAction;

								if (fld && fld.length > 0) {
									for (var ii = 0; ii < fld.length; ii++) {
										if (fld[ii].value == "h_Publish" && fld[ii].checked) {
											bCopyOrig = true;
										}
									}
								}

							}
							theForm.c_IsCurrentRevision.value = "1";
						}
						
						if (bCopyOrig) {
							var sURL = QuickrGeneralUtil.getBaseUrl() + "/copyWiki?Open&id=" + window.h_PublishedVersionUNID;
							window.bSubmit = false;
							try {
								dojo.io.bind({
									url: sURL,
									method: "get",
									mimetype: "text/plain",
									load: function(type, data, evt){
										if (data.indexOf("1") == 0) {
											window.abPreSubmit_orig(stype);
										}
									},
									error: function(type, error){
									},
									sync: false,
									transport: "XMLHTTPTransport"
								});

							}
							catch(e) {
								window.bSubmit = false;
							}
						}
						if (window.bSubmit) {
							window.abPreSubmit_orig(stype);
						}
					}
					
				}
					
			
			
				var btnConts=qp_getElementsByClassName("lotusBtnContainer","div");
				for (var i=0; i<btnConts.length; i++) {
					var btns=qp_getElementsByClassName("lotusBtn","span",btnConts[i]);
					if (btns.length<1) {
						btnConts[i].style.display="none";
					}
				}
				
				//SPR #TCHU7CAAAU - Remove items from customize for blogs and wikis
				if ( Quickr81SupportUtil.isBlogPlace() || Quickr81SupportUtil.isWikiPlace() ) {
					if (h_SetEditScene && h_SetEditScene == "h_TailorRoomEdit") {
						var aFields;
						var aRemove = new Array();
						
						if ( Quickr81SupportUtil.isBlogPlace() ) {
							aFields	= new Array(
								"h_GetSearch",
								"h_GetTasks",
								"h_GetIndex",
								"h_GetSecurity",
								"h_GetWhatsNew",
								"h_GetNewsDefault",
								"h_GetOffline"
							);
							
							
							var fld;
							
							fld = theForm["h_OfflineEncryptLevelMenu"];							
							if (fld) aRemove[aRemove.length] = fld.parentNode.parentNode.parentNode;
							
							fld = theForm["h_GetOfflineLoginPasswords"];
							if (fld) aRemove[aRemove.length] = fld.parentNode.parentNode;
							
							
						} else
						if ( Quickr81SupportUtil.isWikiPlace() ) {
							aFields	= new Array(
								"h_GetTasks",
								"h_GetIndex",
								"h_GetSecurity",
								"h_GetWhatsNew",
								"h_GetNewsDefault"
							);
						}
						
						
						
						for (var i = 0; i < aFields.length; i++) {
							var fld = theForm[aFields[i]];
							if (fld) {
								if (fld.length && fld.length > 0) {
									for (var j = 0; j < fld.length; j++) {
										if (fld[j].type == "radio") {
											aRemove[aRemove.length] = fld[j];
										}
									}
								}
								if (fld.type == "checkbox") {
									aRemove[aRemove.length] = fld;
								}
							}
						}
						
												
						for (var i = 0; i < aRemove.length; i++) {
							aRemove[i].parentNode.style.display = "none";
						}
					}				
				}
			}
			else if (this.currentPageType == "page.htm") {
				if ( Quickr81SupportUtil.isWikiPlace() ) {
					if ( h_PublishedVersionUNID != "" && h_PublishedVersionUNID != h_PageUnid ) {
						for (var i = document.links.length-1; i >= 0; i--) {
							var lnk = document.links[i];
							if (lnk.href.indexOf("DM.read.checkin") > -1) {
								lnk.parentNode.removeChild(lnk);
							}
						}
						
						var el;
						
						el = document.getElementById("s-tab");
						if (el) el.style.display = "none";
						
						el = document.getElementById("content_title");
						if (el) el.style.display = "none";
						
					}					
				}
			}

			var ma=dojo.byId("moreActions");
			if (ma) {
				this.makeActionMenu();
				ma.onclick=function(){Quickr81SupportUtil.showActionMenu();};
			}
			
			// fix page title
			var pNode = document.getElementById('pageTitlePlaces');
			QuickrSetupUtil.fixPageTitle(pNode, 'PAGE.PLACES');


			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;
				}
			}
	

			this.showMainFrame();
		}
		catch (e) {
			this.showMainFrame();
		}
	},

	goTo: function(hUrl) {
		location.href=getAbsoluteServerRootURL(self)+hUrl;
	},

	useSkinComponent: function(id) {
		var el=dojo.byId(id);
		var sc=dojo.byId(id+"_SC");
		if (el && sc) {
			el.style.display="none";
			sc.style.display="block";
		}
	},

	massagePgBtn: function(url,which) {
		if (url != "") {
			FM.view.toggleBtn("pgBtn_"+which,true,"javascript:Quickr81SupportUtil.goTo('"+url+"');");
		} else {
			FM.view.toggleBtn("pgBtn_"+which,false,"");
		}
	},

	massagePgBtns: function() {
		this.massagePgBtn(h_FirstPageURL,"f");
		this.massagePgBtn(h_PreviousPageURL,"p");
		this.massagePgBtn(h_NextPageURL,"n");
		this.massagePgBtn(h_LastPageURL,"l");
		dojo.byId("pageNavBar").style.display="block";
	},

	massageOffline: function() {
		if (!drF_isOffline()) {
			// show stuff if online
			dojo.byId("PlacesOrFiles").style.display="block";
		}
	},

	addActions: function(menu,id,container,icon)
	{
		var el=qp_getElementsByClassName(id,"a",container);
		var menuR=new QP_ContextMenu("actions_R");
		var href;
		
		for (var i=0; i<el.length; i++) {
			href=el[i].href;
			var mbAddToMenu = true; //AL 2010-10 FIX MAYETIC
			// HACKS: this works fine, but should separate scene actions into subcategories to avoid this!
			if (href.indexOf("h_PageType;h_Response") > -1 || href.indexOf("h_PageType;h_Revision") > -1) {
				menuR.addItem(el[i].innerHTML,href,"_self",null,(icon || GetActionIcon(el[i].innerHTML)),el[i].innerHTML);
				mbAddToMenu = false;
			}
			else if (href.indexOf("confirmCopy") > -1) {
				menu.addSeparator();
			}
			else if (id=="print" && this.currentPageType=="listfolder.htm") {
				href="javascript:FM.view.print()";
			}
			if (mbAddToMenu) menu.addItem(el[i].innerHTML,href,"_self",null,(icon || GetActionIcon(el[i].innerHTML)),el[i].innerHTML);
		}
		
		if (menuR.items.length > 0) {
			// Add the "Respond" submenu
			menuR.write();
			menu.addSubmenu("Répondre", "#", "_self", null, "", null, "actions_R");
			menu.addSeparator();
		}
		return i;
	},

	makeActionMenu: function()
	{
		var menu = new QP_ContextMenu("actions");
		if (!menu.exists)
		{
			var nI=0;
			var actions=dojo.byId("actions");

			// Allow member mgmt only if Manager or above and not offline
			var bAllowMM=(this.currentPageType=="listfolder.htm" && fieldNames.h_SetReadScene=='h_MembersView'
							  && currentUserAccess>=6 && !drF_isOffline());

			if (this.isBlogPlace()) {
				if (typeof(h_SetReadScene) == "undefined" || h_SetReadScene != "h_MembersView") {
					// blog place: if not members page, loop through all actions and remove all but Delete
					var el=qp_getElementsByClassName("sceneAction","a",actions);
					for (var i = el.length - 1; i >= 0; i--) {
						var sHREF = el[i].getAttribute("href");
						if (sHREF) {
							if (typeof(c_Form)!="undefined") {
								var bRemove = (c_Form == "QPreference");
								
								if (!bRemove) {
									if (c_Form == "BlogEntry" && (sHREF.indexOf(":confirmDelete") > -1 || sHREF.indexOf(":DM.folder.remove") > -1)) {
										el[i].setAttribute("href", "javascript:deleteBlogEntry();");
									} else {
										bRemove = true;
									}	
								}
								
								if (bRemove) el[i].parentNode.removeChild(el[i]);
								
							}
						}
					}

					for (var i = 0; i < document.links.length; i++) {
						var sHREF = document.links[i].href;
						
						if( sHREF.indexOf("&Form=h_Atom") > -1 ) {
							document.links[i].href = QuickrGeneralUtil.getBaseUrl() + "/stories.rss?OpenPage";
						}
					}
				}

			} else {
				nI += this.addActions(menu,"roomAction",actions);
			}

			if (bAllowMM && MM.remove.dlg) {
				menu.addItem(QuickrLocaleUtil.getStringResource("MEMBERS.MOREACTIONS.DELETE"),"javascript:MM.remove.showDialog();","_self",null,GetActionIcon("Supprimer"));
				nI++;
			}

			if (bAllowMM && MM.change.dlg) {
				menu.addItem(QuickrLocaleUtil.getStringResource("MEMBERS.MOREACTIONS.CHANGEROLE"),"javascript:MM.change.showDialog();");
				nI++;
			}

			if (nI>0) {
				menu.addSeparator();
				nI=0;
			}
			
			if (bAllowMM && MM.anonDef.dlg) {
				menu.addItem(QuickrLocaleUtil.getStringResource("MEMBERS.MOREACTIONS.GRANT"),"javascript:MM.anonDef.showDialog();");
				nI++;
			}

			nI += this.addActions(menu,"sceneAction", actions);
			menu.addSeparator();
			nI=0;

			nI += this.addActions(menu,"folderAction",actions);
			nI += this.addActions(menu,"download",actions,"/qphtml/html/common/download.gif");

			if (nI>0) {
				menu.addSeparator();
			}

			// Set Access:
			
				// BEGIN MAYETIC CODE =>	if (this.currentPageType=="page.htm" &&
				if ((this.currentPageType=="page.htm" || this.currentPageType=="headlines.htm") && // <= END MAYETIC CODE
				(typeof(isEditablePage) != "undefined" && isEditablePage) &&
				(typeof(validForm) != "undefined" && validForm) 
				&& (typeof(DeliveredDate)=="undefined" || DeliveredDate == "")) {
				
 				var menuSA = new QP_ContextMenu("actions_SA");
				 
				if (h_DraftVersionUNID=="") {
					// no draft version, so populate the edit accordingly
					menuSA.addItem("Limitation en lecture",
										  "javascript:setDocPermissions('Reader',"+(h_IsInToc=="1")+",'" + h_PageUnid + "','" + h_PublishedVersionUNID + "')");
					  
					//SPR #QDAI74CAMP - There is an issue allowing authors to add other authors through the context menu
					menuSA.addItem("Ajout d'éditeurs",
										(currentUserAccess > 3
										 ? "javascript:setDocPermissions('Author',"+(h_IsInToc=="1")+",'" + h_PageUnid + "','" + h_PublishedVersionUNID + "')"
										 : ""));
				}
				else {
					//there is a draft version, so populate the edit with a link to the draft version
					menuSA.addItem("Limitation en lecture", "");
					menuSA.addItem("Ajout d'éditeurs", "");
				}
				 
				if (menuSA.items.length > 0) {
					// Add the "Respond" submenu
					menuSA.write();
					menu.addSeparator();
					menu.addSubmenu("Définir l'accès", "#", "_self", null, "", null, "actions_SA");
				}
			}					
			
			menu.addSeparator();
			if ((this.isBlogPlace() && typeof(c_Form)!="undefined" && c_Form == "QPreference") || (typeof(h_Type) != "undefined" && h_Type=="1")) {
				this.addActions(menu,"folderAtomFeed",actions,theme_imgLoc+"feed_18.gif");
			}
			this.addActions(menu,"notify",actions,theme_imgLoc+"notify_icon.gif");
			this.addActions(menu,"print",actions,theme_imgLoc+"print_icon.gif");

			// Write the menu's HTML
			menu.write();
		}
	},

	showActionMenu: function()
	{
		var ab=dojo.byId("moreActions");
		if (ab) {
			var pb=findPos(ab);
			var am=dojo.byId("actions_Menu");
			var pm=findPos(am);
			var amTop=(pb[1]+ab.offsetHeight+1);
			if (document.all) {
				// IE: if there is an Upload (Active X) control on the page, shift the menu up
				// to avoid it because an Active X control is always on the top layer.
				var uc=dojo.byId("UploadControl");
				if (uc) {
					var amBot=amTop+am.offsetHeight;
					var ucTop=findPos(uc)[1];
					if (amBot>ucTop) {
						amTop -= (amBot-ucTop);
					}
				}
			}
			QP_ContextMenu_show("actions",true,pb[0]+1, amTop);
		}
	},
 
	showMainFrame: function() {
		// outermost tag in body
		var frame = dojo.byId("lotusFrame");
		if (frame) {
			frame.style.display = "block";
		}	
	}
}

