/* Global vars. Keeps track of layers */ var objLayers = new Array(); /* CLayer Creates an instance of a layer [in] strName name of the layer (possibly to be voided) [in] strContent content of the layer [in] nTop Layer top position [in] nLeft Layer left position [in] nWidth Layer width [in] nHeight Layer height [in] strClass Layer classname [in] objParent Object to insert layer into [out] none [return] none */ function CLayer(strName, strContent, nTop, nLeft, nWidth, nHeight, objParent){ this.strName = strName; this.strContent = strContent; this.nTop = nTop; this.nLeft = nLeft; this.nWidth = nWidth; this.nHeight = nHeight; if (!objParent) objParent = "document.body"; this.objParent = objParent; this.objElement = null; this.nTime = 0; this.m_CreateLayer = p_CreateLayer; this.m_MoveTo = p_MoveTo; this.m_MoveBy = p_MoveBy; this.m_SetSpecificStyle = p_SetSpecificStyle; this.m_ChangeContent = p_ChangeContent; this.m_Togglevisibility = p_Togglevisibility; this.m_SetDownEvent = p_SetDownEvent; this.m_CreateLayer(); } /* p_CreateLayer Layer member function, creates the elemnt */ function p_CreateLayer(){ //var strLayer = "
"; //document.body.insertAdjacentHTML("beforeEnd", strLayer); var objLayer = document.createElement("div"); objLayer.style.position = "absolute"; objLayer.id = ("" + this.strName); document.body.appendChild(objLayer); objLayer.innerHTML = this.strContent; objLayer.style.top = this.nTop; objLayer.style.left = this.nLeft; objLayer.style.width = this.nWidth; objLayer.style.height = this.nHeight; this.objElement = objLayer; var objParent = eval(this.objParent); objLayers[ this.strName ] = this; } /* p_MoveTo CLayer member function Moves layer to specific positions [in] nX X (left) position to move to [in] nY Y (top) position to move to */ function p_MoveTo(nX, nY){ this.objElement.style.left = nX+'px'; this.objElement.style.top = nY+'px'; } /* p_MoveBy CLayer member function Moves layer by a specific amount [in] nX X (left) position to move by [in] nY Y (top) position to move by */ function p_MoveBy(nX, nY){ var nOrgX = parseInt (this.objElement.style.left); var nOrgY = parseInt (this.objElement.style.top); this.objElement.style.left = nOrgX + nX+'px'; this.objElement.style.top = nOrgY + nY+'px'; } /* p_SetSpecificStyle CLayer member function Set specific additonal style for layer [in] nX X (left) position to move by [in] nY Y (top) position to move by */ function p_SetSpecificStyle(strProp, strValue){ eval("this.objElement.style." + strProp + " = '" + strValue + "'"); } /* p_ChangeContent CLayer member function Changes content inside layer [in] strContent Content to insert */ function p_ChangeContent(strContent){ this.objElement.innerHTML = strContent; } /* p_Togglevisibility CLayer member function Toggle visibility */ function p_Togglevisibility(strMode){ if (!strMode){ if (this.objElement.style.visibility == "visible") this.objElement.style.visibility = "hidden"; else this.objElement.style.visibility = "visible"; } else{ if (this.objElement.style.visibility != strMode) this.objElement.style.visibility = strMode; } } function p_SetDownEvent(strAction){ this.objElement.onclick = function(){eval(strAction)}; } /* GetLayer Gets a previously created object [in] strName Name of layer to fetch [return] The layer */ function GetLayer(strName){ return objLayers[ strName ]; } /* Emptied for mit nykredit design ((almost) no layers) */ function SetLayers(strUri_Level_1_Prefix){}