function btnMouseOver(evt)
{
    alert(objBtnLeft.width);
    var obj = (typeof event != 'undefined')?window.event.srcElement: evt.target;
    alert("mouseover event captured for: "+obj.tagName);
}

function createButton(strName, strText, strTip, strTop, strLeft)
{
	var strButton = "<div  ID="+strName+" style='cursor:hand;position: absolute; left: "+strLeft+"; top: "+strTop+"; z-index: 70'>";
	strButton += "<table border='0' cellpadding='0' cellspacing='0'>";
	strButton += "<tr><td><img id="+strName+"-btn-left src='images/btn3-left.gif'></td><td id="+strName+"-btn-body class=btn3-body>"+strText+"</td>";
	strButton += "<td><img id="+strName+"-btn-right src='images/btn3-right.gif'></td></tr></table>	</div>";

	alert(strButton);
	document.body.insertAdjacentHTML("beforeEnd", strButton);
	
	attachEvent(eval(strName), "mouseover", handler_mouseover);
//	attachEvent(imgTemp2, "click", handler_onclick);
	
//	onmouseover='btnMouseOver("+strName+"-btn-left, "+strName+"-btn-body, "+strName+"-btn-right);'	
}

function addTab(toolbarId, tabId, tabWidth, tabCaption, tabTarget)
{
   var strWidth = toolbarId.totalWidth;
   var strTop = toolbarId.style.pixelTop;
   //if (tabWidth == "DEFAULT")
   		//tabWidth = toolbarId.fontSize * tabCaption.length;
   		//always use cfg-sizing
   		tabWidth = tabCaption.length * 8 + 15;
	
   var strHTML = "<v:roundrect id= " + tabId + " style='cursor:hand;z-index:-101;position:absolute;";
   strHTML += "top:1px;height:20px;left:" + strWidth + "px;width:" + tabWidth + "px;'";
   strHTML += "   fillcolor='Silver' arcsize='20%'><div TARGET='" + tabTarget + "' align=center onclick='setActiveTab(" + toolbarId.id + "," + tabId + ")' class='normal'>" + tabCaption + "</div>";
   strHTML += "</img><v:fill id=_bg" + tabId + " type = 'gradient' color2 = 'Blue' angle = '180'></v:fill></v:roundrect>";
    
   toolbarId.insertAdjacentHTML("beforeEnd",strHTML);
   toolbarId.totalWidth = parseInt(tabWidth) + strWidth + 2;	
//   toolbarId._tabs[toolbarId._tabs.length] = tabId;
}

function attachEvent(objDocItem, strEvent, objFunc)
{
    if (objDocItem.addEventListener){
    //This one is the firefox...
    	switch(strEvent)
    	{
    		case "click":
    		case "onclick":
          		objDocItem.addEventListener("click", objFunc, true);
          		break;
    		case "mouseover":
    		case "onmouseover":
          		objDocItem.addEventListener("mouseover", objFunc, true);
          		break;
    		case "mouseout":
    		case "onmouseout":
          		objDocItem.addEventListener("mouseout", objFunc, true);
          		break;
          	default:
           		objDocItem.addEventListener(strEvent, objFunc, true);
		}
    }else if(objDocItem.attachEvent){
    // this one is the IE.
    	switch(strEvent)
    	{
    		case "click":
    		case "onclick":
              	objDocItem.attachEvent("onclick", objFunc);
          		break;
    		case "mouseover":
    		case "onmouseover":
          		objDocItem.attachEvent("onmouseover", objFunc, true);
          		break;
    		case "mouseout":
    		case "onmouseout":
          		objDocItem.attachEvent("onmouseout", objFunc, true);
          		break;
          	default:
              objDocItem.attachEvent(strEvent, objFunc);
		}
    }
}

function handler_mouseover(evt){
    var obj = (typeof event != 'undefined')?window.event.srcElement: evt.target;
    alert("mouseover event captured for: "+obj.tagName);
}

function handler_onclick(evt){
    var obj = (typeof event != 'undefined')?window.event.srcElement: evt.target;
    alert("onclick event captured for: "+obj.tagName);
}

