var ykOpenPopupMenu = null;
var ykHidePopupTimer = null;
var ykCurCategoryBox = "CatBox0"
var ykSelectCategoryBox = null;
var ykShowCategoryTimer = null;

function yk_popupStartTimeout(hideTimeout) {
	ykHidePopupTimer = setTimeout("yk_HidePopup()", hideTimeout);	
}

function yk_HidePopup() {
	yk_popupResetTimeout();
	if(ykOpenPopupMenu) {
		var c = document.getElementById(ykOpenPopupMenu);
		c.style.visibility = "hidden";
		ykOpenPopupMenu = null;
	}
}

function yk_popupResetTimeout() {
	if (ykHidePopupTimer) clearTimeout(ykHidePopupTimer);
	ykHidePopupTimer = null;
}

function yk_ShowPopup(popupName, xOffset, yOffset) {
	yk_HidePopup();
	yk_popupResetTimeout();
	yk_impShowPopup(popupName, xOffset, yOffset);
}

function yk_impShowPopup(popupName, x, y) {	
	var c = document.getElementById(popupName);
	var s = c.style;
	s.visibility = "inherit";
	s.left = x;
        s.top = y;
	ykOpenPopupMenu = "" + popupName;
}

function yk_ShowCategoryBox(BoxName)
{
	if (BoxName != ykCurCategoryBox)
	{
		ykSelectCategoryBox = BoxName;
		ykShowCategoryTimer = setTimeout("yk_SelectCategoryBox ()", 700);
	}
}

function yk_CategoryResetTimeout() {
	if (ykShowCategoryTimer ) clearTimeout(ykShowCategoryTimer);
	ykShowCategoryTimer  = null;
}

function yk_SelectCategoryBox ()
{
	yk_HidePopup ();
	yk_HideCategoryBox();
	ykCurCategoryBox = ykSelectCategoryBox;
	var c = document.getElementById(ykSelectCategoryBox);
	var s = c.style;
	s.display = "block";
}

function yk_InitCategoryBox(BoxName){
	if (BoxName != ykCurCategoryBox)
	{
		yk_HidePopup ();
		yk_HideCategoryBox();
		ykCurCategoryBox = BoxName;
		var c = document.getElementById(BoxName);
		var s = c.style;
		s.display = "block";
	}
}

function yk_HideCategoryBox(){
	var c = document.getElementById(ykCurCategoryBox);
	var s = c.style;
	s.display = "none";
}
