
var JPopup=function(){this.constructor.apply(this,arguments);}
JPopup.prototype={constructor:function()
{this.visible=false;this.hideSelects=false;this.returnFunc=null;this.URL=null;this.baseURL=null;this.mask=null;this.frame=null;this.container=null;this.tabIndexes=new Array();this.tabbableTags=new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");this.registerEvent(window,'resize');this.registerEvent(window,'scroll');if(!document.all){this.registerEvent(document,'keypress');}
body=document.getElementsByTagName('body')[0];popmask=document.createElement('div');popmask.id='popup-overlay';popcont=document.createElement('div');popcont.id='popup-container';popcont.innerHTML=''+'<div id="popup-inner">'+'<div id="popup-titlebar">'+'<div id="popup-title"></div>'+'<div id="popup-controls">'+'<div class="close" onclick="document.popup.hide(true, true);" /></div>'+'</div>'+'</div>'+'<iframe src="javascript:false;" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popup-frame" name="popup-frame" width="100%" height="100%" onload="document.popup.onload()"></iframe>'+'</div>';body.appendChild(popmask);body.appendChild(popcont);this.mask=document.getElementById("popup-overlay");this.container=document.getElementById("popup-container");this.frame=document.getElementById("popup-frame");var brsVersion=parseInt(window.navigator.appVersion.charAt(0),10);if(brsVersion<=6&&window.navigator.userAgent.indexOf("MSIE")>-1){this.hideSelects=true;}},registerEvent:function(target,type,args)
{var self=this;if(target.addEventListener){target.addEventListener(type,onEvent,true);}else if(target.attachEvent){target.attachEvent('on'+type,onEvent);}
function onEvent(e){e=e||window.event;e.element=target;return self["on"+type](e,args);}},onresize:function(event,args){this.center();},onscroll:function(event,args){this.center();},onload:function(event,args){if(!this.visible)
return;this.frame.style.display='block';this.setTitle();},onkeypress:function(event,args){if(this.visible&&event.keyCode==9)return false;},show:function(url,width,height,returnFunc)
{if(!width)width=this.getViewportWidth()-100;if(!height)height=this.getViewportHeight()-100;this.visible=true;this.disableTabIndexes();this.mask.style.display="block";this.container.style.display="block";this.center(width,height);var titleBarHeight=parseInt(document.getElementById("popup-titlebar").offsetHeight,10);this.container.style.width=width+"px";this.container.style.height=(height+titleBarHeight)+"px";this.frame.style.width=parseInt(document.getElementById("popup-titlebar").offsetWidth,10)+"px";this.frame.style.height=(height)+"px";if(this.URL!=url)
{this.URL=url;if(this.frame.contentWindow!=undefined){this.frame.style.display='none';}
this.frame.src=url;}
this.returnFunc=returnFunc;if(this.hideSelects==true){this.hideSelectBoxes();}},center:function(width,height)
{if(this.visible==true){if(width==null||isNaN(width)){width=this.container.offsetWidth;}
if(height==null){height=this.container.offsetHeight;}
var fullHeight=this.getViewportHeight();var fullWidth=this.getViewportWidth();var theBody=document.documentElement;var scTop=Browser.is_ie?parseInt(theBody.scrollTop,10):0;var scLeft=Browser.is_ie?parseInt(theBody.scrollLeft,10):0;scTop=0;var titleBarHeight=parseInt(document.getElementById("popup-titlebar").offsetHeight,10);this.container.style.top=scTop+((fullHeight-(height+titleBarHeight))/2)+"px";this.container.style.left=scLeft+((fullWidth-width)/2)+"px";this.mask.style.height=fullWidth+"px";this.mask.style.width=fullWidth+"px";}},hide:function(callReturnFunc,resetURL)
{this.visible=false;this.restoreTabIndexes();if(this.mask==null){return;}
this.mask.style.display="none";this.container.style.display="none";if(callReturnFunc==true&&this.returnFunc!=null){this.returnFunc(window.frames["popup-frame"].returnVal);}
if(resetURL){this.URL=null;document.getElementById("popup-title").innerHTML='';}
if(this.hideSelects==true){this.displaySelectBoxes();}},increaseHeight:function(height)
{var effect=new fx.Height(this.container,{opacity:false,duration:200});effect.custom(this.container.offsetHeight,this.container.offsetHeight+height-9);var effect=new fx.Height(this.frame,{opacity:false,duration:200});effect.custom(this.frame.offsetHeight,this.frame.offsetHeight+height);},decreaseHeight:function(height)
{var effect=new fx.Height(this.container,{opacity:false,duration:200});effect.custom(this.container.offsetHeight,this.container.offsetHeight-height-6);var effect=new fx.Height(this.frame,{opacity:false,duration:200});effect.custom(this.frame.offsetHeight,this.frame.offsetHeight-height);},setTitle:function()
{document.getElementById("popup-title").innerHTML=window.frames["popup-frame"].document.title;},disableTabIndexes:function()
{if(document.all){var i=0;for(var j=0;j<this.tabbableTags.length;j++){var tagElements=document.getElementsByTagName(this.tabbableTags[j]);for(var k=0;k<tagElements.length;k++){this.tabIndexes[i]=tagElements[k].tabIndex;tagElements[k].tabIndex="-1";i++;}}}},restoreTabIndexes:function()
{if(document.all){var i=0;for(var j=0;j<this.tabbableTags.length;j++){var tagElements=document.getElementsByTagName(this.tabbableTags[j]);for(var k=0;k<tagElements.length;k++){tagElements[k].tabIndex=this.tabIndexes[i];tagElements[k].tabEnabled=true;i++;}}}},hideSelectBoxes:function()
{for(var i=0;i<document.forms.length;i++){for(var e=0;e<document.forms[i].length;e++){if(document.forms[i].elements[e].tagName=="SELECT"){document.forms[i].elements[e].style.visibility="hidden";}}}},displaySelectBoxes:function()
{for(var i=0;i<document.forms.length;i++){for(var e=0;e<document.forms[i].length;e++){if(document.forms[i].elements[e].tagName=="SELECT"){document.forms[i].elements[e].style.visibility="visible";}}}},getViewportHeight:function(){if(window.innerHeight!=window.undefined)return window.innerHeight;if(document.compatMode=='CSS1Compat')return document.documentElement.clientHeight;if(document.body)return document.body.clientHeight;return window.undefined;},getViewportWidth:function(){if(window.innerWidth!=window.undefined)return window.innerWidth;if(document.compatMode=='CSS1Compat')return document.documentElement.clientWidth;if(document.body)return document.body.clientWidth;return window.undefined;}}
document.popup=null;document.addLoadEvent(function(){var popup=new JPopup()
document.popup=popup});