// ----------------------------------------------------------------------------- // ---------- Game Tooltip for Theme view ---------- // ----------------------------------------------------------------------------- var GameTooltip = { closingTimeOut : null, activeTooltipID : "", FindObjPosX : function (obj) { var curleft = 0; do{ if (obj.tagName.toLowerCase()=='body') break; curleft += obj.offsetLeft; }while (obj = obj.offsetParent) return curleft; }, FindObjPosY : function (obj) { var curtop = 0; do{ if (obj.tagName.toLowerCase()=='body') break; curtop += obj.offsetTop; }while (obj = obj.offsetParent) return curtop; }, GetObjWidth : function (obj) { return obj.offsetWidth; }, GetObjHeight : function (obj) { return obj.offsetHeight; }, GetTooltipHTMLCode : function (gameID, nameName, gameDescription) { var arrStr = []; arrStr.push('\n'); arrStr.push('
\n'); arrStr.push('
\n'); arrStr.push(' \n'); arrStr.push(' \n'); arrStr.push(' \n'); arrStr.push(' \n'); arrStr.push(' \n'); arrStr.push(' \n'); arrStr.push('
\n'); arrStr.push(' ' + nameName + '\n'); arrStr.push(' ' + gameDescription + '\n'); arrStr.push('
\n'); arrStr.push('
\n'); arrStr.push('\n'); return arrStr.join(""); }, ShowTooltip : function (gameID) { var objGameImg, objTooltip, objTooltipTab; this.activeTooltipID = gameID; if (objTooltip = document.getElementById("gameTooltip_" + gameID)) { objTooltipTab = document.getElementById("gameTooltipTab_" + gameID) objGameImg = document.getElementById("gameImg_" + gameID); objTooltip.style.display = "block"; objTooltipTab.style.display = "block"; var gameImgWidth = this.GetObjWidth(objGameImg); var gameImgHeight = this.GetObjHeight(objGameImg); var gameImgPosX = this.FindObjPosX(objGameImg); var gameImgPosY = this.FindObjPosY(objGameImg); var positionX, positionY; positionX = gameImgPosX + 79; positionY = gameImgPosY - 75; objTooltip.style.top = positionY + "px"; objTooltip.style.left = positionX + "px"; objTooltipTab.style.top = (positionY + 92) + "px"; objTooltipTab.style.left = (positionX - 35) + "px"; objTooltipTab.style.visibility = "visible"; objTooltip.style.visibility = "visible"; } }, HideTooltip : function (gameID) { var objTooltip, objTooltipTab; this.activeTooltipID = ""; if (objTooltip = document.getElementById("gameTooltip_" + gameID)) { objTooltipTab = document.getElementById("gameTooltipTab_" + gameID) objTooltip.style.display = "none"; objTooltip.style.visibility = "hidden"; objTooltip.style.left = "0px"; objTooltip.style.top = "0px"; objTooltipTab.style.display = "none"; objTooltipTab.style.visibility = "hidden"; objTooltipTab.style.left = "0px"; objTooltipTab.style.top = "0px"; } }, SetTimeoutToHideTooltip : function (gameID) { this.closingTimeOut = setTimeout("GameTooltip.HideTooltip('" + gameID + "')",200); }, GameImgMouseOver : function (gameID) { if (this.closingTimeOut && (this.activeTooltipID == gameID)) clearTimeout(this.closingTimeOut); else { if (this.activeTooltipID) { if(this.closingTimeOut) clearTimeout(this.closingTimeOut); this.HideTooltip(this.activeTooltipID); } this.ShowTooltip(gameID); } }, GameImgMouseOut : function (gameID) { if (this.activeTooltipID == gameID) this.SetTimeoutToHideTooltip(gameID); }, TooltipMouseOver : function (obj) { if (this.closingTimeOut) clearTimeout(this.closingTimeOut); }, TooltipMouseOut : function (obj) { if (this.activeTooltipID) this.SetTimeoutToHideTooltip(this.activeTooltipID); } }