qboEnvironment.prototype.AddCommand = function(label, url, title, position, image, onClickEvent)
{
	var commandElement = document.getElementById('TabBarOptionMenu');
	var commandXml = document.getElementById('OptionXml_CommandBar');
	if (commandXml == null)
	{
		alert("OptionXml_CommandBar does not exist.");
	}
	else if ((commandElement != null) && (commandElement.OptionMenu))
	{
	    var commandBar = document.getElementById("CommandBarOptionMenu");
	    // Get the TBODY tag
//	    var tbody = commandBar.getElementByTagName("TBODY");
	    var div = commandBar.childNodes[1];
	    var table = div.firstChild;
	    var tbody = table.firstChild;
	    // Add a TR to the TBODY tag
	    var row = tbody.appendChild(document.createElement("tr"));
	    var option = row.appendChild(document.createElement("td"));
	   // onClickEvent = "alert('Yo');";
	     
	    var onclick = (onClickEvent) ? " onclick=" + onClickEvent + "": "";
	    option.innerHTML = "<a title=\"" + title + "\" " + onclick + " href=\"" + url + "\">" + label + "</a>";
		//alert("The command bar menu has been created already.  Bloomberg.js needs to be updated to handle this case.");
	}
	else
	{
	    
		var newOption = commandXml.createNode(1, "Option", "");
		var newLink = commandXml.createNode(1, "a", "");
		newLink.setAttribute("href", url);
		newLink.setAttribute("title", title);
		newLink.setAttribute("onclick", onClickEvent);//Added by SSD team for Smartworklist
		newLink.text = label;
		newOption.appendChild(newLink);
		//newOption.text = "<a href=\"" + url + "\" title=\"" + title + "\"/>" + label + "</a>";
		commandXml.documentElement.appendChild(newOption);
	}
	return;
}

function MenuSearchKeyPress()
{
	window.status="In MenuSearchKeyPress ";
	window.status += event.keyCode;
	if (event.keyCode == 13)
	{
		search = document.getElementById("MenuSearchBy");
		var url = document.qbo.Application + search.options[search.selectedIndex].url;
		if (url.indexOf("?") > 0)
    		url += "&SearchBy=" + search.options[search.selectedIndex].value;
		else
	    	url += "?SearchBy=" + search.options[search.selectedIndex].value;
		url += "&SearchString=" + event.srcElement.value + "%";
		document.location = url;
	}
}


			

        function Is() {
		  var agent = navigator.userAgent.toLowerCase();
		  var is_major = parseInt(navigator.appVersion);
		  var is_minor = parseFloat(navigator.appVersion);
		  this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)) && (is_major < 5));
		  this.ie = (agent.indexOf("msie") != -1);
		  this.dom = ((agent.indexOf('mozilla')!=-1) && (agent.indexOf('gecko') != -1) && (is_major >= 5));
		}

		var is = new Is();

/*
		function getNewDate() {

        var lineToWrite = '';
        var today = new Date();
        var year = today.getYear();
        if(year < 1000) {
            year += 1900;
        }
        var date = new Date("January 1, " + year);
        var diff = date.getTime() - today.getTime();
        var days = Math.floor(diff / (1000 * 60 * 60 * 24));
        var hours = Math.floor(((diff / (1000 * 60 * 60 * 24)) - days) * 24);
        var minutes = Math.floor(((((diff / (1000 * 60 * 60 * 24)) - days) * 24) - hours) * 60);
        var strDays = '';
        var strHrs = '';
        var strMin = '';

        if (days < 0) {
            date = new Date("January 1, " + (year + 1));
            diff = date.getTime() - today.getTime();
            days = Math.floor(diff / (1000 * 60 * 60 * 24));
            hours = Math.floor(((diff / (1000 * 60 * 60 * 24)) - days) * 24);
            minutes = Math.floor(((((diff / (1000 * 60 * 60 * 24)) - days) * 24) - hours) * 60);
        }

        if(days < 10) {
            lineToWrite = "<img src=/images/pts\/num_0.gif width=16 height=22><img src=/images/pts\/num_0.gif width=16 height=22><img src=/images/pts\/num_" + days + ".gif width=16 height=22>";
        } else if(days < 100) {
            strDays = days+'';
            lineToWrite = "<img src=/images/pts\/num_0.gif width=16 height=22><img src=/images/pts\/num_" + strDays.substr(0,1) + ".gif width=16 height=22><img src=/images/pts\/num_" + strDays.substr(1,1) + ".gif width=16 height=22>";
        } else {
            strDays = days+'';
            lineToWrite = "<img src=/images/pts\/num_" + strDays.substr(0,1) + ".gif width=16 height=22><img src=/images/pts\/num_" + strDays.substr(1,1) + ".gif width=16 height=22><img src=/images/pts\/num_" + strDays.substr(2,1) + ".gif width=16 height=22>";
        }

        lineToWrite += "<img src=/images/pts\/num_colon.gif width=6 height=22>";

        if(hours < 10) {
            lineToWrite += "<img src=/images/pts\/num_0.gif width=16 height=22><img src=/images/pts\/num_" + hours + ".gif width=16 height=22>";
        } else {
            strHrs = hours+'';
            lineToWrite += "<img src=/images/pts\/num_" + strHrs.substr(0,1) + ".gif width=16 height=22><img src=/images/pts\/num_" + strHrs.substr(1,1) + ".gif width=16 height=22>";
        }

        lineToWrite += "<img src=/images/pts\/num_colon.gif width=6 height=22>";

        if(minutes < 10) {
            lineToWrite += "<img src=/images/pts\/num_0.gif width=16 height=22><img src=/images/pts\/num_" + minutes + ".gif width=16 height=22>";
        } else {
            strMin = minutes+'';
            lineToWrite += "<img src=/images/pts\/num_" + strMin.substr(0,1) + ".gif width=16 height=22><img src=/images/pts\/num_" + strMin.substr(1,1) + ".gif width=16 height=22>";
        }


            if(is.ie) {
	            daylayer.innerHTML = lineToWrite;
            } else if(is.ns) { //stupid old netscape
	            document.layers.daylayer.document.write(lineToWrite);
	            document.layers.daylayer.document.close;
            } else if(is.dom) {
	            document.getElementById("daylayer").innerHTML = lineToWrite;
            }

            setTimeout("getNewDate()",60000);
        }
        */
		/*
		function ClearCheckBoxRadioBorderStyle()
		{
			var inputs = document.getElementsByTagName("input");
			for (var i = 0; i < inputs.length; i++)
			{
				if (inputs[i].type == "checkbox" || inputs[i].type == "radio")
				{
					inputs[i].style.borderStyle = "none";
				}
			}
		}
		*/
		function RemoveUnnecessaryButtons()
		{
			if (document.getElementById("ifcContent_Back")) document.getElementById("ifcContent_Back").style.display = "none";
			if (document.getElementById("ifcContent_PostBack")) document.getElementById("ifcContent_PostBack").style.display = "none";
			if (document.getElementById("ifcContent_Pause")) document.getElementById("ifcContent_Pause").style.display = "none";
			if (document.getElementById("ifcContent_Finish")) document.getElementById("ifcContent_Finish").style.display = "none";
			if (document.getElementById("ifcContent_Cancel")) document.getElementById("ifcContent_Cancel").style.display = "none";
			if (document.getElementById("ifcContent_Restart")) document.getElementById("ifcContent_Restart").style.display = "none";
		}
		function LoadPage()
		{
			HideXmlTag();
			//getNewDate();
			//ClearCheckBoxRadioBorderStyle();
			RemoveUnnecessaryButtons();
			SetBodyStyle();
		}
		function SetBodyStyle()
		{
            document.body.style.backgroundColor = "#FFFFFF";
	        document.body.style.marginLeft = "10";
	        document.body.style.marginTop = "10";
	        document.body.style.marginRight = "10";
	        document.body.style.marginBottom = "10";
		}
		function HideXmlTag()
		{
		    if (document.getElementById("ifcContentXml"))
		    {
		        document.getElementById("ifcContentXml").style.display = "none";		        
		    }
		    else
		    {
		        setTimeout(HideXmlTag, 100);
		    }
		}
		function CheckLoginPage()
		{
		    if (document.getElementById("RegisterStart"))
		    {
		        var strInnerHtml = "<blockquote><br/><ul><li/>All fields are required to register.<li/>Your <b>User Name</b> will be the <b>email address</b> you enter below.<li/>If you are already registered, login by <a href=\"/Security/Login.aspx\">clicking here</a>.</ul></blockquote>";
		        
		        var tr = document.getElementById("RegisterStart");
		        var table = tr.parentElement;
		        if (table.tagName.toLowerCase() != "table") table = table.parentElement;
		        var td = tr.childNodes(0);
		        td.innerHTML = strInnerHtml;
		        table.className = "";
		        table.style.display = "block";
		        //alert(table.outerHTML);
		    }
		    
		}
		if (document.addEventListener) {  document.addEventListener("DOMContentLoaded", LoadPage, false);}
		if (window.attachEvent) window.attachEvent("onload", LoadPage);
