var windowDragging=false;
var Window=Class.create();
Window.prototype={initialize:function(id,_2){
this.hasEffectLib=String.prototype.parseColor!=null;
this.minWidth=_2.minWidth||100;
this.minHeight=_2.minHeight||100;
this.maxWidth=_2.maxWidth||600;
this.maxHeight=_2.maxHeight||400;
this.showEffect=Element.show;
this.hideEffect=Element.hide;
var _3=_2.resizable!=null?_2.resizable:true;
var _4=_2.className!=null?_2.className:"dialog";
this.element=this.createWindow(id,_4,_3,_2.title,_2.url);
this.isIFrame=_2.url!=null;
this.eventMouseDown=this.initDrag.bindAsEventListener(this);
this.eventMouseUp=this.endDrag.bindAsEventListener(this);
this.eventMouseMove=this.updateDrag.bindAsEventListener(this);
this.topbar=$(this.element.id+"_top");
Event.observe(this.topbar,"mousedown",this.eventMouseDown);
if(_3){
this.sizer=$(this.element.id+"_sizer");
Event.observe(this.sizer,"mousedown",this.eventMouseDown);
}
var _5=parseFloat(_2.top)||10;
var _6=parseFloat(_2.width)||200;
var _7=parseFloat(_2.height)||200;
if(_2.left!=null){
Element.setStyle(this.element,{left:parseFloat(_2.left)+"px"});
}
if(_2.right!=null){
Element.setStyle(this.element,{right:parseFloat(_2.right)+"px"});
}
if(_2.top!=null){
Element.setStyle(this.element,{top:_2.top+"px"});
}
if(_2.bottom!=null){
Element.setStyle(this.element,{bottom:_2.bottom+"px"});
}
this.setSize(_6,_7);
if(_2.opacity){
this.setOpacity(_2.opacity);
}
if(_2.zIndex){
Element.setStyle(this.element,{zIndex:_2.zIndex});
}
Windows.register(this);
},destroy:function(){
Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);
if(this.sizer){
Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown);
}
var _8=document.getElementsByTagName("body").item(0);
if(this.iefix){
Element.remove(this.iefix);
}
_8.removeChild(this.element);
Windows.unregister(this);
},getContent:function(){
return $(this.element.id+"_content");
},getHeader:function(){
return $(this.element.id+"_header1");
},getFooter:function(){
return $(this.element.id+"_footer1");
},getId:function(){
return this.element.id;
},initDrag:function(_9){
windowDragging=true;
this.pointer=[Event.pointerX(_9),Event.pointerY(_9)];
this.doResize=false;
var _a=$(this.getId()+"_close");
if(_a&&Position.within(_a,this.pointer[0],this.pointer[1])){
return;
}
if(this.sizer&&Position.within(this.sizer,this.pointer[0],this.pointer[1])){
this.doResize=true;
}
Event.observe(document,"mouseup",this.eventMouseUp);
Event.observe(document,"mousemove",this.eventMouseMove);
if(this.isIFrame){
var _b=document.getElementsByTagName("body").item(0);
var _c=document.createElement("div");
_c.style.position="absolute";
_c.style.top="0px";
_c.style.bottom="0px";
_c.style.zIndex="10000";
_c.style.width=(this.width+100)+"px";
_c.style.height=(this.height+100)+"px";
this.element.appendChild(_c);
this.tmpDiv=_c;
}
this.toFront();
Event.stop(_9);
},updateDrag:function(_d){
var _e=[Event.pointerX(_d),Event.pointerY(_d)];
var dx=_e[0]-this.pointer[0];
var dy=_e[1]-this.pointer[1];
this.pointer=_e;
if(this.doResize){
var _11=parseFloat(Element.getStyle(this.element,"width"));
var _12=parseFloat(Element.getStyle(this.element,"height"));
_11+=dx;
_12+=dy;
var _13=Element.getStyle(this.element,"right");
if(_13!=null){
Element.setStyle(this.element,{right:(parseFloat(_13)-dx)+"px"});
}
var _14=Element.getStyle(this.element,"bottom");
if(_14!=null){
Element.setStyle(this.element,{bottom:(parseFloat(_14)-dy)+"px"});
}
this.setSize(_11,_12);
}else{
var top=Element.getStyle(this.element,"top");
var _16=Element.getStyle(this.element,"left");
if(_16!=null){
_16=parseFloat(_16)+dx;
Element.setStyle(this.element,{left:_16+"px"});
}else{
var _13=Element.getStyle(this.element,"right");
_13=parseFloat(_13)-dx;
Element.setStyle(this.element,{right:_13+"px"});
}
if(top!=null){
top=parseFloat(top)+dy;
Element.setStyle(this.element,{top:top+"px"});
}else{
var _14=Element.getStyle(this.element,"bottom");
_14=parseFloat(_14)-dy;
Element.setStyle(this.element,{bottom:_14+"px"});
}
}
if(this.iefix){
this._fixIEOverlapping();
}
Event.stop(_d);
},endDrag:function(_17){
Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove);
if(this.isIFrame){
this.tmpDiv.parentNode.removeChild(this.tmpDiv);
this.tmpDiv=null;
}
Event.stop(_17);
windowDragging=false;
},createWindow:function(id,_19,_1a,_1b,url){
var _1d=document.getElementsByTagName("body").item(0);
win=document.createElement("div");
win.setAttribute("id",id);
win.className="dialog";
if(!_1b){
_1b="&nbsp;";
}
var _1e;
if(url){
_1e="<IFRAME id=\""+id+"_content\" SRC=\""+url+"\" > </IFRAME>";
}else{
_1e="<DIV id=\""+id+"_content\" class=\""+_19+"_content\"></DIV>";
}
win.innerHTML="\t\t<DIV class=\""+_19+"_close\" id=\""+id+"_close\" onclick=\"Windows.close('"+id+"')\"> </DIV>\t\t<TABLE background='#F00' border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\""+id+"_header\">\t\t\t<TR id=\""+id+"_row1\">\t\t\t\t<TD> \t\t\t\t\t<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\""+id+"_top\">\t\t\t\t\t\t<TR>\t\t\t\t\t\t\t<TD id=\""+id+"_nw\"  class=\""+_19+"_nw\"> </TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_n\"  valign=\"middle\">\t\t\t\t\t\t\t\t<DIV class=\""+_19+"_title\" id=\""+_19+"_title\">"+_1b+" </DIV>\t\t\t\t\t\t\t\t\t\t\t\t\t</TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_ne\"> </TD>\t\t\t\t\t\t</TR>\t\t\t\t\t</TABLE>\t\t\t\t</TD>\t\t\t</TR>\t\t\t<TR id=\""+id+"_rowHeader\">\t\t\t\t<TD> \t\t\t\t\t<TABLE class=\""+_19+"der=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" >\t\t\t\t\t\t<TR>\t\t\t\t\t\t\t<TD class=\""+_19+"_w\"><DIV class=\""+_19+"_w\"> </TD> \t\t\t\t\t\t\t<TD class=\""+_19+"_header\"><DIV id='"+id+"_header1' class='"+_19+"_header'>&nbsp</DIV></TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_e\"><DIV class=\""+_19+"_e\"> </TD>\t\t\t\t\t\t</TR>\t\t\t\t\t</TABLE>\t\t\t\t</TD>\t\t\t</TR>\t\t\t<TR id=\""+id+"_row2\">\t\t\t\t<TD> \t\t\t\t\t<TABLE class=\""+_19+"der=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\t\t\t\t\t\t<TR>\t\t\t\t\t\t\t<TD class=\""+_19+"_w\"><DIV class=\""+_19+"_w\"> </TD> \t\t\t\t\t\t\t<TD class=\""+_19+"_content\">"+_1e+"</TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_e\"><DIV class=\""+_19+"_e\"> </TD>\t\t\t\t\t\t</TR>\t\t\t\t\t</TABLE>\t\t\t\t</TD>\t\t\t</TR>\t\t\t<TR id=\""+id+"_rowFooter\">\t\t\t\t<TD> \t\t\t\t\t<TABLE class=\""+_19+"der=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\t\t\t\t\t\t<TR>\t\t\t\t\t\t\t<TD class=\""+_19+"_w\"><DIV class=\""+_19+"_w\"> </TD> \t\t\t\t\t\t\t<TD class=\""+_19+"_footer\"><DIV id='"+id+"_footer1' class='"+_19+"_footer'>&nbsp</DIV></TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_e\"><DIV class=\""+_19+"_e\"> </TD>\t\t\t\t\t\t</TR>\t\t\t\t\t</TABLE>\t\t\t\t</TD>\t\t\t</TR>           <TR id=\""+id+"_row3\">\t\t\t\t<TD> \t\t\t\t\t<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\""+id+"_bottom\">\t\t\t\t\t\t<TR>\t\t\t\t\t\t\t<TD class=\""+_19+"_sw\" id=\""+id+"_sw\"  > </TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_s\" valign=\"middle\">&nbsp;</TD>\t\t\t\t\t\t\t<TD class=\""+_19+"_se\"> "+(_1a?"<DIV id=\""+id+"_sizer\" class=\""+_19+"_sizer\"></DIV>":"")+"</TD>\t\t\t\t\t\t</TR>\t\t\t\t\t</TABLE>\t\t\t\t</TD>\t\t\t</TR>\t\t</TABLE>\t\t";
Element.hide(win);
_1d.insertBefore(win,_1d.firstChild);
return win;
},setLocation:function(top,_20){
Element.setStyle(this.element,{top:top+"px"});
Element.setStyle(this.element,{left:_20+"px"});
},setSize:function(_21,_22){
if(_21<this.minWidth){
_21=this.minWidth;
}
if(_22<this.minHeight){
_22=this.minHeight;
}
if(this.maxHeight&&_22>this.maxHeight){
_22=this.maxHeight;
}
if(this.minHeight&&_22<this.minHeight){
_22=this.minHeight;
}
this.width=_21;
this.height=_22;
Element.setStyle(this.element,{width:_21+"px"});
Element.setStyle(this.element,{height:_22+"px"});
var _23=$(this.element.id+"_content");
Element.setStyle(_23,{height:_22+"px"});
Element.setStyle(_23,{width:_21+"px"});
},toFront:function(){
windows=document.getElementsByClassName("dialog");
var _24=0;
for(i=0;i<windows.length;i++){
if(_24<parseFloat(windows[i].style.zIndex)){
_24=windows[i].style.zIndex;
}
}
this.element.style.zIndex=parseFloat(_24)+1;
},show:function(){
this.setSize(this.width,this.height);
this.showEffect(this.element);
this._checkIEOverlapping();
},showCenter:function(){
Effect.Center(this.element);
Effect.Appear(this.element);
this._checkIEOverlapping();
},hide:function(){
Element.setStyle(this.getContent(),{overflow:"hidden"});
this.hideEffect(this.element);
if(this.iefix){
this.iefix.hide();
}
},setOpacity:function(_25){
if(Element.setOpacity){
Element.setOpacity(this.element,_25);
}
},_checkIEOverlapping:function(){
if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){
new Insertion.After(this.element.id,"<iframe id=\""+this.element.id+"_iefix\" "+"style=\"display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" "+"src=\"javascript:false;\" frameborder=\"0\" scrolling=\"no\"></iframe>");
this.iefix=$(this.element.id+"_iefix");
}
if(this.iefix){
setTimeout(this._fixIEOverlapping.bind(this),50);
}
},_fixIEOverlapping:function(){
Position.clone(this.element,this.iefix);
this.iefix.style.zIndex=this.element.style.zIndex-1;
this.iefix.show();
}};
var Windows={windows:[],getWindow:function(id){
return this.windows.detect(function(d){
return d.getId()==id;
});
},register:function(win){
this.windows.push(win);
},unregister:function(win){
this.windows=this.windows.reject(function(d){
return d==win;
});
},close:function(id){
win=this.getWindow(id);
if(win){
win.destroy();
}
}};
function getPageScroll(){
var _2c;
if(self.pageYOffset){
_2c=self.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
_2c=document.documentElement.scrollTop;
}else{
if(document.body){
_2c=document.body.scrollTop;
}
}
}
arrayPageScroll=new Array("",_2c);
return arrayPageScroll;
}
function getPageSize(){
var _2d,yScroll;
if(window.innerHeight&&window.scrollMaxY){
_2d=document.body.scrollWidth;
yScroll=window.innerHeight+window.scrollMaxY;
}else{
if(document.body.scrollHeight>document.body.offsetHeight){
_2d=document.body.scrollWidth;
yScroll=document.body.scrollHeight;
}else{
_2d=document.body.offsetWidth;
yScroll=document.body.offsetHeight;
}
}
var _2e,windowHeight;
if(self.innerHeight){
_2e=self.innerWidth;
windowHeight=self.innerHeight;
}else{
if(document.documentElement&&document.documentElement.clientHeight){
_2e=document.documentElement.clientWidth;
windowHeight=document.documentElement.clientHeight;
}else{
if(document.body){
_2e=document.body.clientWidth;
windowHeight=document.body.clientHeight;
}
}
}
if(yScroll<windowHeight){
pageHeight=windowHeight;
}else{
pageHeight=yScroll;
}
if(_2d<_2e){
pageWidth=_2e;
}else{
pageWidth=_2d;
}
arrayPageSize=new Array(pageWidth,pageHeight,_2e,windowHeight);
return arrayPageSize;
}


