var HytossUI = new Object(); HytossUI.core = function() {}; HytossUI.core.prototype = {}; HytossUI.core.Element = function() { var browser; // Complete user agent information var isOpera; // the browser "Opera" var isMSIE; // the browser "Internet Explorer" var isOldMSIE; // this browser and older version of Internet Explorer ( by older, we refer to version 6.0 or lower) var isFirefox; // the browser "Firefox" var __selfhref; var documentWidth; var documentHeight; var fireEvent; this.documentWidth = document.documentElement.clientWidth; this.documentHeight = document.documentElement.clientHeight; this.fireEvent = false; this.browser = navigator.userAgent; this.isOpera = (this.browser.toLowerCase().indexOf('opera') >=0 ) ? true : false; this.isFirefox = (this.browser.toLowerCase().indexOf('firefox') >= 0) ? true : false; this.isMSIE = (this.browser.toLowerCase().indexOf('msie') >= 0) ? true : false; this.isOldMSIE = (this.browser.toLowerCase().match(/msie\s[0-6]/gi)) ? true : false; this.isSafari = (this.browser.toLowerCase().indexOf('safari') >= 0) ? true : false; this.__selfhref = (this.isOldMSIE) ? '#' : ''; try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {} }; HytossUI.core.Element.prototype = { getEl : function(ref) { if ((typeof ref) == 'object') return ref; if (ref == 'body') return document.getElementsByTagName('body')[0]; if (document.getElementById(ref)) return document.getElementById(ref); if (document.forms[ref]) return document.forms[ref]; if (document[ref]) return document[ref]; if (window[ref]) return window[ref]; return ref; } , getUniqueId : function() { return 'UID' + Math.round(Math.random()*10000) + Math.round(Math.random()*10000); } , getX : function(ref) { var obj = this.getEl(ref); return (obj.offsetLeft) ? obj.offsetLeft : parseInt(obj.style.left.replace(/'px'/g, '')); } , getY : function(ref) { var obj = this.getEl(ref); return (obj.offsetTop) ? obj.offsetTop : parseInt(obj.style.top.repalce(/'px'/g, '')); } , getWidth : function(ref) { var obj = this.getEl(ref); var x; if (obj.offsetWidth) return obj.offsetWidth; if (obj.clientWidth) { x = obj.clientWidth + parseInt(obj.style.borderLeftWidth.replace(/'px'/g,'')) + parseInt(obj.style.borderRightWidth.replace(/'px'/g,'')); return x; } if (obj.style.width) { x = obj.clientWidth + parseInt(obj.style.borderLeftWidth.replace(/'px'/g,'')) + parseInt(obj.style.borderRightWidth.replace(/'px'/g,'')); return x; } return null; } , getHeight : function(ref) { var obj = this.getEl(ref); var y; if (obj.offsetHeight) return obj.offsetHeight; if (obj.clientHeight) { y = obj.clientHeight + parseInt(obj.style.borderTopWidth.replace(/'px'/g,'')) + parseInt(obj.style.borderBottomWidth.replace(/'px'/g,'')); return y; } if (obj.style.width) { y = obj.clientWidth + parseInt(obj.style.borderTopWidth.replace(/'px'/g,'')) + parseInt(obj.style.borderBottomWidth.replace(/'px'/g,'')); return y; } return null; } , getPosition : function(ref) { return {top : this.getY(ref), left : this.getX(ref)}; } , getSize : function(ref) { return {width : this.getWidth(ref), height : this.getHeight(ref)}; } , setPosition : function(ref, x, y) { var obj = this.getEl(ref); if (obj) { obj.style.top = y + 'px'; obj.style.left = x + 'px'; } } , setSize : function(ref, x, y) { this.setWidth(ref, x); this.setHeight(ref, y); } , setWidth : function(ref, x) { var obj = this.getEl(ref); obj.style.width = x + 'px'; var resize = 0; if (obj.offsetWidth > x) { resize = obj.offsetWidth - x; obj.style.width = (x - resize) + 'px'; } } , setHeight : function(ref, y) { var obj = this.getEl(ref); obj.style.height = y + 'px'; var resize = 0; if (obj.offsetHeight > y) { resize = obj.offsetHeight - y; obj.style.height = (y - resize) + 'px'; } } , addEventListener : function(ref, e, fn) { var obj = this.getEl(ref); if (coreEl.isOldMSIE) { obj.attachEvent('on'+ e, fn); } else { var oldEvent = eval('obj.on' + e); var evalstr = ''; if ((typeof oldEvent) == 'function') { evalstr = 'obj.on' + e + ' = function(ev) { oldEvent(ev); fn(ev); };'; } else { evalstr = 'obj.on' + e + ' = function(ev) { fn(ev); };'; } eval(evalstr); } } , getEventEl : function(e){ if (!e) e = window.event; var el; if (e.target) { el = e.target; } else if (e.srcElement) { el = e.srcElement; } if (el.nodeType == 3) { el = el.parentNode; } return el; } , removeElement : function(el) { var gBin = document.getElementById('IELeakGBIN'); if (!gBin) { gBin = document.createElement('DIV'); gBin.id = 'IELeakGBIN'; gBin.style.display = 'none'; document.body.appendChild(gBin); } gBin.appendChild(el); gBin.innerHTML = ''; } , getResizeEvent : function() { if(!this.isMSIE) return true; if ((this.documentWidth != document.documentElement.clientWidth) || (this.documentHeight != document.documentElement.clientHeight)) { if (this.documentWidth != document.documentElement.clientWidth) { this.documentWidth = document.documentElement.clientWidth; } if (this.documentHeight != document.documentElement.clientHeight) { this.documentHeight = document.documentElement.clientHeight; } this.fireEvent = true; } else { this.fireEvent = false; } return this.fireEvent; } }; var coreEl = new HytossUI.core.Element(); HytossUI.ui = function() {}; HytossUI.ui.prototype = {}; HytossUI.ui.BoxFrame = function() { var boxObj; var contentObj; var barObj; var statusObj; var centerBox; var hmarginElement; var vmarginElement; var hsizeableElement; var vsizeableElement; this.hmarginElement = new Array(); this.vmarginElement = new Array(); this.hsizeableElement = new Array(); this.vsizeableElement = new Array(); }; HytossUI.ui.BoxFrame.prototype = { createBox : function() { /* 전체 박스 html element */ this.boxObj = document.createElement('div'); this.boxObj.id = coreEl.getUniqueId(); /* Box의 상단 부분 생성*/ var topObj = document.createElement('div'); var topLeft = document.createElement('span'); var topLine = document.createElement('span'); var topRight = document.createElement('span'); topLeft.className = 'top_left'; topLine.className = 'top_line'; topRight.className = 'top_right'; topObj.appendChild(topLeft); topObj.appendChild(topLine); topObj.appendChild(topRight); this.hmarginElement[this.hmarginElement.length] = topLeft; this.hmarginElement[this.hmarginElement.length] = topRight; this.vmarginElement[this.vmarginElement.length] = topLeft; this.hsizeableElement[this.hsizeableElement.length] = topLine; this.barObj = topLine; /* Box의 중간부분 생성 , 다른 페이지 내용이 들어갈 부분 포함 */ var centerObj = document.createElement('div'); var centerLeft = document.createElement('span'); var center = document.createElement('div'); var centerRight = document.createElement('span'); centerObj.className = 'sub'; centerLeft.className = 'content_left'; center.className = 'content_center'; centerRight.className = 'content_right'; centerObj.appendChild(centerLeft); centerObj.appendChild(center); centerObj.appendChild(centerRight); this.contentObj = center; this.hsizeableElement[this.hsizeableElement.length] = center; this.vsizeableElement[this.vsizeableElement.length] = centerLeft; this.vsizeableElement[this.vsizeableElement.length] = center; this.vsizeableElement[this.vsizeableElement.length] = centerRight; this.centerBox = centerObj; /* Box 하단부분 생성 */ var bottomObj = document.createElement('div'); var bottomLeft = document.createElement('span'); var bottomLine = document.createElement('span'); var bottomRight = document.createElement('span'); bottomObj.className = 'sub'; bottomLeft.className = 'bottom_left'; bottomLine.className = 'bottom_line'; bottomRight.className = 'bottom_right'; bottomObj.appendChild(bottomLeft); bottomObj.appendChild(bottomLine); bottomObj.appendChild(bottomRight); this.vmarginElement[this.vmarginElement.length] = bottomLeft; this.hsizeableElement[this.hsizeableElement.length] = bottomLine; this.statusObj = bottomLine; /* Box 구성 */ this.boxObj.appendChild(topObj); this.boxObj.appendChild(centerObj); this.boxObj.appendChild(bottomObj); return this.boxObj; } , setCssClass : function(css) { this.boxObj.className = css; } , setBoxSize : function(width, height) { var hmargin = 0; var vmargin = 0; for (i = 0; i < this.hmarginElement.length; i++) hmargin = hmargin + this.hmarginElement[i].offsetWidth; for (i = 0; i < this.hmarginElement.length; i++) vmargin = vmargin + this.vmarginElement[i].offsetHeight; for (i = 0; i < this.hsizeableElement.length; i++) { coreEl.setWidth(this.hsizeableElement[i], width - hmargin); } for (i = 0; i < this.vsizeableElement.length; i++) { coreEl.setHeight(this.vsizeableElement[i], height - vmargin); } } , setBoxWidth : function(width) { var hmargin = 0; for (i = 0; i < this.hmarginElement.length; i++) hmargin = hmargin + this.hmarginElement[i].offsetWidth; for (i = 0; i < this.hsizeableElement.length; i++) { coreEl.setWidth(this.hsizeableElement[i], width - hmargin); } } , setPosition : function(x, y) { coreEl.setPosition(this.boxObj, x, y); } , loadContentIframe : function(src) { var ifobj; if (coreEl.isMSIE) { ifobj = document.createElement('