﻿var gpWindowObject=function(b,e,g,c,f,d){var a=this;a.controlId=b;a.windowContainer=document.getElementById(b+"Container");a.windowContents=document.getElementById(b+"Contents");a.windowContentPanel=document.getElementById(b+"ContentPanel");a.titleSpan=document.getElementById(b+"TitleText");a.footerSpan=document.getElementById(b+"FooterText");a.splashPanel=document.getElementById(b+"SplashPanel");a.height=e;a.minHeight=0;a.maxHeight=0;a.width=g;a.minWidth=0;a.maxWidth=0;a.hideCallback=null;a.sourceUrl=c;a.headerHeight=30;a.footerHeight=23;a.titleSpan.innerHTML=f;a.footerSpan.innerHTML=d;a.autoSize();a.center();a.resizeEvent=a.bind(a,a.resizeWindow);if(c)a.windowContents.src=c};gpWindowObject.prototype.hideSplashScreen=function(){this.splashPanel.style.display="none"};gpWindowObject.prototype.show=function(g,f,d,c,e){var b="px",a=this;gpUI.showModalBackground();if(d||c){if(d){a.setMaxWidth(d);a.setWidth(d)}if(c){a.setMaxHeight(c);a.setHeight(c)}a.center()}if(g){a.splashPanel.style.top=a.headerHeight+b;a.splashPanel.style.height=a.height+b;a.splashPanel.style.lineHeight=a.height+b;a.splashPanel.style.width=a.width-2+b;a.splashPanel.style.display="";a.windowContents.src=g}f&&a.setTitleText(f);e&&a.setFooterText(e);a.windowContainer.style.display="";if(window.addEventListener)window.addEventListener("resize",a.resizeEvent,false);else window.attachEvent("onresize",a.resizeEvent)};gpWindowObject.prototype.bind=function(b,a){return function(){return a.apply(b,arguments)}};gpWindowObject.prototype.resizeWindow=function(){this.autoSize()};gpWindowObject.prototype.hide=function(){var a=this;a.windowContainer.style.display="none";gpUI.hideModalBackground();a.hideCallback&&a.hideCallback();if(window.removeEventListener)window.removeEventListener("resize",a.resizeEvent,false);else window.detachEvent("onresize",a.resizeEvent)};gpWindowObject.prototype.center=function(){var b="px",a=this;if(a.height>0){var d=0;if(document.documentElement&&document.documentElement.scrollTop)d=document.documentElement.scrollTop;if(document.body.scrollTop>d)d=document.body.scrollTop;if(window.innerHeight)a.windowContainer.style.top=window.innerHeight/2+d+b;else if(document.documentElement.clientHeight&&document.documentElement.clientHeight>0)a.windowContainer.style.top=document.documentElement.clientHeight/2+d+b;else a.windowContainer.style.top=document.body.clientHeight/2+d+b;a.windowContainer.style.marginTop="-"+parseInt((parseInt(a.height)+parseInt(a.headerHeight)+parseInt(a.footerHeight))/2)+b}if(a.width>0){var c=0;if(document.documentElement&&document.documentElement.scrollLeft)c=document.documentElement.scrollLeft;if(document.body.scrollLeft>c)c=document.body.scrollLeft;if(window.innerWidth)a.windowContainer.style.left=window.innerWidth/2+c+b;else if(document.documentElement.clientWidth&&document.documentElement.clientWidth>0)a.windowContainer.style.left=document.documentElement.clientWidth/2+c+b;else a.windowContainer.style.left=document.body.clientWidth/2+c+b;a.windowContainer.style.marginLeft="-"+parseInt(a.width/2)+b}};gpWindowObject.prototype.setMinHeight=function(a){this.minHeight=a};gpWindowObject.prototype.setMaxHeight=function(a){this.maxHeight=a};gpWindowObject.prototype.setHeight=function(b){var c="px",a=this;if(b>0){if(b<a.minHeight)b=a.minHeight;if(b>a.maxHeight&&a.maxHeight>0)b=a.maxHeight;if(window.innerHeight){if(b>window.innerHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight))b=window.innerHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight)}else if(document.documentElement.clientHeight&&document.documentElement.clientHeight>0){if(b>document.documentElement.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight))b=document.documentElement.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight)}else if(b>document.body.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight))b=document.body.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight);a.height=b;a.windowContents.style.height=a.height+c;a.windowContentPanel.style.height=a.height+c;a.windowContainer.style.height=parseInt(a.height)+parseInt(a.headerHeight)+parseInt(a.footerHeight)+c;a.windowContainer.style.marginTop="-"+parseInt((parseInt(a.height)+parseInt(a.headerHeight)+parseInt(a.footerHeight))/2)+c}};gpWindowObject.prototype.getHeight=function(){return this.height};gpWindowObject.prototype.getWindowHeight=function(){return parseInt(this.height)+parseInt(this.headerHeight)+parseInt(this.footerHeight)};gpWindowObject.prototype.setMinWidth=function(a){this.minWidth=a};gpWindowObject.prototype.setMaxWidth=function(a){this.maxWidth=a};gpWindowObject.prototype.setWidth=function(b){var a=this;if(b>0){if(b<a.minWidth)b=a.minWidth;if(b>a.maxWidth&&a.maxWidth>0)b=a.maxWidth;if(window.innerWidth){if(b>window.innerWidth-60)b=window.innerWidth-60}else if(document.documentElement.clientWidth&&document.documentElement.clientWidth>0){if(b>document.documentElement.clientWidth-60)b=document.documentElement.clientWidth-60}else if(b>document.body.clientWidth-60)b=document.body.clientWidth-60;a.width=b;if(a.width-2>0)a.windowContents.style.width=a.width-2+"px";else a.windowContents.style.width="0px";a.windowContainer.style.width=a.width+"px";a.windowContainer.style.marginLeft="-"+parseInt(a.width/2)+"px"}};gpWindowObject.prototype.getWidth=function(){return this.width};gpWindowObject.prototype.resetMinAndMax=function(){var a=this;a.minWidth=0;a.maxWidth=0;a.minHeight=0;a.maxHeight=0};gpWindowObject.prototype.autoSize=function(){var a=this;if(window.innerWidth)a.width=window.innerWidth-60;else if(document.documentElement.clientWidth&&document.documentElement.clientWidth>0)a.width=document.documentElement.clientWidth-60;else a.width=document.body.clientWidth-60;if(window.innerHeight)a.height=window.innerHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight);else if(document.documentElement.clientHeight&&document.documentElement.clientHeight>0)a.height=document.documentElement.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight);else a.height=document.body.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight);a.setWidth(a.width);a.setHeight(a.height);a.center()};gpWindowObject.prototype.calculateMaxWidth=function(){if(window.innerWidth)return window.innerWidth-60;else if(document.documentElement.clientWidth&&document.documentElement.clientWidth>0)return document.documentElement.clientWidth-60;else return document.body.clientWidth-60};gpWindowObject.prototype.calculateMaxHeight=function(){var a=this;if(window.innerHeight)return window.innerHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight);else if(document.documentElement.clientHeight&&document.documentElement.clientHeight>0)return document.documentElement.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight);else return document.body.clientHeight-60-parseInt(a.headerHeight)-parseInt(a.footerHeight)};gpWindowObject.prototype.setTitleText=function(a){if(a&&this.titleSpan)this.titleSpan.innerHTML=a};gpWindowObject.prototype.setFooterText=function(a){if(a&&this.footerSpan)this.footerSpan.innerHTML=a}