/*ADOBE SYSTEMS INCORPORATED
Copyright 2007 Adobe Systems Incorporated
All Rights Reserved.

NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
terms of the Adobe license agreement accompanying it.  If you have received this file from a
source other than Adobe, then your use, modification, or distribution of it requires the prior
written permission of Adobe.*/
if(!ColdFusion.Window){
ColdFusion.Window={};
}
ColdFusion.Window.windowIdCounter=1;
ColdFusion.Window.create=function(_1,_2,_3,_4){
if(_1==null){
ColdFusion.handleError(null,"window.create.nullname","widget",null,null,null,true);
return;
}
if(_1==""){
ColdFusion.handleError(null,"window.create.emptyname","widget",null,null,null,true);
return;
}
var _5=ColdFusion.objectCache[_1];
var _6=false;
if(typeof (_5)!="undefined"&&_5!=null){
if(_5.callfromtag){
ColdFusion.handleError(null,"window.create.duplicatename","widget",[_1]);
}
if(typeof (_5.isConfObj)!="undefined"&&_5.isConfObj==true){
_6=true;
if(_4!=null&&typeof (_4.initshow)!="undefined"){
if(_4.initshow==false){
return;
}
}
}else{
if(!_4||(_4&&_4.initshow!==false)){
ColdFusion.Window.show(_1);
}
return;
}
}
if(!_5){
ColdFusion.Log.info("window.create.creating","widget",[_1]);
}
var _7=ColdFusion.Window.createHTML(_1,_2,_3,_4,_6);
var _8=ColdFusion.objectCache[_1];
if(_8!=null&&typeof (_8.isConfObj)!="undefined"&&_8.isConfObj==true){
return;
}
return ColdFusion.Window.createJSObj(_1,_3,_7);
};
ColdFusion.Window.createHTML=function(_9,_a,_b,_c,_d){
var _e=null;
var _f=null;
if(_c&&_c.divid){
_e=document.getElementById(_c.divid);
}
if(_e==null){
_e=document.createElement("div");
_f="cf_window"+ColdFusion.Window.windowIdCounter;
ColdFusion.Window.windowIdCounter++;
_e.id=_f;
_e.className="x-hidden";
}
document.body.appendChild(_e);
var _10=false;
if(_c!=null&&typeof (_c.headerstyle)!="undefined"&&_c.headerstyle!=null){
var _11=new String(_c.headerstyle);
_11=_11.toLowerCase();
if(_11.indexOf("background-color")>=0){
_10=true;
}
}
var _12=document.getElementById(_9+"_title");
if(_10==true){
var _13=document.getElementById(_9+"_b");
if(!_13){
_13=document.createElement("b");
_13.className="corner";
_13.id=_9+"_b";
for(var i=1;i<4;i++){
var _15=document.createElement("div");
_15.className="filler"+i;
_15.style.cssText=_c.headerstyle;
_13.appendChild(_15);
}
if(_12!=null){
_e.insertBefore(_13,_12);
}else{
_e.appendChild(_13);
}
}
}
if(_12==null){
_12=document.createElement("div");
_12.id=_9+"_title";
var _16="x-window-header";
_12.className=_16;
if(_a){
_12.innerHTML=_a;
}else{
_12.innerHTML="&nbsp;";
}
_e.appendChild(_12);
}
var _17=document.getElementById(_9+"_body");
if(_17==null){
_17=document.createElement("div");
_17.id=_9+"_body";
_17.className="x-window-body";
_e.appendChild(_17);
}
var _18;
_18=ColdFusion.Window.getUpdatedConfigObj(_c,_9);
if(typeof (_18)=="undefined"){
_e.innerHTML="";
return;
}
if(_f){
_18.divid=_f;
}
_18.title=_a;
if(typeof (_18.initshow)!="undefined"&&_18.initshow===false){
_18.url=_b;
ColdFusion.objectCache[_9]=_18;
ColdFusion.objectCache[_9+"_body"]=_18;
}
return _18;
};
ColdFusion.Window.createJSObj=function(_19,url,_1b){
var _1c;
var _1d=false;
if(typeof (_1b.childlayoutid)&&_1b.childlayoutid!=null){
_1d=true;
_1b.layout="border";
_1b.items=ColdFusion.objectCache[_1b.childlayoutid];
}else{
_1b.layout="fit";
}
if(typeof (_1b.autoScroll)=="undefined"){
_1b.autoScroll=true;
}
_1b.el=_1b.divid;
_1c=new Ext.Window(_1b);
_1c.cfwindowname=_19;
_1c.tempx=_1b.tempx;
_1c.tempy=_1b.tempy;
_1c.divid=_1b.divid;
if(typeof (_1b.headerstyle)!="undefined"&&_1b.headerstyle!=null){
var _1e=document.getElementById(_19+"_title");
if(_1e!=null){
_1e.style.cssText="background:none;"+_1b.headerstyle;
}
}
if(typeof (_1b.bodystyle)!="undefined"&&_1b.bodystyle!=null){
var _1f=document.getElementById(_19+"_body");
var _20=_1f.parentNode;
if(_20!=null){
_20.style.cssText=_1b.bodystyle;
}
}
_1c.isConfObj=false;
_1c._cf_body=_19+"_body";
ColdFusion.objectCache[_19]=_1c;
if(_1d){
var _21=_1c.getLayout();
var _22=ColdFusion.objectCache[_1b.childlayoutid];
}
_1c.addListener("beforeclose",ColdFusion.Window.beforeCloseHandler);
var _23=null;
if(typeof (url)!="undefined"&&url!=""){
_23=url;
}
if(_23==null){
if(typeof (_1b.initshow)=="undefined"||_1b.initshow==true){
_1c.addListener("beforeshow",ColdFusion.Window.beforeShowHandler);
ColdFusion.Window.showandhide(_1c,_1b);
}
return;
}
ColdFusion.objectCache[_19+"_body"]=_1c;
if(typeof (_1b.callfromtag)=="undefined"){
var _24;
var _25;
_1c._cf_visible=false;
_1c._cf_dirtyview=true;
_1c.addListener("show",ColdFusion.Window.showHandler);
_1c.addListener("hide",ColdFusion.Window.hideHandler);
_1c.url=_23;
if(_1b){
if(typeof (_1b.initshow)=="undefined"||_1b.initshow==true){
ColdFusion.Window.showandhide(_1c,_1b);
}
_24=_1b.callbackHandler;
_25=_1b.errorHandler;
}
}else{
_1c.callfromtag=true;
_1c._cf_visible=false;
_1c._cf_dirtyview=true;
_1c.addListener("show",ColdFusion.Window.showHandler);
_1c.addListener("beforeshow",ColdFusion.Window.beforeShowHandler);
_1c.addListener("hide",ColdFusion.Window.hideHandler);
if(typeof (_1b.initshow)=="undefined"||_1b.initshow==true){
ColdFusion.Window.showandhide(_1c,_1b);
}
}
};
ColdFusion.Window.showandhide=function(_26,_27){
if(typeof (_27.tempinitshow)!="undefined"&&_27.tempinitshow==false){
var _28=Ext.Element.get(_26.el);
if(typeof _28!="undefined"){
_28.show();
}
_28.hide();
}else{
_26.show();
}
};
ColdFusion.Window.destroy=function(_29,_2a){
if(_29){
var _2b=ColdFusion.Window.getWindowObject(_29);
if(_2b){
if(_2a===true){
_2b.destroy(true);
}else{
_2b.destroy();
}
ColdFusion.objectCache[_29]=null;
}
}
};
ColdFusion.Window.resizeHandler=function(_2c,_2d,_2e){
if(typeof (_2c.fixedcenter)!="undefined"&&_2c.fixedcenter==true){
_2c.center();
}
};
ColdFusion.Window.beforeShowHandler=function(_2f){
if(typeof (_2f.fixedcenter)!="undefined"&&_2f.fixedcenter==true){
_2f.center();
}
};
ColdFusion.Window.beforeCloseHandler=function(_30){
if(_30.destroyOnClose!="undefined"&&_30.destroyOnClose==true){
ColdFusion.objectCache[_30.cfwindowname]=null;
return true;
}else{
_30.hide();
return false;
}
};
ColdFusion.Window.showHandler=function(_31){
_31._cf_visible=true;
if(_31._cf_dirtyview){
if(typeof (_31.callfromtag)=="undefined"){
ColdFusion.Ajax.replaceHTML(_31._cf_body,_31.url,"GET",null,_31.callbackHandler,_31.errorHandler);
}else{
var _32=ColdFusion.bindHandlerCache[_31._cf_body];
if(_32){
_32();
}
}
_31._cf_dirtyview=false;
}
};
ColdFusion.Window.hideHandler=function(_33){
_33._cf_visible=false;
if(_33._cf_refreshOnShow){
_33._cf_dirtyview=true;
}
};
ColdFusion.Window.xPosition=50;
ColdFusion.Window.yPosition=50;
ColdFusion.Window.resetHTML=function(_34){
var _35=document.getElementById(_34);
if(_35){
_35.innerHTML="";
}
};
ColdFusion.Window.getUpdatedConfigObj=function(_36,_37){
var _38={};
if(_36!=null){
if(typeof (_36)!="object"){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidconfig","widget",[_37],null,null,true);
return;
}
for(var key in _36){
if(key=="center"&&ColdFusion.Util.isBoolean(_36["center"])){
_38["fixedcenter"]=_36["center"];
}else{
_38[key]=_36[key];
}
}
}
if(typeof (_38.initshow)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.initshow)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidinitshow","widget",[_37],null,null,true);
return;
}else{
_38.initshow=ColdFusion.Util.castBoolean(_38.initshow);
_38._cf_visible=_38.initshow;
}
}
_38.tempcenter=null;
if(typeof (_38.fixedcenter)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.fixedcenter)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidcenter","widget",[_37],null,null,true);
return;
}else{
_38.fixedcenter=ColdFusion.Util.castBoolean(_38.fixedcenter);
}
}
if(typeof (_38.resizable)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.resizable)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidresizable","widget",[_37],null,null,true);
return;
}else{
_38.resizable=ColdFusion.Util.castBoolean(_38.resizable);
}
}
if(typeof (_38.draggable)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.draggable)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invaliddraggable","widget",[_37],null,null,true);
return;
}else{
_38.draggable=ColdFusion.Util.castBoolean(_38.draggable);
}
}
if(typeof (_38.closable)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.closable)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidclosable","widget",[_37],null,null,true);
return;
}else{
_38.closable=ColdFusion.Util.castBoolean(_38.closable);
}
}
if(typeof (_38.modal)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.modal)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidmodal","widget",[_37],null,null,true);
return;
}else{
_38.modal=ColdFusion.Util.castBoolean(_38.modal);
}
}
if(typeof (_38.refreshonshow)!="undefined"){
if(ColdFusion.Util.isBoolean(_38.refreshonshow)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidrefreshonshow","widget",[_37],null,null,true);
return;
}else{
_38._cf_refreshOnShow=ColdFusion.Util.castBoolean(_38.refreshonshow);
}
}
_38.shadow=true;
if(!_38.height){
_38.height=300;
}else{
if(ColdFusion.Util.isInteger(_38.height)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidheight","widget",[_37],null,null,true);
return;
}
}
if(!_38.width){
_38.width=500;
}else{
if(ColdFusion.Util.isInteger(_38.width)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidwidth","widget",[_37],null,null,true);
return;
}
}
var _3a=false;
if(_38.minwidth){
if(ColdFusion.Util.isInteger(_38.minwidth)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidminwidth","widget",[_37],null,null,true);
return;
}
var _3b=_38.minwidth;
var _3c=_38.width;
if(typeof (_3b)!="number"){
_3b=parseInt(_3b);
}
if(typeof (_3c)!="number"){
_3c=parseInt(_3c);
}
if(_3b>_3c){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidminwidth","widget",[_37],null,null,true);
return;
}
_38.minWidth=_38.minwidth;
_3a=true;
}
if(_38.minheight){
if(ColdFusion.Util.isInteger(_38.minheight)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidminheight","widget",[_37],null,null,true);
return;
}
var _3d=_38.minheight;
var _3e=_38.height;
if(typeof (_3d)!="number"){
_3d=parseInt(_3d);
}
if(typeof (_3e)!="number"){
_3e=parseInt(_3e);
}
if(_3d>_3e){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidheightvalue","widget",[_37],null,null,true);
return;
}
_38.minHeight=_38.minheight;
_3a=true;
}
if(_38.x){
if(ColdFusion.Util.isInteger(_38.x)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidx","widget",[_37],null,null,true);
return;
}
}
if(_38.y){
if(ColdFusion.Util.isInteger(_38.y)==false){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.invalidy","widget",[_37],null,null,true);
return;
}
}
if(typeof (_38.x)=="undefined"&&(typeof (_38.center)=="undefined"||_38.center==false)){
_38.x=ColdFusion.Window.xPosition;
ColdFusion.Window.xPosition+=15;
}
if(typeof (_38.y)=="undefined"&&(typeof (_38.center)=="undefined"||_38.center==false)){
_38.y=ColdFusion.Window.yPosition;
ColdFusion.Window.yPosition+=15;
}
if(typeof (_38.initshow)!="undefined"&&_38.initshow===false){
_38.tempinitshow=false;
if(typeof (_38.fixedcenter)!="undefined"&&_38.fixedcenter===true){
_38.tempcenter=_38.fixedcenter;
_38.fixedcenter=null;
}else{
_38.tempx=_38.x;
_38.tempy=_38.y;
}
_38.x=-10000;
_38.y=-10000;
}
_38.constraintoviewport=true;
_38.initshow=true;
if(_38.resizable!=null&&_38.resizable==false&&_3a==true){
ColdFusion.Window.resetHTML(_37);
ColdFusion.handleError(null,"window.getupdatedconfigobject.minhwnotallowed","widget",[_37],null,null,true);
return;
}
_38.collapsible=false;
_38.shadow=true;
_38.isConfObj=true;
return _38;
};
ColdFusion.Window.show=function(_3f){
var _40=ColdFusion.objectCache[_3f];
if(typeof (_40)!="undefined"&&_40!=null){
if(typeof (_40.isConfObj)!="undefined"&&_40.isConfObj==true){
_40.initshow=true;
var _41=ColdFusion.Window.createHTML(_3f,null,_40.url,_40,true);
ColdFusion.Window.createJSObj(_3f,_40.url,_41);
}else{
if(_40.isVisible()==false){
_40.show();
ColdFusion.Log.info("window.show.shown","widget",[_3f]);
}
if(_40.tempcenter!=null){
_40.center();
_40.tempcenter=null;
}else{
if(_40.getEl()&&_40.getEl().getX()>0&&_40.getEl().getY()>0){
_40.tempx=null;
_40.tempy=null;
}else{
if(_40.tempx!=null&&_40.tempy!=null){
_40.setPosition(_40.tempx,_40.tempy);
_40.tempx=null;
_40.tempy=null;
}else{
var x=_40.getEl().getX();
var y=_40.getEl().getY();
_40.setPosition(x+1,y+1);
_40.setPosition(x,y);
}
}
}
}
}else{
ColdFusion.handleError(null,"window.show.notfound","widget",[_3f],null,null,true);
}
};
ColdFusion.Window.hide=function(_44){
var _45=ColdFusion.objectCache[_44];
if(_45){
if(_45.isVisible&&_45.isVisible()==true){
_45.hide();
ColdFusion.Log.info("window.hide.hidden","widget",[_44]);
}
}else{
ColdFusion.handleError(null,"window.hide.notfound","widget",[_44],null,null,true);
}
};
ColdFusion.Window.onShow=function(_46,_47){
var _48=ColdFusion.objectCache[_46];
if(typeof (_48)!="undefined"&&_48!=null){
_48.onShow=_47;
if(_48.addListener){
_48.addListener("show",ColdFusion.Window.onShowWrapper);
}
}else{
ColdFusion.handleError(null,"window.onshow.notfound","widget",[_46],null,null,true);
}
};
ColdFusion.Window.onShowWrapper=function(_49){
_49.onShow.call(null,_49.cfwindowname);
};
ColdFusion.Window.onHide=function(_4a,_4b){
var _4c=ColdFusion.objectCache[_4a];
if(typeof (_4c)!="undefined"&&_4c!=null){
_4c.onHide=_4b;
if(_4c.addListener){
_4c.addListener("hide",ColdFusion.Window.onHideWrapper);
}
}else{
ColdFusion.handleError(null,"window.onhide.notfound","widget",[_4a],null,null,true);
}
};
ColdFusion.Window.onHideWrapper=function(_4d){
_4d.onHide.call(null,_4d.cfwindowname);
};
ColdFusion.Window.getWindowObject=function(_4e){
if(!_4e){
ColdFusion.handleError(null,"window.getwindowobject.emptyname","widget",null,null,null,true);
return;
}
var _4f=ColdFusion.objectCache[_4e];
if(_4f==null||(typeof (_4f.isConfObj)=="undefined"&&Ext.Window.prototype.isPrototypeOf(_4f)==false)){
ColdFusion.handleError(null,"window.getwindowobject.notfound","widget",[_4e],null,null,true);
return;
}
if(typeof (_4f.isConfObj)!="undefined"&&_4f.isConfObj==true){
_4f.initshow=true;
var _50=ColdFusion.Window.createHTML(_4e,null,_4f.url,_4f,true);
ColdFusion.Window.createJSObj(_4e,_4f.url,_50);
ColdFusion.Window.hide(_4e);
_4f=ColdFusion.objectCache[_4e];
}
return _4f;
};
