var win_Act = false; var win_CurrWin = -1; var win_CurrX = 0; var win_CurrY = 0; var WinArr = new Array(); //********************************************************************************* // function reg_exp(expr, s, rs){ return s.replace(expr, rs); } //********************************************************************************* // function win_init(obj){ this.doc = (ie) ? document.all : (ns)? document:document; this.win = (ie) ? eval("document.all." +obj) : ((mo)? document.getElementById(obj) : eval("document." +obj)); this.id = (ie) ? eval("document.all." +obj+ ".id") : ((mo)? document.getElementById(obj).id : eval("document." +obj)); this.css = (ie) ? eval("document.all." +obj+ ".style") : ((mo)? document.getElementById(obj).style : eval("document." +obj)); this.moveit = win_moveit; } //********************************************************************************* // function SetzIndex(obj, e){ if (!(ie||mo)) return; for (i=0; i < WinArr.length; i++) { WinArr[i].css.zIndex=0; } obj.style.zIndex=5; } //********************************************************************************* // function win_moveit(x, y){ (ie) ? this.css.pixelLeft = x - win_CurrX : this.css.left = x - win_CurrX; (ie) ? this.css.pixelTop = y - win_CurrY : this.css.top = y - win_CurrY; } //********************************************************************************* // function win_OnMouseMove(e){ if (e==null) e = window.event; if (win_Act) { x = (ie) ? e.x : e.pageX; y = (ie) ? e.y : e.pageY; WinArr[win_CurrWin].moveit(x, y); if (ie) { e.cancelBubble = true; e.returnValue = false; } } } //********************************************************************************* // function win_OnMouseDown(e, num){ if (win_CurrWin == -1) { win_Act = true; win_CurrWin = num; SetzIndex(WinArr[num].win, e); } else return; //window.status = e.y; win_CurrX = (ie) ? e.x - WinArr[num].css.pixelLeft : (e.pageX - reg_exp(/px|pt/i, WinArr[num].css.left, "")); win_CurrY = (ie) ? e.y - WinArr[num].css.pixelTop : (e.pageY - reg_exp(/px|pt/i, WinArr[num].css.top, "")); if (ie) { e.cancelBubble = true; e.returnValue = false; } else { e.stopPropagation(); e.preventDefault(); } } //********************************************************************************* // function win_OnMouseUp(e){ if (win_Act) { win_CurrX = 0; win_CurrY = 0; win_CurrWin = -1; win_Act = false; } } //********************************************************************************* // function ShowWin(id, mode){ if (!(ie||mo)) return; posX = -900; posY = 0; if (mode==1){ scrollTop = document.body.scrollTop; scrollLeft = document.body.scrollLeft; offsetWidth = (ie) ? document.body.offsetWidth : window.innerWidth; offsetHeight = (ie) ? document.body.offsetHeight : window.innerHeight; posX = scrollLeft + Math.round(offsetWidth/4); posY = scrollTop + Math.round(offsetHeight/4); } if (ie){ document.all(id).style.pixelLeft = posX; document.all(id).style.pixelTop = posY; document.all(id).style.zIndex = 5; } else { document.getElementById(id).style.left = posX; document.getElementById(id).style.top = posY; document.getElementById(id).style.zIndex = 5; } }