/**
 * JS Window framework
 * Library require: animate.js, shadow.js, dragdrop.js
 * @author Siri Chongasamethaworn (goonohc@gmail.com)
 * @version 1.0 November 22, 2006
 * @since November 22, 2006
 */
Library.load({"js/animate.js":["Graphics"],"js/shadow.js":["Shadow"],"js/dragdrop.js":["DragDrop"]});var JWindow=function(A){this.content=this.createDivs(A);this.iframe;this.renderFunction;this.html="";this.height;this.width;this.position;this.dragingObject;this.MSIE=navigator.userAgent.indexOf("MSIE")>=0;window.jwindowObj=this};JWindow.prototype={setRenderFunction:function(A){this.renderFunction=A},setHtml:function(A){this.html=A},setSize:function(B,A){this.width=B;this.height=A},setPosition:function(A,B){this.position=new Point(A,B)},setContentClass:function(A){if(this.content){this.content.className=A}},setShadow:function(A){this.content.shadow=A},setDragable:function(A){this.content.dragdrop=A},setBackground:function(A){if(A){var B=document.createElement("div");B.id="window.backgroundDiv";B.className="windowBackground";B.style.left="0px";B.style.top="0px";B.style.zIndex=1;B.style.background=A==true?"#AAAAAA":A;B.style.position="absolute";this.content.backgroundDiv=B;Graphics.setOpacity(this.content.backgroundDiv,40);if(this.MSIE){this.iframe=document.createElement("iframe");this.iframe.src="about:blank";this.iframe.frameborder=0;this.iframe.style.zIndex=900;this.iframe.style.position="absolute"}}else{this.content.backgroundDiv=null}},elementWindow:function(){return this.content},appendChild:function(A){this.content.appendChild(A)},show:function(){if(this.content&&!this.content.showing){document.body.appendChild(this.content);this.content.showing=true;if(this.content.shadow!=false){Shadow.castShadow(this.content)}if(this.content.dragdrop!=false){DragDrop.makeDragable(this.content);this.content.style.cursor="move"}if(this.content.backgroundDiv){document.body.appendChild(this.content.backgroundDiv)}this.insertContent();this.pack()}},hide:function(){document.documentElement.style.overflow="";if(this.content&&this.content.showing){document.body.removeChild(this.content);this.content.showing=false;Shadow.removeShadow(this.content);DragDrop.removeDragable(this.content);if(this.content.backgroundDiv){document.body.removeChild(this.content.backgroundDiv)}}},createDivs:function(A){var B=document.createElement("div");B.id=A;B.className="windowContent";B.style.zIndex=1000;B.style.position="absolute";return B},pack:function(){if(!this.content){return }var G=Math.max(document.body.scrollTop,document.documentElement.scrollTop);document.documentElement.style.overflow="hidden";var A=Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);var E=Math.max(document.body.scrollTop,document.documentElement.scrollTop);setTimeout("window.scrollTo("+A+","+E+");",10);var D=Graphics.findBodySize();if(this.width){this.content.style.width=this.width+"px"}if(this.height){this.content.style.height=this.height+"px"}if(this.position){if(this.position.x){this.content.style.left=this.position.x+"px"}if(this.position.y){this.content.style.top=this.position.y+"px"}}else{var H=this.content.offsetWidth;var F=this.content.offsetHeight;var B=Math.ceil((D.width-H)>>1);var C=Math.ceil((D.height-F)>>1)+G;this.content.style.left=B+"px";this.content.style.top=C+"px"}if(this.content.backgroundDiv){this.content.backgroundDiv.style.top=document.body.scrollTop+document.documentElement.scrollTop+"px";this.content.backgroundDiv.style.height=D.height+"px";this.content.backgroundDiv.style.width=D.width+"px";if(this.MSIE){if(this.content.style.width){this.iframe.style.width=this.content.style.width}if(this.content.style.height){this.iframe.style.height=this.content.style.height}this.iframe.style.left=this.content.style.left;this.iframe.style.top=this.content.style.top}}if(this.content.shadow){this.content.shadow.repaint()}},insertContent:function(){if(typeof (this.renderFunction)=="function"){setTimeout("window.jwindowObj.renderFunction()",15)}else{if(this.html!=""){this.content.innerHTML=this.html}}}};