SBAScripting.Window = function() { this.blankUrl = "/SBA/blank.html"; this.self = null; this.self = null; this.isOpen = false; this.targetNode = null; this.dragManager = null; this.width = 200; this.height = 200; this.frame = {}; this.dialogArguments = {}; this.imgPrefix = "/SBA/images/win"; this.isContentScrollable = true; this.clearWindow = true; this.id="popup"; }; SBAScripting.Window.prototype = { Init: function(args) { this.height = parseInt(args.height.replace("px", "")) + 37; this.width = parseInt(args.width.replace("px", "")) + 18; this.targetNode = $get(args.targetNode); this.isContentScrollable = args.isContentScrollable; }, PreRender: function(args) { }, GetWindowHandler: function() { if(this.bodyFrame) return this.bodyFrame.getAttribute("WindowHandler"); return null; }, Render: function(args) { var paddingLeft = (this.width - 7) + "px"; var paddingTop = (this.height - 12) + "px"; var frameHeight = (this.height - 37) + "px"; var frameWidth = (this.width - 14) + "px"; var canvasWidth = this.width + "px"; var o_ = this; this.self = this.GetDiv(); this.self.className = "WindowCanvas"; this.self.style.zIndex = 999; this.self.style.height = this.height; this.self.style.width = canvasWidth; this.self.style.display = "none"; this.self.style.position = "absolute"; this.targetNode.appendChild(this.self); this.body = this.GetDiv(); this.body.style.position = "absolute"; this.body.style.width = frameWidth; this.body.style.height = frameHeight; this.body.style.left = "7px"; this.body.style.top = "25px"; this.self.appendChild(this.body); this.bodyFrame = this.GetIframe(); this.bodyFrame.style.position = "absolute"; this.bodyFrame.style.top = "0px"; this.bodyFrame.style.left = "0px"; this.bodyFrame.style.width = frameWidth; this.bodyFrame.style.height = frameHeight; this.body.appendChild(this.bodyFrame); this.frame.leftTop = this.GetImg("", "l_t_7x25.png"); this.frame.leftTop.className = "WindowLeftTop png"; this.self.appendChild(this.frame.leftTop); this.frame.botMid = this.GetImg("", "bot_m_1x12.png"); this.frame.botMid.className = "WindowBotMid png"; this.frame.botMid.style.top = paddingTop; this.frame.botMid.style.width = frameWidth; this.self.appendChild(this.frame.botMid); this.frame.left = this.GetImg("", "l_m_7x1.png"); this.frame.left.className = "WindowLeft png"; this.frame.left.style.height = frameHeight; this.self.appendChild(this.frame.left); this.frame.leftBot = this.GetImg("", "l_b_7x12.png"); this.frame.leftBot.className = "WindowLeftBot png"; this.frame.leftBot.style.top = paddingTop; this.self.appendChild(this.frame.leftBot); this.frame.right = this.GetImg("", "r_m_11x1.png"); this.frame.right.className = "WindowRight png"; this.frame.right.style.height = frameHeight; this.frame.right.style.left = paddingLeft; this.self.appendChild(this.frame.right); this.frame.rightBot = this.GetImg("", "r_b_11x12.png"); this.frame.rightBot.className = "WindowRightBot png"; this.frame.rightBot.style.left = paddingLeft; this.frame.rightBot.style.top = paddingTop; this.self.appendChild(this.frame.rightBot); this.frame.rightTop = this.GetImg("", "r_t_11x25.png"); this.frame.rightTop.className = "WindowRightTop png"; this.frame.rightTop.style.left = paddingLeft; this.self.appendChild(this.frame.rightTop); this.frame.topMid = this.GetImg("", "top_m_1x25.png"); this.frame.topMid.className = "WindowTopMid png"; this.frame.topMid.style.width = frameWidth; this.self.appendChild(this.frame.topMid); this.frame.closeButton = this.GetImg("", "close_19x19.png"); this.frame.closeButton.style.height = "19px"; this.frame.closeButton.style.width = "19px"; this.frame.closeButton.style.right = "5px"; this.frame.closeButton.style.top = "2px"; this.frame.closeButton.style.zIndex = 99999; this.frame.closeButton.style.position = "absolute"; this.self.appendChild(this.frame.closeButton); this.frame.closeButton.onclick = function() { o_.Close(); } this.frame.caption = this.GetDiv(); this.frame.caption.style.position = "absolute"; this.frame.caption.style.left = "10px"; this.frame.caption.style.top = "3px"; this.frame.caption.style.fontFamily = "Arial"; this.frame.caption.style.fontSize = "12px"; this.frame.caption.style.fontWeight = "bold"; this.frame.caption.innerHTML = "SBA Pop-Up";this.self.appendChild(this.frame.caption); this.frame.topMidHider = this.GetDiv(); this.frame.topMidHider.className = "WindowTopMid winHeaderBg"; this.frame.topMidHider.style.width = frameWidth; this.frame.topMidHider.style.zIndex = 9999; this.frame.topMidHider.innerHTML = " "; this.self.appendChild(this.frame.topMidHider); this.bodyFrame.setAttribute("WindowHandler", this); this.bodyFrame.WindowHandler = this; setTimeout(SBAScripting.lang.hitch(this, "RenderComplete"), 0); }, RenderComplete: function(args) { this.dragManager = new SBAScripting.DragManager(); this.dragManager.Init({ domNode: this.self, targetNode: this.frame.topMidHider }); }, Draw: function() { this.PreRender(); this.Render(); }, SetLocation: function(url) { this.bodyFrame.src = url; }, Open: function(url) { if(url) { this.SetLocation(url); } this.self.style.display = "block"; this.isOpen = true; }, OpenAt: function(url, x, y) { this.self.style.left = x; this.self.style.top = y; this.Open(url); }, Close: function() { //ES try { SBAAppWinManager.window = null; } catch(e){} if(this.clearWindow) { this.bodyFrame.src = this.blankUrl; delete this.dragManager; this.targetNode.removeChild(this.self); this.isOpen = false; } this.self.style.display = "none"; try { this.OnClose(); } catch(e){} }, onclose: function(args) { }, OnClose: function() { this.onclose(this.dialogArguments); }, GetDiv: function() { return document.createElement("div"); }, GetImg: function(alt, src) { var img = document.createElement("img"); img.alt = alt; img.src = this.imgPrefix + "/" + src; return img; }, GetIframe: function() { var ifr = document.createElement("iframe"); ifr.src = this.blankUrl; if(this.isContentScrollable) { ifr.scrolling = "auto"; } else { ifr.scrolling = "no"; } ifr.frameBorder = 0; return ifr; }, end__ : {} }; SBAScripting.Window.registerClass("SBAScripting.Window");