// _lcid="1033" _version="12.0.4518"
// _localBinding
// Version: "12.0.4518"
// Copyright (c) Microsoft Corporation.  All rights reserved.
var L_VS_DownArrow_Text="Select a View";
var L_Edit_Text="Edit";
var L_FCRecycleConfirm_Text="Are you sure you want to send this facility to the site Recycle Bin?";
var L_FGRecycleConfirm_Text="Are you sure you want to send this facility group to the site Recycle Bin?";
var L_HLRecycleConfirm_Text="Are you sure you want to send this holiday to the site Recycle Bin?";
var L_SRRecycleConfirm_Text="Are you sure you want to send this appointment to the site Recycle Bin?";
var L_WARecycleConfirm_Text="Are you sure you want to send this whereabouts information of the user to the site Recycle Bin?";
var L_WNRecycleConfirm_Text="Are you sure you want to send this notification to the site Recycle Bin?";
var L_CTRecycleConfirm_Text="Are you sure you want to send this phone call memo to the site Recycle Bin?";
var L_CLRecycleConfirm_Text="Are you sure you want to send this circulation to the site Recycle Bin?";
var L_RecycleConfirm_Text="Are you sure you want to send this item to the site Recycle Bin?";
var L_FCDeleteConfirm_Text="Are you sure you want to delete this facility?";
var L_FGDeleteConfirm_Text="Are you sure you want to delete this facility group?";
var L_HLDeleteConfirm_Text="Are you sure you want to delete this holiday?";
var L_SRDeleteConfirm_Text="Are you sure you want to delete this appointment?";
var L_WADeleteConfirm_Text="Are you sure you want to delete this whereabouts information of the user?";
var L_WNDeleteConfirm_Text="Are you sure you want to delete this notification?";
var L_CTDeleteConfirm_Text="Are you sure you want to delete this phone call memo?";
var L_CLDeleteConfirm_Text="Are you sure you want to delete this circulation?";
var L_DeleteConfirm_Text="Are you sure you want to delete this item?";
var g_aMenuParams=new Array();
function GBW_OnLink(elm)
{
	if (!IsMenuEnabled())
		return false;
	elm.onblur=OutItem;
	elm.onkeydown=GBW_PopMenu;
	var elmTmp=FindSTSMenuTable(elm, "CTXName");
	if (elmTmp==null)
		return false;
	GBW_OnItem(elmTmp);
	return false;
}
function GBW_StartDeferItem(elm)
{
	if (elm !=itemTable)
	{
		itemTableDeferred=elm;
		elm.onmouseout=EndDeferItem;
		elm.onclick=GBW_DeferredOnItem;
		elm.oncontextmenu=GBW_DeferredOnItem;
	}
}
function GBW_DeferredOnItem(e)
{
	var elm=itemTableDeferred;
	if (elm !=null)
	{
		MenuHtc_hide();
		GBW_OnItem(elm);
		GBW_CreateMenu(e);
		return false;
	}
}
function GBW_OnItem(elm)
{
	if (!IsMenuEnabled())
		return false;
	if (IsMenuOn())
	{
		GBW_StartDeferItem(elm);
		return false;
	}
	if (itemTable !=null)
		OutItem();
	itemTable=elm;
	currentItemID=itemTable.getAttribute("ItemId");
	var createCtx=new Function("setupMenuContext("+itemTable.getAttribute("CTXName")+");");
	createCtx();
	var ctx=currentCtx;
	if (browseris.nav6up)
		itemTable.className="ms-selectedtitlealternative";
	else
		itemTable.className="ms-selectedtitle";
	if (browseris.ie5up && !browseris.ie55up)
	{
		if (ctx.ctxType==CTXTYPE_VIEWSELECTOR)
			return false;
		else
		{
			itemTable.onclick=EditMenuDefaultForOnclick;
			itemTable.oncontextmenu=EditMenuDefaultForOnclick;
		}
	}
	else
	{
		itemTable.onclick=GBW_CreateMenu;
		itemTable.oncontextmenu=GBW_CreateMenu;
	}
	itemTable.onmouseout=OutItem;
	var titleRow;
	titleRow=GetFirstChildElement(GetFirstChildElement(itemTable));
	if (titleRow !=null)
	{
		imageCell=GetLastChildElement(titleRow);
	}
	if (ctx.ctxType==CTXTYPE_VIEWSELECTOR)
	{
		downArrowText=L_VS_DownArrow_Text;
	}
	else
	{
		downArrowText=L_Edit_Text;
	}
	var imageTag=GetFirstChildElement(imageCell);
	imageTag.src=ctx.imagesPath+"menudark.gif";
	imageTag.alt=downArrowText;
	imageTag.style.visibility="visible";
	imageCell.style.visibility="visible";
	imageCell.className="ms-menuimagecell";
	return false;
}
function GBW_PopMenu(e)
{
	if (!IsMenuEnabled())
		return true;
	if (e==null)
		e=window.event;
	var nKeyCode;
	if (browseris.nav6up)
		nKeyCode=e.which;
	else
		nKeyCode=e.keyCode;
	if (!IsMenuOn() && ((e.shiftKey && nKeyCode==13) || (e.altKey && nKeyCode==40)))
	{
		onKeyPress=true;
		GBW_CreateMenu(e);
		onKeyPress=false;
		return false;
	}
	else
		return true;
}
function GBW_CreateMenuEx(ctx, container, e)
{
	if (container==null)
		return;
	IsMenuShown=true;
	document.body.onclick="";
	var m;
	if (ctx.ctxType==CTXTYPE_VIEWSELECTOR)
	{
		m=CMenu("VS"+"_menu");
		if (!m)
			return;
		AddViewSelectorMenuItems(m, ctx);
	}
	else
	{
		m=CMenu(currentItemID+"_menu");
		if (!m)
			return;
		else if (ctx.listTemplate==403)
			GBW_WA_AddListMenuItems(m, ctx);
		else if (ctx.listTemplate==404)
			GBW_CT_AddListMenuItems(m, ctx);
		else if (ctx.listTemplate==405)
			GBW_CL_AddListMenuItems(m, ctx);
		else if (ctx.listTemplate==425)
			GBW_WN_AddListMenuItems(m, ctx);
		else
			AddListMenuItems(m, ctx);
		InsertFeatureMenuItems(m, ctx);
	}
	currentEditMenu=m;
	container.onmouseout=null;
	OMenu(m, container, null, null, -1);
	itemTable=GetSelectedElement(container, "TABLE");
	m._onDestroy=OutItem;
	e.cancelBubble=true;
	return false;
}
function GBW_CreateMenu(e)
{
	var ctx=currentCtx;
	if (e==null) e=window.event;
	var srcElement=e.srcElement ? e.srcElement : e.target;
	if (itemTable==null || imageCell==null ||
		(onKeyPress==false &&
		 (srcElement.tagName=="A" ||
		  srcElement.parentNode.tagName=="A")))
		return;
	return GBW_CreateMenuEx(ctx, itemTable, e);
}
function GBW_CMOpt(wzText,wzAct,wzISrc,wzIAlt)
{
	var mo=CMItm("option");
	if(!mo)return null;
	mo.innerHTML=wzText;
	mo.setAttribute("onMenuClick", wzAct);
	AImg(mo,wzISrc,wzIAlt);
	return mo;
}
function GBW_CAMOpt(p,wzText,wzAct,wzISrc,wzIAlt)
{
	var mo=GBW_CMOpt(wzText,wzAct,wzISrc,wzIAlt);
	if(!mo)return null;
	AChld(p,mo);
	return mo;
}
function GBW_SplitMember(stMembers)
{
	var rgMember=new Array();
	var nBegin=0;
	var nEnd=0;
	var nLength;
	if (!stMembers)
		return null;
	nLength=stMembers.length;
	nEnd==stMembers.indexOf(";#");
	if (nEnd !=0)
		return null;
	nBegin=nEnd+2;
	while (nBegin < nLength)
		{
		var stMember;
		nEnd=stMembers.indexOf(";#", nBegin);
		if (nEnd < 0)
			break;
		stMember=stMembers.substring(nBegin, nEnd);
		if (stMember)
			{
			rgMember[rgMember.length]=stMember;
			}
		nBegin=nEnd+2;
		}
	return rgMember;
}
function GBW_DeleteItemConfirmation(stMessage)
{
	return confirm(stMessage);
}
function GBW_DeleteListItem()
{
	if (! IsContextSet())
		return;
	var ctx=currentCtx;
	var stMessage;
	switch (ctx.listTemplate)
	{
		case 400:
			stMessage=ctx.RecycleBinEnabled ? L_SRRecycleConfirm_Text : L_SRDeleteConfirm_Text;
			break;
		case 401:
			stMessage=ctx.RecycleBinEnabled ? L_FGRecycleConfirm_Text : L_FGDeleteConfirm_Text;
			break;
		case 402:
			stMessage=ctx.RecycleBinEnabled ? L_FCRecycleConfirm_Text : L_FCDeleteConfirm_Text;
			break;
		case 403:
			stMessage=ctx.RecycleBinEnabled ? L_WARecycleConfirm_Text : L_WADeleteConfirm_Text;
			break;
		case 404:
			stMessage=ctx.RecycleBinEnabled ? L_CTRecycleConfirm_Text : L_CTDeleteConfirm_Text;
			break;
		case 405:
			stMessage=ctx.RecycleBinEnabled ? L_CLRecycleConfirm_Text : L_CLDeleteConfirm_Text;
			break;
		case 421:
			stMessage=ctx.RecycleBinEnabled ? L_HLRecycleConfirm_Text : L_HLDeleteConfirm_Text;
			break;
		case 425:
			stMessage=ctx.RecycleBinEnabled ? L_WNRecycleConfirm_Text : L_WNDeleteConfirm_Text;
			break;
		default:
			stMessage=ctx.RecycleBinEnabled ? L_RecycleConfirm_Text : L_DeleteConfirm_Text;
			break;
	}
	if (confirm(stMessage))
	{
		SubmitFormPost(ctx.HttpPath+"&Cmd=Delete&List="+ctx.listName+					"&ID="+currentItemID+"&NextUsing="+GetSource());
	}
}
function GBW_AddAccountID(escapedSourceParam, userID)
{
	var ACCOUNT_QUERY_KEY="AccountId";
	var unescapedSourceParam=unescapeProperly(escapedSourceParam);
	unescapedSourceParam=RemoveQueryParameterFromUrl(unescapedSourceParam, ACCOUNT_QUERY_KEY);
	var sepChar="&";
	if(-1==unescapedSourceParam.indexOf("?")) {
	sepChar="?";
	}
	return escapeProperly(unescapedSourceParam+sepChar+ACCOUNT_QUERY_KEY+"="+userID);
}
function GBW_GetSourceWithAccountID(userID)
{
	return GBW_AddAccountID(GetSource(), userID);
}
function GbwSRReplaceMoveToViewDate()
{
	MoveToViewDate=GbwSRMoveToViewDate;
}
function GbwSRMoveToViewDate(strdate, view_type)
{
	var wUrl=window.location.href;
	wUrl=GbwSRGenerateUrl(strdate, view_type, wUrl);
	SubmitFormPost(wUrl, true);
}
function GbwSRGenerateUrl(strdate, view_type, url)
{
	if (strdate !=null)
		url=StURLSetVar2(url,"CalendarDate",escapeProperly(strdate));
	if (view_type !=null)
	{
		url=StURLSetVar2(url,"CalendarPeriod",view_type);
		if(view_type=='Week')
	{
			url=StURLSetVar2(url,"WeeklyType","Person");
	}
	}
	return url;
}

