//==============================
function GetSourceElement(event)
{
    return event.srcElement ? event.srcElement : event.target;
}

function noenter(event) 
{
	return !(event && event.keyCode == 13); 
}

function resetif(event, text) 
{
	if(event.srcElement && event.srcElement.value==text)
		event.srcElement.value = "";
	
	if(event.target && event.target.value==text)
		event.target.value = "";
}

function AbsUrl(sAbsUrl)
{
	if(sAbsUrl.length==0 || sAbsUrl.indexOf(":")>=0)
		return sAbsUrl;
		
	var sLocation = location.pathname.toLowerCase().split("\\").join("/");
	var iIndex    = -1;
		
	if(sAbsUrl.substr(0,1)!='/')
		iIndex = sLocation.lastIndexOf("/")+1;

	var sRoot = location.pathname.substr(0, iIndex);

	return sRoot+sAbsUrl;
}

function GotoUrl(sUrl)
{
	window.location = AbsUrl(sUrl);
}

function GetURLParam(name) 
{
	return unescape((RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]);
}

function IsOffline()
{
    return typeof(IS_OFFLINE)!="undefined" && IS_OFFLINE;
}

function GetRoot()
{
    if(typeof(OFFLINE_ROOT_DIR)!="undefined")
        return OFFLINE_ROOT_DIR;

    //OFFLINE_ROOT_DIR -->  from <!-- @ROOTDIR --> of page template
    return "/";
}

function Popup(url, width, height)
{
	if(width==null) width=650;
	if(height==null) height=550;
	
	var wnd = window.open(AbsUrl(url),"","toolbar=no,width="+width+",height="+height+",directories=no,status=no,scrollbars=yes,resize=yes,menubar=no");
        
    if(wnd!=null)	wnd.focus();
    else			alert("Popup window cannot be opened.");
}

function PopupBig(url)
{
	var wnd = window.open(AbsUrl(url),"","toolbar=no,width=800,height=600,directories=no,status=no,scrollbars=yes,resize=yes,menubar=no");
        
    if(wnd!=null)	wnd.focus();
    else			alert("Popup window cannot be opened.");
}

function _CO(OptionList) 
{
   for (x = OptionList.length; x >= 0; x--) 
   {
      OptionList[x] = null;
   }
}

function _RO(OptionList)
{
	_CO(OptionList);
	for(var i=0; i<8; ++i) _AO1(OptionList,"");
}

function _AO1(OptionList, OptionText) 
{
   // Add option to the bottom of the list
   OptionList[OptionList.length] = new Option(OptionText, OptionText);
}

function _AO2(OptionList, OptionText, OptionValue) 
{
   // Add option to the bottom of the list
   OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}

// MENU FUNCTIONS

function _MUrl(sUrl)
{
    if(IsOffline()) 
    {
        if(sUrl.indexOf("/") == 0)
            sUrl = GetRoot() + sUrl.substr(1);
    
        if(sUrl.lastIndexOf("/") == sUrl.length-1)
            sUrl+= "default.html"
        sUrl = sUrl.replace(/.shtml/g, ".html");
        sUrl = sUrl.replace(/.aspx/g,  ".html");
    }
    
    return sUrl.toLowerCase();
}


function _ML()
{
	document.writeln("<tr><td colspan=2><img src='"+GetRoot()+"images/ms.gif' height=2 width=150></td></tr>")
}

function _MIO(sTitle, sUrl)
{
	_ML()
	document.writeln("<tr><td><img src='"+GetRoot()+"images/ab.gif'></td><td height=18 width=135><a href='"+_MUrl(sUrl)+"' class=mlink>"+sTitle+"</a></td></tr>")
}

function _MIC(sTitle, sUrl)
{
	_ML()
	document.writeln("<tr><td><img src='"+GetRoot()+"images/ar.gif'></td><td height=18 width=135><a href='"+_MUrl(sUrl)+"' class=mlink>"+sTitle+"</a></td></tr>")
}

function _MIS(sTitle, sUrl)
{
	document.writeln("<tr bgcolor=FAFCF8><td>&nbsp;</td><td height=18 width=135><a href='"+_MUrl(sUrl)+"' class=mlink>"+sTitle+"</a></td></tr>")
}

function _MS(sTitle)
{
	_ML()
	document.writeln("<tr><td colspan=2 height=18 width=135><span class=mlinkb>&nbsp;&nbsp;"+sTitle+"</span></td></tr>")
}


function _DelWarning()
{
	return _Confirm('You are about to delete this item. Are you sure you wish to continue?');
}

function _ConvertWarning()
{
	return _Confirm('You are about to convert this module. '  
	+ 'The conversion may not be successful and you cannot undo this action.' 
	+ '\n\nAre you sure you wish to continue?');
}

function _Confirm(message)
{
	var bResult = confirm(message);
	
	if(document.all && event!=null)
		event.returnValue = bResult;
		
	return bResult;	
}


function _DisableControl(event)
{
    if(event.target==null)
        event.target = event.srcElement;

    if(event.target!=null)
        event.target.disabled=true;
}



function EditList_Init(sID)
{
	var oList  = document.forms[0].elements[sID+":CSelection"];
	var oValue = document.forms[0].elements[sID+":CValue"];
	
	var sValues = oValue.value.split(";");
	
	for(var i=0; i!=sValues.length; ++i)
	{
		var sValue = sValues[i].replace(/&s/g, ";").replace(/&a/g, "&");
	
		if(sValue!="")
			oList.options[oList.options.length] = new Option(sValue, sValue);
	}
}

function EditList_Add(sID)
{
	var oVoc   = document.forms[0].elements[sID+":CVocabulary"];
	var oText  = document.forms[0].elements[sID+":COther"];
	var oValue = document.forms[0].elements[sID+":CValue"];
	var oList  = document.forms[0].elements[sID+":CSelection"];
	
	var sNew = oText.value;
	
	if(sNew=="")
		sNew = oVoc.options[oVoc.selectedIndex].text;
	
	oList.options[oList.options.length] = new Option(sNew, sNew);

	oText.value = "";
	oVoc.value = "";
	
	EditList_Rebuild(sID);
}

function EditList_Rebuild(sID)
{
	var oValue = document.forms[0].elements[sID+":CValue"];
	var oList  = document.forms[0].elements[sID+":CSelection"];
	
	oValue.value = "";
	
	for(var i=0; i!=oList.options.length; ++i)
	{
		var sText  = oList.options[i].text;
		var sValue = sText.replace(/&/g, "&a").replace(/;/g, "&s");
		
		oValue.value += sValue + ";";
	}
}

function EditList_Del(sID)
{
	var oList  = document.forms[0].elements[sID+":CSelection"];
	
	if(oList.selectedIndex>=0)
		oList.options[oList.selectedIndex] = null;
	
	EditList_Rebuild(sID)
}

var IsPrinterFriendly = false;
var FontSize = 0;

function OnPrint()
{
	IsPrinterFriendly = !IsPrinterFriendly;
		
	if(GetElementByID("CHeaderRow"    )!=null) GetElementByID("CHeaderRow"    ).style.display = IsPrinterFriendly ? "none" : "";
	if(GetElementByID("CFooterMenu"   )!=null) GetElementByID("CFooterMenu"   ).style.display = IsPrinterFriendly ? "none" : "";
	if(GetElementByID("CLeftSeparator")!=null) GetElementByID("CLeftSeparator").style.display = IsPrinterFriendly ? "none" : "";
	if(GetElementByID("CLeftHolder"   )!=null) GetElementByID("CLeftHolder"   ).style.display = IsPrinterFriendly ? "none" : "";
	if(GetElementByID("CRightCell"    )!=null) GetElementByID("CRightCell"    ).style.display = IsPrinterFriendly ? "none" : "";

	if (GetElementByID("CPageLeft") != null) GetElementByID("CPageLeft").style.display = IsPrinterFriendly ? "none" : "";
	

	var bIsBchRaPortal = GetElementByID("Menu")!=null && GetElementByID("PageContent")!=null;
	
	if(bIsBchRaPortal)
	{
		if (IsPrinterFriendly) {
			$("#Menu").hide();
			$("#PageContent").css("margin-left", "0px");
		}
		else {
			$("#Menu").show();
			$("#PageContent").css("margin-left", null);
		}
	}
	else if (GetElementByID("CPageContent") != null)
	{
		GetElementByID("CPageContent").style.width = IsPrinterFriendly ? "920px" : "740px";
	}
}

function FontInc(sizeOffset)
{
	var sZoom = sZoom = $("body").attr("zoom"); // PATCH FOR IE/FireFox

	if(!sZoom || sZoom=="")
		sZoom = "100%";

	var iZoom = Number(sZoom.replace("%", ""));

	     if(isNaN(iZoom))         iZoom  = 100;
	else if(sZoom.indexOf("%")<0) iZoom *= 100;

	iZoom += sizeOffset

	if(iZoom>500) return;
	if(iZoom< 50) return;

	$("body").css ("-moz-transform", "scale("+(iZoom/100)+")");
	$("body").css ("zoom", iZoom + "%");
	$("body").attr("zoom", iZoom + "%");
}

function OnFontInc()
{
    FontInc(10);
}

function OnFontDec()
{
    FontInc(-10);
}


function mie()
{
	event.srcElement.obc = event.srcElement.style.backgroundColor;
	event.srcElement.style.backgroundColor = "#C5C5B1";
}

function mil()
{
	event.srcElement.style.backgroundColor = event.srcElement.obc;
}

function mic()
{
	GotoUrl(event.srcElement.url);
}

function GetRadioValue(element) 
{
    var theRadio = element;

    if(typeof(theRadio)!="undefined") 
    {
        if(typeof(theRadio.length)=="undefined")
            theRadio = new Array(theRadio);

        for(var i=0; i<theRadio.length; i++) 
        {
            if(theRadio[i].checked) 
            {
                return theRadio[i].value;
            }
        }
	}
	return null;
}

//==================================================
//
// Call specified function only if defined
//
//==================================================
function GetElementByID(id)
{
	return document.all ? document.all[id] : document.getElementById(id);
}

//==================================================
//
// Enable Robot trap feature
//
//==================================================
function AddRobotTrap()
{
    document.write("<INPUT type=\"hidden\" name=\"RobotTrap\" value=\"RobotTrap\" />");
}

//== CMS FUNCTIONS ================

var gCmsDragData   = null;
var gCmsDropTarget = null;

function IsCmsDragging()
{
    return GetCmsDragData()!=null;
}

function SetCmsDragData(data)
{
    gCmsDragData = data;
}

function GetCmsDragData()
{
    return gCmsDragData;
}

function CmsDragStart(event, args)
{
    
    SetCmsDragData(args);
    document.body.onmouseup   = CmsDragStop;
    document.body.onmousemove = CmsDragScroll;
}

function CmsDragStop(event)
{
    CmsDragLeave(event);
    
    document.body.onmouseup   = null;
    document.body.onmousemove = null;
    
    SetCmsDragData(null);
}

function CmsDragScroll(event)
{
    if(!IsCmsDragging()) return;
    
    var oInfo = GetClientAreaInfo(event);
    
    var iScrollX = 0;
    var iScrollY = 0;
    
    var iSpaceX = oInfo.ClientWidth  / 20; // 5% of space
    var iSpaceY = oInfo.ClientHeight / 20; // 5% of space
    
    if(oInfo.ClientMouseX < iSpaceX)                      iScrollX = -iSpaceX;
    if(oInfo.ClientMouseX > oInfo.ClientWidth  - iSpaceX) iScrollX =  iSpaceX;
    
    if(oInfo.ClientMouseY < iSpaceY)                      iScrollY = -iSpaceY;
    if(oInfo.ClientMouseY > oInfo.ClientHeight - iSpaceY) iScrollY =  iSpaceY;
    
    if(iScrollX!=0 || iScrollY!=0)
        window.scrollBy(iScrollX, iScrollY);
   
  
}

function CmsDragEnterOver(event)
{
    if(!IsCmsDragging()) return;
	
	if(GetCmsDragData().match("^WebContent,[0-9]+,[0-9]+,[0-9]+$"))
	{
	    gCmsDropTarget = GetSourceElement(event);
	    gCmsDropTarget.style.cursor = "move";
		gCmsDropTarget.style.backgroundColor = "#ff8100";
	}
}

function CmsDragLeave(event)
{
    if(gCmsDropTarget)
    {
	    gCmsDropTarget.style.cursor = "default";
    	gCmsDropTarget.style.backgroundColor = "#E0E0E0";
    }

    gCmsDropTarget=null;
}

function CmsDrop(event, clientID)
{
    if(IsCmsDragging())
    	__doPostBack(clientID, GetCmsDragData());
    	
    CmsDragStop(event);
}

function ShowDialog(url, width, height)
{	

	url = url + "&dt=" + new Date().valueOf();

	window.showModalDialog(url, '', 'dialogHeight: '+height+'px; dialogWidth: '+width+'px; edge: Raised; center: Yes; help: No; resizable: No; status: No;');
}

function GetClientAreaInfo(e) 
{
    var oClientAreaInfo = new Object();
    
    oClientAreaInfo.ClientWidth  = 0;
    oClientAreaInfo.ClientHeight = 0;

    if( typeof( window.innerWidth ) == 'number' ) 
    {
        //Non-IE
        oClientAreaInfo.ClientWidth  = window.innerWidth;
        oClientAreaInfo.ClientHeight = window.innerHeight;
    } 
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
    {
        //IE 6+ in 'standards compliant mode'
        oClientAreaInfo.ClientWidth  = document.documentElement.clientWidth;
        oClientAreaInfo.ClientHeight = document.documentElement.clientHeight;
    } 
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
    {
        //IE 4 compatible
        oClientAreaInfo.ClientWidth  = document.body.clientWidth;
        oClientAreaInfo.ClientHeight = document.body.clientHeight;
    }

    oClientAreaInfo.ScrollX = 0;
    oClientAreaInfo.ScrollY = 0;
    
    if( typeof( window.pageYOffset ) == 'number' ) 
    {
        //Netscape compliant
        oClientAreaInfo.ScrollY = window.pageYOffset;
        oClientAreaInfo.ScrollX = window.pageXOffset;
    }
    else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
    {
        //DOM compliant
        oClientAreaInfo.ScrollY = document.body.scrollTop;
        oClientAreaInfo.ScrollX = document.body.scrollLeft;
    }
    else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
    {
        //IE6 standards compliant mode
        oClientAreaInfo.ScrollY = document.documentElement.scrollTop;
        oClientAreaInfo.ScrollX = document.documentElement.scrollLeft;
    }
    
    
    oClientAreaInfo.MouseX = 0;
    oClientAreaInfo.MouseY = 0;

    if(!e && window.event )
        e = window.event;
        
    if(e)
    {
        if( typeof( e.pageX ) == 'number' ) 
        {
            //most browsers
            oClientAreaInfo.MouseX = e.pageX;
            oClientAreaInfo.MouseY = e.pageY;
        } 
        else if( typeof( e.clientX ) == 'number' ) 
        {
            //Internet Explorer and older browsers
            //other browsers provide this, but follow the pageX/Y branch
            oClientAreaInfo.MouseX = e.clientX;
            oClientAreaInfo.MouseY = e.clientY;
            
            var badOldBrowser = ( window.navigator.userAgent.indexOf( 'Opera' ) + 1 ) || ( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) || ( navigator.vendor == 'KDE' )

            if( !badOldBrowser ) 
            {
                  if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
                  {
                    //IE 4, 5 & 6 (in non-standards compliant mode)
                    oClientAreaInfo.MouseX += document.body.scrollLeft;
                    oClientAreaInfo.MouseY += document.body.scrollTop;
                  } 
                  else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
                  {
                    //IE 6 (in standards compliant mode)
                    oClientAreaInfo.MouseX += document.documentElement.scrollLeft;
                    oClientAreaInfo.MouseY += document.documentElement.scrollTop;
                  }
            }
        }
    }    
    
    oClientAreaInfo.ClientMouseX = oClientAreaInfo.MouseX - oClientAreaInfo.ScrollX;
    oClientAreaInfo.ClientMouseY = oClientAreaInfo.MouseY - oClientAreaInfo.ScrollY;
    
    if(oClientAreaInfo.ClientMouseX < 0 ) oClientAreaInfo.ClientMouseX = 0;
    if(oClientAreaInfo.ClientMouseY < 0 ) oClientAreaInfo.ClientMouseY = 0;

    if(oClientAreaInfo.ClientMouseX > oClientAreaInfo.ClientWidth ) oClientAreaInfo.ClientMouseX = oClientAreaInfo.ClientWidth;
    if(oClientAreaInfo.ClientMouseY > oClientAreaInfo.ClientHeight) oClientAreaInfo.ClientMouseY = oClientAreaInfo.ClientHeight;

    
    return oClientAreaInfo;
}

//======================================
//
// InitCmsTabs
//
//======================================
$(document).ready(function()
{
	//Install event handler

	$("ul.cmsTab > li").click(function(evt)
	{
		var qSource       = $(evt.target);
		var qTabContainer = qSource.parents("div.cmsTab:first");
		var oNewTab       = qSource.attr("tab");

		SwitchCmsTab(qTabContainer[0], oNewTab);
	})

	//Auto select tab to display

	var sTab = window.location.hash;

	if(typeof(sTab)!="string" || !sTab.startsWith("#tab="))
	{
		if(!GetURLParam("tab")!=null)
			sTab = "#tab="+GetURLParam("tab");
	}

	if(typeof(sTab)!="string" || !sTab.startsWith("#tab="))
		return;

	var iTab = Number(sTab.substr(5));
		
	if(isNaN(iTab))
		return;

	$("div.cmsTab").each(function(i, e)
	{ 
		SwitchCmsTab(e, iTab, true);
	});
});

//======================================
//
//
//======================================
function SwitchCmsTab(tabContainer, tabIndex, quiet)
{
	tabIndex = Number(tabIndex);

	var qTabContainer = $(tabContainer);
	var qTabs         = qTabContainer.children("ul.cmsTab").children("li" );
	var qContents     = qTabContainer.children("div"      ).children("div");

	if(isNaN(tabIndex) || tabIndex<0 || tabIndex >= qTabs.size())
		return;

	//Reset status
	qTabs    .removeClass("cmsTabCurrent");
	qContents.hide();

	//Show selected Tab
	qTabs    .filter("[tab="+tabIndex+"]").addClass("cmsTabCurrent");
	qContents.filter("[tab="+tabIndex+"]").show();

	if(quiet)
		return;

	window.location.hash = "tab="+tabIndex;
}

/*============================================================*/

//============================================================//
//============================================================//

var MenuTimeOut = 0;
var gDynamicMenu      = null;
var gDynamicMenuClass = null;

function GetDynamicMenu()
{
    if(gDynamicMenu == null)
    {
        gDynamicMenu      = document.getElementById("DynamicMenu");
        
        if(gDynamicMenu!=null)
            gDynamicMenuClass = gDynamicMenu.className;
    }
        
    return gDynamicMenu;
}

function ShowDynamicMenu(event, className, xOffset, yOffset)
{
	var qElement  = jQuery(GetSourceElement(event));
	var qMenu     = jQuery(GetDynamicMenu());
	var qDocument = jQuery(document);
    
    if(typeof(xOffset)!="number") xOffset   = 0;
    if(typeof(yOffset)!="number") yOffset   = qElement.outerHeight();
    
    if(typeof(className)!="string") className          = gDynamicMenuClass;
    if(typeof(className)=="string") qMenu[0].className = className;

	var iLeft = qElement.offset().left + xOffset;
	var iTop  = qElement.offset().top  + yOffset;

	if(iLeft + qMenu.outerWidth() > qDocument.width())
		iLeft = qElement.offset().left + xOffset - qMenu.outerWidth() + qElement.outerWidth();

	if(iLeft < 0)
		iLeft = 0;

    qMenu.css("left", "" + iLeft + "px");
    qMenu.css("top",  "" + iTop  + "px");
    
    qMenu.show();
    qMenu.stop().fadeTo(1, 1);
    
    DynamicMenuClearTimeout();
}

function DynamicMenuClearTimeout()
{
    if(MenuTimeOut>0) 
        window.clearTimeout(MenuTimeOut);

    MenuTimeOut = 0;
}

function DynamicMenuExit(delay)
{
    DynamicMenuClearTimeout();
       
    MenuTimeOut = window.setTimeout("HideDynamicMenu()", delay);
}

function HideDynamicMenu()
{
    DynamicMenuClearTimeout();
    
    jQuery(GetDynamicMenu()).stop().fadeTo(250, 0, function() 
    { 
        jQuery(GetDynamicMenu()).hide(); 
    });
    //GetElementByID("DynamicMenu").style.display = "none";
}

function GetWindowX(el)
{
	try
	{
		var iVal = $(el).offset().left;

		if(typeof(iVal)=="number")
			return iVal;
	}
	catch(ex) {}

    return el.offsetLeft + (el.offsetParent!=null ? GetWindowX(el.offsetParent) : 0);
}

function GetWindowY(el)
{
	try
	{
		var iVal = $(el).offset().top;

		if(typeof(iVal)=="number")
			return iVal;
	}
	catch(ex) {}

    return el.offsetTop + (el.offsetParent!=null ? GetWindowY(el.offsetParent) : 0);
}

function MenuClear()
{
    while(GetElementByID("DynamicMenu1").rows.length)
        GetElementByID("DynamicMenu1").deleteRow(0);

    while(GetElementByID("DynamicMenu2").rows.length)
        GetElementByID("DynamicMenu2").deleteRow(0);
       
    GetElementByID("DynamicMenu2").style.display = "none";
}

function MenuAddSection(column, title, url, imageSource)
{
    MenuAdd("cms_menu_top", column, title, url, imageSource)
}

function MenuAddItem(column, title, url, imageSource)
{
    MenuAdd("cms_menu_top_item", column, title, url, imageSource)
}

function MenuAdd(className, column, title, url, imageSource)
{
    var Menu = column==1 ? GetElementByID("DynamicMenu2") : GetElementByID("DynamicMenu1");
    var Row  = Menu.insertRow(-1);
    var Cell = Row.insertCell(-1);
    
    var sImgHtml = ""
    if(typeof(imageSource)=="string" && imageSource!="")
        sImgHtml = " <img border=\"0\" src=\""+imageSource+"\" />";

    var sHtml = title;

	if(typeof(MenuBaseUrl)=="undefined")
		MenuBaseUrl = "";

    if (typeof (window.j_site) != 'undefined') {
        switch (j_site) {
            case 10:
            case 12:
                MenuBaseUrl = 'http://www.cbd.int';
                break;
            default:
                MenuBaseUrl = '';
                break;
        }
    }

    if (typeof(url)=="string" && url!="" && url.substring(0, 1) == "/")
        url = MenuBaseUrl + url;
    
    if(typeof(url)=="string" && url!="")
        sHtml = "<a class=\""+className+"\" href=\""+url+"\">"+title + sImgHtml+"</a>";
    
    Cell.className = className;
    Cell.innerHTML = sHtml;
    
    if(GetElementByID("DynamicMenu2").rows.length)
        GetElementByID("DynamicMenu2").style.display = "";
}

function MenuAddLine(column)
{
    var Menu = column==1 ? GetElementByID("DynamicMenu2") : GetElementByID("DynamicMenu1");
    var Row  = Menu.insertRow(-1);
    var Cell = Row.insertCell(-1);
    
    var HTML = "<hr/>";
    
    Cell.className = "cms_menu_top_item";
    Cell.innerHTML = HTML;
    
    if(GetElementByID("DynamicMenu2").rows.length)
        GetElementByID("DynamicMenu2").style.display = "";
}

function Menu_Edit(ctl)
{
    MenuClear();
    MenuAddItem(0, "Check Out and Edit"             , "javascript:__doPostBack('"+ctl+"$BCheckOut')");
    MenuAddItem(0, "Check In"                       , "javascript:__doPostBack('"+ctl+"$BCheckIn')");
    MenuAddItem(0, "Check In and Submit"            , "javascript:__doPostBack('"+ctl+"$BSubmit')");
    MenuAddItem(0, "Undo Check Out (cancel changes)", "javascript:__doPostBack('"+ctl+"$BUndoCheckOut')");
    MenuAddLine(0);
    MenuAddItem(0, "View History"                   , "javascript:__doPostBack('"+ctl+"$BViewHistory')");
    MenuAddItem(0, "Request deletion"               , "javascript:__doPostBack('"+ctl+"$BDelete')");
}

function Menu_EditSimple(ctl)
{
    MenuClear();
    MenuAddItem(0, "Edit"         , "javascript:__doPostBack('"+ctl+"$BCheckOut')");
    MenuAddLine(0);
    MenuAddItem(0, "View History" , "javascript:__doPostBack('"+ctl+"$BViewHistory')");
    MenuAddItem(0, "Delete"       , "javascript: if(_DelWarning()) { __doPostBack('"+ctl+"$BDeleteDirect'); }");
}

function Menu_BasicSkin(ctl)
{
    MenuClear();
    MenuAddItem(0, "Properties"   , "javascript:__doPostBack('"+ctl+"$BEdit')");
    MenuAddLine(0);
    MenuAddItem(0, "Delete"       , "javascript: if(_DelWarning()) { __doPostBack('"+ctl+"$BDelete'); }");
}

