/* Create by Yeongmin Han 2007-12-17 Modal, Modeless Windows Control */ function f_isDialogWindow() { return ( typeof(self.dialogWidth) != "undefined" ); } function f_getTopBodyObj() { return ( document ? document.body : false ) } function windowPositionCenter(w,h) { self.top.moveTo((screen.width-w)/2,(screen.height-h)/2); } function f_makeObjChangeSize(w, h) { this.width = w; this.height = h; } function f_getChangeSize(w, h) { var curWidth, curHeight, objBody, objRet; var changeWidth, changeHeight; if ( !(objBody = f_getTopBodyObj()) ) return; changeWidth = w - objBody.clientWidth; changeHeight = h - objBody.clientHeight; if ( isNaN(changeWidth) || isNaN(changeHeight) || ( changeWidth == 0 && changeHeight == 0)) return false; return new f_makeObjChangeSize(changeWidth, changeHeight); } function f_normalWinResize(objChangeSize) { if ( !objChangeSize ) return; } function f_modalWinResize(w, h, bCenter) { var objChangeSize, dWidth, dHeight; if ( !w || !h ) return; if ( !(objChangeSize = f_getChangeSize(w, h)) ) return; dWidth = parseInt(top.dialogWidth)+objChangeSize.width; dHeight = parseInt(top.dialogHeight)+objChangeSize.height; self.top.dialogWidth = dWidth+"px"; self.top.dialogHeight = dHeight+"px"; if ( bCenter ) windowPositionCenter(w,h); } function windowPositionCenter(w,h) { var nTop, nLeft; if ( !w || !h ) return; nTop = (screen.height-h)/2; nLeft = (screen.width-w)/2; if ( f_isDialogWindow() ) { self.top.dialogTop = nTop+"px"; self.top.dialogLeft = nLeft+"px"; } else self.top.moveTo(nLeft, nTop); } function windowResize( w, h, bCenter) { windowResizeBy(w, h, bCenter); } function windowResizeBy(w, h, bCenter) { var objChangeSize; try { if ( f_isDialogWindow() ) { return setTimeout("f_modalWinResize("+w+", "+h+", "+bCenter+")",0); } if ( !w ) return; if ( !h ) h = document.body.scrollHeight; if ( !(objChangeSize = f_getChangeSize(w, h)) ) return; self.top.resizeBy(objChangeSize.width , objChangeSize.height); if ( bCenter ) windowPositionCenter(w,h); } catch(x) { } } function windowResizeEx(w,h, bCenter) { windowResizeBy(w, h, bCenter); } function windowAutoResize(bCenter) { windowResizeBy(document.body.scrollWidth,document.body.scrollHeight,bCenter); } function windowAutoResize2(bCenter) { windowAutoResize(bCenter); } function winAutoResize(bCenter) { windowAutoResize(bCenter); } function windowGetSize() { alert(document.body.scrollWidth+"/"+document.body.scrollHeight); } function fn_iframeResize(obj) { var targWindow, targDocument, targIframe; if ( !(targIframe = document.all[obj]) || !(targWindow = document.frames[obj]) || !(targDocument = targWindow.document) ) return; targIframe.style.pixelWidth = targDocument.body.scrollWidth; targIframe.style.pixelHeight = targDocument.body.scrollHeight; } function selectByValue(obj, val) { var i = 0; if (!obj.type) { if (obj[0].type == "radio") { for (i = 0; i < obj.length; i++) { if (obj[i].value == val) { obj[i].checked = true; return; } } } } else { if (obj.type.match("select*")) { for (i = 0; i < obj.options.length; i++) { if (obj.options[i].value == val) { obj.selectedIndex = i; return; } } } } } function openWinW(strUrl,strWName,nW,nH,nT,nL,bScroll) { var sOption = ""; var strScroll; var nSW = screen.width; var nSH = screen.height; var nPointW = 0, nPointH = 0; if(nT == '' || nL == '') { if(nW < nSW) { nPointW = (nSW - nW) / 2; } if(nH < nSH) { nPointH = (nSH - nH) / 2 - 40; } } else { nPointW = nL; nPointH = nT; } if (bScroll == 0) { strScroll = " scrollbars=no"; } else { strScroll = " scrollbars=yes"; } sOption = sOption + "toolbar=no, channelmode=no, location=no, directories=no, resizable=yes, menubar=no," + strScroll; sOption = sOption + ", width=" + nW + ", height=" + nH + ", top=" + nPointH + ", left=" + nPointW; var PopWin = window.open(strUrl,strWName, sOption); PopWin.focus(); return PopWin; } function f_addOnloadEvent(fnc){ if ( typeof(window.addEventListener)!='undefined' ) { window.addEventListener( 'load', fnc, false ); }else if ( typeof(window.attachEvent)!='undefined' ) { window.attachEvent( 'onload', fnc ); }else{ var orgfunc = window.onload; if (typeof(orgfunc)=='function') { window.onload = function(e) { orgfunc(e); window[fnc](); window.onload = null; } }else{ window.onload = fnc; } } }