function FW_Window(A){this.left=10;this.top=10;this.width=190;this.height=150;this.min_height=150;this.min_width=190;this.title="&nbsp;";this.theme="";this.url="";this.name=this.identifier;this.autosize=false;this.autocenter=false;this.autocenteronrefresh=false;this.autosizeonrefresh=false;this.minimizable=false;this.can_close=true;this.resizable=true;this.moveable=true;this.scrollbars=true;this.modal=false;this.titlebar=true;this.external=false;this.showloading=true;this.showloadingscreen=false;this.status=true;this.dynamicgen=false;this.dialog=false;this.fw_window=false;this.closeonblur=false;this.destroyonclose=false;this.reloadonopen=false;this.refreshparentonclose=false;this._check_freq=50;this.closed=false;this._check_count=0;this._created=false;this._loaded=false;}FW_Window.prototype._init_args=function(A){if(A!=null){this.option_list=["theme","left","top","width","height","name","title","url","taskbar","autosize","autocenter","autosizeonrefresh","autocenteronrefresh","resizable","moveable","modal","scrollbars","titlebar","directories","menubar","outerWidth","outerHeight","z-lock","toolbar","status","dynamicgen","showloading","close","minimizable","dialog","closeonblur","refreshparentonclose","effect_open","effect_close","showloadingscreen","external","destroyonclose","reloadonopen","ghosting","ghosttype"];for(i in this.option_list){if(A[this.option_list[i]]!=null){var B=this.option_list[i];var C=this.option_list[i];if(C=="close"){B="can_close";}this[B]=A[C];}}if(A.autosizeonrefresh==null){this.autosizeonrefresh=this.autosize;}}if(FW.effects_enabled){this.effect_open=new FW_Effect_Opacity({start:0,end:100,duration:1});this.effect_close=new FW_Effect_Opacity({start:100,end:0,duration:1});}this._initial_width=this.width;this._initial_height=this.height;};FW_Window._list=new Array();FW_Window._count=0;FW_Window.prototype.init=function(A){this.width=this._initial_width;this.height=this._initial_height;this.identifier="FW_Window_"+this.name+"_"+FW_Window._count;this.opener=window;FW_Window._count=parseInt(FW_Window._count)+1;FW_Window._list.push(this);};FW_Window.prototype._true=function(A){if(A==true||A==1||A=="yes"){return true;}else{return false;}};FW_Window.prototype.close=function(A){this.window.close();};FW_Window.prototype._remove_from_registry=function(){var B=new Array();for(var A=0;A<FW_Window._list.length;A++){if(FW_Window._list[A].identifier!=this.identifier){B.push(FW_Window._list[A]);}}FW_Window._list=B;};FW_Window.prototype.location=function(A){this.window.document.location=A;this.document=this.window.document;return true;};FW_Window.prototype.scroll_size_x=function(){if(this.window.scrollMaxX!=null){return this.window.scrollMaxX;}else{return this.document.body.scrollWidth-this.document.body.clientWidth;}};FW_Window.prototype.scroll_size_y=function(){if(this.window.scrollMaxY!=null){return this.window.scrollMaxY;}else{return this.document.body.scrollHeight-this.document.body.clientHeight;}};FW_Window.prototype.loaded=function(){if(this.closed==true){return false;}this.document=this.window.document;(this._loaded==true)?(this._event_on_refresh()):(this._event_on_load());this._install_hooks();this._loaded=true;if(this._layer){this._layer.show();}};FW_Window.prototype._fix_ff_bug=function(){try{clearTimeout(_fw_window_timeout);}catch(A){}};FW_Window.prototype._event_onload=function(){};FW_Window.prototype._event_onunload=function(){};FW_Window.prototype._event_onclose=function(){this._created=false;this._loaded=false;if(this._true(this.refreshparentonclose)){refresh_window();}this._remove_from_registry();};FW_Window.prototype._event_on_refresh=function(A){this.document=this.window.document;if(this._loading_div!=null){this._loading_div.style.display="none";this._iframe.style.width="100%";this._iframe.style.height="100%";}if(this._layer&&this._layer.maximised==true){return ;}if(this._true(this.autosizeonrefresh)){this.size_by_content();}if(this._true(this.autocenteronrefresh)){this.center();}};FW_Window.prototype._get_doc_title=function(){var B="&nbsp;";try{B=this.window.document.title;}catch(A){}return B;};function FW_Window_Standard(A){this.type="standard";this._init_args(A);}FW_Window_Standard.prototype=new FW_Window();FW_Window_Standard.prototype.open=function(B){this.init(B);this._loaded=false;if(this.autocenter==true){this.left=(screen.width/2)-(this.width/2);this.top=(screen.height/2)-(this.height/2);}var A="";for(var D=0;D<this.option_list.length;D++){var E=this[this.option_list[D]];var C=this.option_list[D];if(C=="close"){E=this["can_close"];}if(E!=null){if(E==true){E="yes";}else{if(E==false){E="no";}}A+=C+"="+E+",";}}this.window=window.open(this.url,this.identifier,A);this.document=this.window.document;this._created=true;this.closed=false;return true;};FW_Window_Standard.prototype.focus=function(A){this.window.focus();return true;};FW_Window_Standard.prototype.get_width=function(A){if(this.window.innerWidth!=null){return this.window.innerWidth;}else{return document.body.offsetWidth;}};FW_Window_Standard.prototype.get_height=function(A){if(this.window.innerHeight!=null){return this.window.innerHeight;}else{return document.body.offsetHeight;}};FW_Window_Standard.prototype._event_on_load=function(A){if(this.autosize){this.size_by_content();}if(this.autocenter){this.center();}if(this.onload!=null){var B;if(this.onload_scope!=null){B=this.onload_scope;}else{B=this;}this.onload.call(B);}this.document=this.window.document;};FW_Window_Standard.prototype.move_to=function(A,B){this.window.moveTo(A,B);};FW_Window_Standard.prototype._center_x=function(){var B;var C=FW_Browser.view_port_left();var A=FW_Browser.view_port_right()-C;if(this.window.innerWidth){B=this.window.innerWidth;}else{B=this.document.body.clientWidth;}return((screen.width/2)-(B/2));};FW_Window_Standard.prototype._center_y=function(){var B;var A=FW_Browser.view_port_top();var C=FW_Browser.view_port_bottom()-A;if(this.window.innerHeight){B=this.window.innerHeight;}else{B=this.document.body.clientHeight;}return((screen.height/2)-(B/2));};FW_Window_Standard.prototype.center=function(){this.window.moveTo(this._center_x(),this._center_y());};FW_Window_Standard.prototype._install_hooks=function(){this.window.onclose=_fw_window_close_hook;};FW_Window_Standard.prototype.resize_to=function(A,B){this.window.resizeTo(A,B);this.width=A;this.height=B;};FW_Window_Standard.prototype.size_by_content=function(){var F=this.window;var C=this.window.document.getElementById("Content");if(C){var D=new Array(this.window.document.getElementById("Content"),this.window.document.getElementById("Header"),this.window.document.getElementById("Footer"));var I=0;var B=0;for(var E=0;E<D.length;E++){if(D[E]==null){continue;}I=parseInt(I)+FW_Element.height(D[E]);if(E==0){B=parseInt(B)+FW_Element.width(D[E]);}}I=parseInt(I)+90;B=parseInt(B)+55;this.resize_to(B,I);}else{var H=50;var A=50;this.resize_to(A,H);var G=0;var I=H;var B=A;while(this.scroll_size_y()>0){I+=parseInt(this.scroll_size_y());this.resize_to(B,I);if(G>100){break;}G++;}G=0;while(this.scroll_size_x()>0){B+=parseInt(this.scroll_size_x());this.resize_to(B,I);if(G>100){break;}G++;}}};function FW_Window_Virtual(A){this.type="virtual";this.ghosting=false;this.ghosttype="shadow";this._init_args(A);}FW_Window_Virtual._window_overlay=null;FW_Window_Virtual.prototype=new FW_Window();FW_Window_Virtual.prototype.focus=function(A){this._layer.bring_to_top();return true;};FW_Window_Virtual.prototype.close=function(A){if(this.closed){return false;}this._event_onclose();if(this.effect_close){var B=this;this.effect_close.oncomplete=function(){(B.destroyonclose)?(B.destroy()):(B.hide());B.effect_close.oncomplete=null;};this._call_effect(this.effect_close);}else{(this.destroyonclose)?(this.destroy(A)):(this.hide());}this.closed=true;return true;};FW_Window_Virtual.prototype.hide=function(){this._destroy_overlay();this._layer.hide();if(this._iframe){this._iframe.style.display="none";}};FW_Window_Virtual.prototype.show=function(){if(this.modal){this._create_overlay();}this._layer.show();if(this._iframe){this._iframe.style.display="";}this.closed=false;};FW_Window_Virtual.prototype.get_document=function(){try{var B=this.document.body;return this.document;}catch(A){return null;}};FW_Window_Virtual.prototype.destroy=function(D){var B=FW_Browser.window_scroll();var A=document.createElement("INPUT");document.body.insertBefore(A,document.body.childNodes[0]);A.focus();var E=this.get_document();if(E){E.open();E.writeln("");}this._loaded=false;this._remove_from_registry();this._created=false;if(this._iframe){FW_Element.remove(this._iframe);}this._layer=this._layer.destroy();this._window_element=null;var C=new Array("nw","n","ne","e","w","sw","s","se","title","content","top","bottom","status","iframe");for(i in C){this["_"+C[i]]=null;}this._destroy_overlay();FW_Element.remove(A);FW_Browser.window_scroll(B.top,B.left);};FW_Window_Virtual.prototype.maximise=function(A){if(this._layer.maximised==false){this._layer.maximise();}else{this._layer.restore();}return true;};FW_Window_Virtual.prototype.dbl_click=function(A){if(this._true(this.resizable)){this.maximise();}};FW_Window_Virtual.prototype.minimise=function(A){if(this.taskbar==null){return false;}var B=document.createElement("DIV");this._window_icon=B;B.className="FW_WindowIcon";B.innerHTML=this.title;B.FW_Window._count=this.identifier;B.onclick=_fw_window_icon_click_hook;this.taskbar.appendChild(B);this._layer.hide();return true;};FW_Window_Virtual.prototype.resize_to=function(A,B){this._layer.resize_to(A,B);this.width=A;this.height=B;};FW_Window_Virtual.prototype.writeln=function(A){if(this._iframe){this._iframe.contentWindow.document.writeln(A);}else{this._content.innerHTML=this._content.innerHTML+A;}};FW_Window_Virtual.prototype.size_by_content=function(){var A=this.document.getElementById("Page");sizer=(A==null)?(this.document.body):(A);this.resize_to(FW_Element.width(sizer)+28,FW_Element.height(sizer));return true;};FW_Window_Virtual.prototype._event_onclose=function(){var A=true;if(this._loaded==true&&!this.external){var C=this.get_document();if(this._loaded==true&&!this.external&&this.destroyonclose&&C&&C.body.onunload){var B=C.body.onunload.call(this.window);if(B==false){A=false;}}}if(this._true(this.refreshparentonclose)){refresh_window();}return A;};FW_Window_Virtual.prototype.center=function(){this._layer.center();};FW_Window_Virtual.prototype.move_to=function(A,B){this._layer.move_to(A,B);};FW_Window_Virtual.prototype.reload=function(){if(this._iframe!=null){this.window.location.replace(this.window.location);}if(this._loading_div!=null){this._loading_div.style.display="";this._iframe.style.width="1px";this._iframe.style.height="1px";}};FW_Window_Virtual.prototype.open=function(B){if(this._created==true){if(this.closed==true){this.show();if(!this.reloadonopen){this._event_on_load();}}else{this.focus();}if(this.reloadonopen){this.reload();}return false;}this.init(B);if(this.theme){this._base_class="Window_"+this.theme;}else{this._base_class="Window";}if(this.modal){this._create_overlay();}var F=this.identifier;var A=this._base_class;var C=document.createElement("DIV");C.style.left=parseInt(this.left)+"px";C.style.top=parseInt(this.top)+"px";C.style.height=parseInt(this.height)+"px";C.style.width=parseInt(this.width)+"px";C.style.display="inline";C.className=this._base_class;if(this.name!=null){C.className+=" FW_Window"+this.name;}this._window_element=C;if(this.showloading==false){this._window_element.style.display="none";}var E="<td class='"+A+"_se' id='"+F+"_se'></td>";if(this.resizable){E="<td class='"+A+"_sizer' id='"+F+"_sizer'></td>";}var D="";C.innerHTML="      <table cellpadding='0' cellspacing='0' height='1' id='"+F+"_top' class='"+A+"_top'>        <tr>          <td class='"+A+"_nw' id='"+F+"_nw'></td>          <td class='"+A+"_n'  id='"+F+"_n'><div id='"+F+"_title' class='"+A+"_title'>"+this.title+"</div></td>          <td class='"+A+"_ne' id='"+F+"_ne'></td>        </tr>      </table>      <table cellpadding='0' cellspacing='0' id='"+F+"_middle' style='height: 100%' width='100%' class='"+A+"_middle'>        <tr>          <td class='"+A+"_w' id='"+F+"_w'></td>  		  <td id='"+F+"_content' class='"+A+"_content' style='padding: 0px;  height: 100%; margin: 0px; vertical-align: top;'>"+D+"</td>          <td class='"+A+"_e' id='"+F+"_e'></td>        </tr>      </table>        <table cellpadding='0' cellspacing='0' id='"+F+"_button' width='100%' height='1' class='"+A+"_bottom'>        <tr>          <td class='"+A+"_sw' id='"+F+"_sw'></td>          <td class='"+A+"_s' id='"+F+"_s'><div id='"+F+"_status' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>		  "+E+"        </tr>      </table>    ";document.body.appendChild(C);this._content=$(F+"_content");this._top=$(F+"_top");this._bottom=$(F+"_bottom");this._title=$(F+"_title");this._status=$(F+"_status");this._title.identifier=this.identifier;this._title.ondblclick=_fw_window_dbl_click_hook;if(this.titlebar==false){this._top.style.display="none";}if(this.statusbar==false){this._status.style.display="none";}this._positions=new Array("nw","n","ne","e","w","sw","s","se");for(i in this._positions){this["_"+this._positions[i]]=$(F+"_"+this._positions[i]);}this._se=(this.resizable)?$(F+"_sizer"):$(F+"_se");if(this.url&&this.showloadingscreen){this._loading_div=document.createElement("DIV");this._loading_div.className=this._base_class+"_loading";this._content.appendChild(this._loading_div);}this._layer=new FW_Layer({element:this._window_element,resize_elements:new Array([this._nw,FW_Layer.RESIZE_NW],[this._ne,FW_Layer.RESIZE_NE],[this._e,FW_Layer.RESIZE_E],[this._w,FW_Layer.RESIZE_W],[this._sw,FW_Layer.RESIZE_SW],[this._se,FW_Layer.RESIZE_SE]),drag_elements:(this.moveable?new Array(this._title,this._s):""),selected_class_name:this._base_class+"Selected",min_width:this.min_width,float_type:"absolute",ghosting:this.ghosting,ghosttype:this.ghosttype,min_height:this.min_height});this._layer.identifier=this.identifier;this._layer.add_event("resizestart",FW_Window_Virtual._event_resize_start);this._layer.add_event("resizeend",FW_Window_Virtual._event_resize_end);this._layer.add_event("dragstart",FW_Window_Virtual._event_drag_start);this._layer.add_event("dragend",FW_Window_Virtual._event_drag_end);bottom_bar_height=(this._bottom==null)?(0):(this._bottom.offsetHeight);top_bar_height=(this._top==null)?(0):(this._top.offsetHeight);if(bottom_bar_height||top_bar_height){this._layer.resize_to(parseInt(this.width)+5,parseInt(this.height)+parseInt(top_bar_height+bottom_bar_height));}if(this.url){this._create_iframe();}if(this.autocenter){this.center();}if(this.showloading){this._call_effect(this.effect_open);}this._create_buttons();this._created=true;this.closed=false;if(this.external){this.loaded();this.set_title("&nbsp;");}return true;};FW_Window_Virtual.prototype.get_height=function(){this.bottom_bar_height=(this._bottom==null)?(0):(this._bottom.offsetHeight);this.top_bar_height=(this._top==null)?(0):(this._top.offsetHeight);this.content_height=(this._top==null)?(0):(this._content.offsetHeight);return this.bottom_bar_height+this.top_bar_height+this.content_height;};FW_Window_Virtual.prototype.get_width=function(){this.bottom_bar_width=(this._bottom==null)?(0):(this._bottom.offsetWidth);this.top_bar_width=(this._top==null)?(0):(this._top.offsetWidth);this.content_width=(this._top==null)?(0):(this._content.offsetWidth);return this.bottom_bar_width+this.top_bar_width+this.content_width;};FW_Window.prototype.is_type=function(A){var B=this._get_doc_title();if(B!=null&&B.search(A)>-1){return true;}else{return false;}};FW_Window_Virtual._event_resize_start=function(B){var A=FW_Window.get(this.identifier);if(A.is_type("pdf")){return true;}if(A&&A._iframe){A._iframe.style.display="none";}};FW_Window_Virtual._event_resize_end=function(B){var A=FW_Window.get(this.identifier);if(A.is_type("pdf")){return true;}if(A&&A._iframe){A._iframe.style.display="";}};FW_Window_Virtual._event_drag_start=function(B){var A=FW_Window.get(this.identifier);if(A.is_type("pdf")){return true;}if(A&&A._iframe){A._iframe.style.display="none";}};FW_Window_Virtual._event_drag_end=function(B){var A=FW_Window.get(this.identifier);if(A.is_type("pdf")){return true;}if(A&&A._iframe){A._iframe.style.display="";}};FW_Window_Virtual.prototype._call_effect=function(A){if(A!=null){A.element=this._window_element;A.apply();}};FW_Window_Virtual.prototype._create_iframe=function(){var B=document.createElement("IFRAME");B.frameBorder=0;B.height="100%";B.width="100%";B.style.margin="0px";B.style.padding="0px";B.style.border="0px";B.name=this.identifier;this._iframe=B;if(!(this._true(this.scrollbars))){B.scrolling="no";}if(this._loading_div!=null){B.style.height="1px";B.style.width="1px";}else{B.style.height="100%";B.style.width="100%";}B.src=this.url;this._content.appendChild(B);var A=((B.contentWindow)?(B.contentWindow):(B));A.name=this.identifier;this.window=A;};FW_Window_Virtual.prototype._create_buttons=function(B){if(this.can_close){var C=document.createElement("DIV");C.className=this._base_class+"_close";C.identifier=this.identifier;C.onclick=_fw_window_close_hook;this._title.parentNode.appendChild(C);}if(this.minimizable&&!this.modal){var A=document.createElement("DIV");A.className=this._base_class+"_minimize";A.identifier=this.identifier;A.onclick=_fw_window_minimise_hook;this._title.parentNode.appendChild(A);}if(this.resizable){var D=document.createElement("DIV");D.className=this._base_class+"_maximize";D.identifier=this.identifier;D.onclick=_fw_window_maximise_hook;this._title.parentNode.appendChild(D);}};FW_Window_Virtual.prototype._icon_click=function(A){FW_Element.remove(this._window_icon);this._layer.show();};FW_Window_Virtual.prototype.set_title=function(A){if(this._title!=null){this._title.innerHTML=A;this.title=A;}};FW_Window_Virtual.prototype._reset_scroll=function(){try{FW_Browser.window_scroll_top(0,this.window);FW_Browser.window_scroll_left(0,this.window);}catch(A){}};FW_Window_Virtual.prototype._event_on_load=function(A){this.document=this._iframe.contentWindow.document;this.set_title(this._get_doc_title());this.window=this._iframe.contentWindow;this._iframe.style.display="";if(!this.showloading){this._window_element.style.display="";this._call_effect(this.effect_open);this._layer.check_boundary();}if(this._layer.maximised==false){if(this.autosize){this.size_by_content();}if(this.autocenter){this._layer.center();}}if(this._loading_div!=null){this._loading_div.style.display="none";this._iframe.style.width="100%";this._iframe.style.height="100%";}this._reset_scroll();this._layer.enforce_boundary=false;if(this.onload!=null){var B;if(this.onload_scope!=null){B=this.onload_scope;}else{B=this;}this.onload.call(B);}this._loaded=true;};FW_Window_Virtual.prototype._install_hooks=function(){this.window.w_opener=window;this.window.opener=window;this.window.close=_fw_window_close_hook;};FW_Window_Virtual.prototype._create_overlay=function(){if(FW_Window_Virtual._window_overlay!=null){return false;}var A=document.createElement("DIV");document.body.appendChild(A);A.style.position="absolute";A.style.top=FW_Browser.view_port_top()+"px";A.style.left=FW_Browser.view_port_left()+"px";A.style.width=(FW_Browser.view_port_right()-FW_Browser.view_port_left())+"px";A.style.height=(FW_Browser.view_port_bottom()-FW_Browser.view_port_top())+"px";A.style.zIndex=999;A.className=this._base_class+"_overlay";A.innerHTML="&nbsp";A.id="_fw_window_overlay";if(this.taskbar!=null){this.taskbar.style.zIndex=FW_Layer.base_zindex-1;}FW_Window_Virtual._window_overlay=A;return true;};FW_Window_Virtual.prototype._destroy_overlay=function(){if(FW_Window_Virtual._window_overlay!=null){FW_Element.remove(FW_Window_Virtual._window_overlay);FW_Window_Virtual._window_overlay=null;}return true;};FW_Window.get=function(B){for(var A=0;A<FW_Window._list.length;A++){if(FW_Window._list[A].identifier==B){return FW_Window._list[A];}}return null;};FW_Window.me=function(){var A;if(window.opener!=null){A=window.opener;}else{A=window.parent;}if(A){return A.FW_Window.get(window.name);}};function _fw_window_get_window(B){for(var A=0;A<FW_Window._list.length;A++){if(FW_Window._list[A].identifier==B){return FW_Window._list[A];}}return null;}function _fw_window_close_hook(B){var C=(this.identifier?this.identifier:this.name);var A=FW_Window.get(C);if(A){A.close(B);}return false;}function _fw_window_maximise_hook(A){FW_Window.get(this.identifier).maximise(A);return false;}function _fw_window_minimise_hook(A){FW_Window.get(this.identifier).minimise(A);return false;}function _fw_window_dbl_click_hook(A){FW_Window.get(this.identifier).dbl_click(A);}function _fw_window_icon_click_hook(A){FW_Window.get(this.identifier)._icon_click(A);}function _fw_window_onunload(C){for(var B=0;B<FW_Window._list.length;B++){var A=FW_Window._list[B];A.destroy();}return true;}function _fw_window_document_onmouseup(B){try{for(var A=0;A<FW_Window._list.length;A++){if(FW_Window._list[A].closeonblur==true&&FW_Window._list[A]._loaded==true&&FW_Window._list[A].type=="virtual"){if(FW_Window._list[A]._layer._event_type==null){FW_Window._list[A].close();}}}}catch(B){}return true;}function _fw_window_document_onresize(A){if(FW_Window_Virtual._window_overlay!=null){var B=FW_Window_Virtual._window_overlay;B.style.top=FW_Browser.view_port_top()+"px";B.style.width=(FW_Browser.view_port_right())+"px";B.style.height=(FW_Browser.view_port_bottom())+"px";}return true;}EventHandler.addEvent(document,"mousedown",_fw_window_document_onmouseup);EventHandler.addEvent(window,"resize",_fw_window_document_onresize);EventHandler.addEvent(window,"scroll",_fw_window_document_onresize);
