

/*
function hbxFromExpandToggle(section, lidValue, lposValue)
{
	if(section && section != "") {
		
		if ("none" == $(section).getStyle('display')) {
			_hbSet('lid',lidValue);
			_hbSet('lpos',lposValue);
			_hbSend();
		}
	}
	
}
*/

function tabSwitch(tabToShow) 
{
	if (!tabReady) return;
	
	if(tabToHide != "")
	{
		if (/^(?:prodBrochure|prodCoupon|prodCatalogue|prodFlyer|prodP2WMenu|prodDocument)$/.test(tabToHide))
		{
			document.getElementById("prodPrint2web").style.display = 'none';
		}
		else
		{
			document.getElementById(tabToHide).style.display = 'none';
		}
		
		document.getElementById(tabToHide + "TabActive").style.display = "none";
		document.getElementById(tabToHide + "TabInActive").style.display = "inline";	
	}

	//if variable tabToShow is one of prodBrochure, prodCoupon, prodCatalogue, prodFlyer, prodP2WMenu, prodDocument force prodToShow var to use value prodPrint2Web

	if (/^(?:prodBrochure|prodCoupon|prodCatalogue|prodFlyer|prodP2WMenu|prodDocument)$/.test(tabToShow))
	{
		var prodToShow = document.getElementById("prodPrint2web");
	}
	else
	{
		var prodToShow = document.getElementById(tabToShow);
	}

	if (prodToShow)
	{
		prodToShow.style.display = 'block';
		
		// Change the tab ear to active
		document.getElementById(tabToShow + "TabInActive").style.display = "none";		
		document.getElementById(tabToShow + "TabActive").style.display = "inline";
	}

	tabToHide = tabToShow;

	// the share video tab only show up when tab "video" is selected, otherwise will be hide.
//	if ('prodVideo' == tabToShow) 
//	{
//		$("ypShareVideo").style.display = "inline";
//	} else {
//		$("ypShareVideo").style.display = "none";
//	}
	
}

/**
 * parse style attribute value into integer and return it.
 * @param idName id name.
 * @param styleName style attribute.
 * @return integer value.
 */
function getStyleIntValue(idName, styleName)
{		   
    var val_px = idName.getStyle(styleName);
    var val = 0;
    if (null != val_px && '0px' != val_px && "" != val_px) { val = parseInt(val_px); }
    return val;
}


// the following programs are used in Merchant page "more", e.g. Category, directory
var busDelay        = 550; /////
var busMenuElement  = new Array ();
/// ----------------------------

//var busTopID  = -1;

var busXPos = 0;
var busYPos = 0;

//constructor of menu elements
function busMenuConstructor(id)
{
	this.ID            = id; // the Current Menu ID
	this.timerID       = -1; // the Current Menu's Delay timer
	
	return this;
}


function enterMoreItem(ID)
{//alert('enterTopItem');
	busMenuPos(ID);
	clearTimeout(busMenuElement[ID].timerID);
	busShowBucket(ID);
	//alert("showBucket");
	document.getElementById('ref' + ID).style.color = "#996600";
}

function exitMoreItem(ID)
{//alert('exitTopItem');
	busMenuElement[ID].timerID = setTimeout('busMoreHide (' + ID + ')', busDelay);
}

function busMenuPos(ID)
{
	busXPos = offsetLeft(document.getElementById('ref' + ID));
	busXSitePos = offsetLeft(document.getElementById('ypgBody'));
	
	busXPos = busXPos - busXSitePos;
	busYPos = offsetTop(document.getElementById('ref' + ID));
	busYSitePos = offsetTop(document.getElementById('ypgBody'));
	
	busYPos = busYPos - busYSitePos + 15;
}

function busShowBucket(ID)
{//alert('show');

	document.getElementById('Menu' + ID).style.visibility = 'visible';
	document.getElementById('ref' + ID).style.color = "#996600";
}

function busMoreHide(ID)
{//alert('hide');
	document.getElementById('Menu' + ID).style.visibility = "hidden";
	document.getElementById('ref' + ID).style.color = "#000000";
}

function enterMoreMenu(ID)
{//alert('enterMenu');
	clearTimeout(busMenuElement[ID].timerID);
}

function exitMoreMenu(ID)
{//alert('exitMenu');
	busMenuElement[ID].timerID = setTimeout ('busMoreHide (' + ID + ')', busDelay);
}

function createBusMenuTree()
{
	//mhayee 71 changed to 72 to allow embed video msg.
	for (var i = 0; i < 72; i++)
	{
		busMenuElement[i] = new busMenuConstructor(i);
	}
}

createBusMenuTree ();

