function detectBrowser(){if(!window.XMLHttpRequest){document.write("Campus Pack does not support the browser that you are using. Please upgrade to a recent release of <a href=\'http://getfirefox.com/\'>FireFox</a> or <a href=\'http://www.microsoft.com/ie\'>Internet Explorer</a>. We apologize for the inconvenience.")
}}function checkZip(A){if(/^application\/zip/.test(A.mimeType)){return true
}else{ug.error(null,{title:"Invalid Zip File",message:"Not a valid zip file. ("+A.mimeType+")"});
return false
}}function cancelAction(C,A){var B=function(){var D=function(E){ug.dirty=false;
document.location.href=A||"/"
};
ug.rpc("History.setHistory",{urls:C},D)
};
if(ug.onCancel){ug.onCancel(B)
}else{B()
}return false
}hasPostMessage=window.postMessage&&!Ext.isOpera;
postMessageCounter=0;
ug={dirtyElements:{},scripts:{},zIndex:12000,openMenu:null,init:function(A){Ext.apply(ug,A,{initialized:true,dirty:false});
Ext.BLANK_IMAGE_URL=ug.staticUrl+"/images/blank.gif";
ug.host=document.location.href.replace(new RegExp("^([^/]*//[^/]*/).*$"),"$1");
ug.onReady(function(){window.onbeforeunload=ug.beforeUnload;
Ext.EventManager.onWindowResize(ug.layout);
ug.layout();
ug.initHyperlinks();
ug.initSearch();
if(ug.autofocus){Ext.fly(ug.autofocus).focus()
}})
},onReady:function(A){Ext.onReady(function(){try{A()
}catch(B){ug.jsreport(B)
}})
},autoFocus:function(A){ug.onReady(function(){var B=Ext.get(A);
if(B){B.focus()
}})
},logBack:function(){var A=function(B){if(B){ug.go(B)
}else{ug.reload()
}};
ug.rpc("Login.logBack",{},A)
},doLogin:function(){if(ug.onLogin()){document.forms.loginForm.submit()
}},onLogin:function(){var D=document.forms.loginForm,F=D.mechanism.value,C=null;
Ext.each(ug.loginMechanisms,function(G){if(F==G.id){C=G
}});
if(C&&(C.type=="sso")){var E=encodeURIComponent(document.location.href);
var A=C.url.replace("%%URL%%",encodeURIComponent(E));
document.location.href=A.replace("%URL%",E);
return false
}if(D.username.value==""){Ext.fly(D.username).focus();
return false
}else{if(D.password.value==""){Ext.fly(D.password).focus();
return false
}}if(!D.action.match(/^https/)){ug.password=D.password.value;
var B=rstr_sha1(str2rstr_utf8(ug.domainId+"/"+D.username.value+String.fromCharCode(0)+ug.password));
D.response.value=rstr2b64(rstr_hmac_sha1(B,str2rstr_utf8(D.challenge.value+"/"+D.timestamp.value)));
D.credential.value="";
D.password.value=""
}ug.loginWindow.setTitle("Logging In...");
ug.loginWindow.disable();
return true
},unLogin:function(){ug.loginWindow.hide()
},setDirty:function(A){if(!ug.dirty){ug.oldTitle=document.title;
document.title=ug.oldTitle+" *";
ug.update("pageTitle-modified","*")
}if(A!=undefined){ug.update("dirty-"+A,"*");
ug.dirtyElements["dirty-"+A]=true
}ug.dirty=true
},isDirty:function(A){return ug.dirtyElements["dirty-"+A]
},setClean:function(C){if(ug.dirty){var B=true;
if(C!=undefined){delete ug.dirtyElements["dirty-"+C];
for(element in ug.dirtyElements){if(ug.dirtyElements[element]==true){B=false;
break
}}var A=Ext.fly("dirty-"+C);
if(A){A.update("")
}}if(B){ug.dirty=false;
document.title=ug.oldTitle;
ug.update("pageTitle-modified","")
}}},log:function(){if(window.console){window.console.log.apply(window.console,arguments)
}},isBlank:function(A){return Ext.isEmpty(A,true)
},blankIfEmpty:function(A){return Ext.isEmpty(A)?"":A
},sortable:function(){var B="";
for(var A=0;
A<arguments.length;
++A){if(A>0){B=B+"\uffff"
}B=B+ug.blankIfEmpty(arguments[A])
}return B
},userSorter:function(A){return ug.sortable(A.familyName,A.givenName,A.middleName,A.id)
},userRenderer:function(A){return Ext.util.Format.htmlEncode(Ext.isEmpty(A.middleName,true)?(A.givenName+" "+A.familyName):(A.givenName+" "+A.middleName+" "+A.familyName))
},getViewport:function(){var D=document,A=D.documentElement,B=D.body,E=(A.scrollLeft||B.scrollLeft||0),C=(A.scrollTop||B.scrollTop||0);
return{left:E,top:C,width:Ext.lib.Dom.getViewWidth(),height:Ext.lib.Dom.getViewHeight()}
},beforeUnload:function(A){ug.leaving=true;
if(ug.dirty){return"Unsaved changes will not be applied."
}else{ug.loading(1)
}},popdown:function(){if(ug._glass&&!ug._glass.isDestroyed){ug._glass.destroy()
}delete ug._glass
},popup:function(D){if(ug._glass&&!ug._glass.isDestroyed){ug._glass.destroy()
}var E=new Ext.Component({autoRender:true,cls:"cp_frosted"});
ug._glass=E;
E.show();
var B=function(){if(ug._glass){var G=document,F=Math.max(Math.max(G.body.scrollHeight,G.documentElement.scrollHeight),Math.max(G.body.offsetHeight,G.documentElement.offsetHeight),Math.max(G.body.clientHeight,G.documentElement.clientHeight));
ug._glass.el.setSize({width:Ext.getBody().dom.scrollWidth,height:F})
}};
B();
Ext.EventManager.onWindowResize(B);
E.el.on("click",E.destroy,E);
var C=Ext.getDoc().addKeyListener(27,E.destroy,E);
E.on("destroy",C.disable,C);
if(D.ondestroy){E.on("destroy",D.ondestroy,D.scope||D)
}var A=function(G){if(E.isDestroyed){return 
}var F=new Ext.Component({autoRender:true,cls:"portlet cp_popup"});
F.show();
F.update(G,true);
var N=F.el.getSize(),J=ug.getViewport();
var L=Ext.isNumber(D.x)?D.x:Math.round(J.left+J.width/2);
var I=Ext.isNumber(D.y)?D.y:Math.round(J.top+J.height/2);
if(!D.anchor||(D.anchor=="c")){L-=Math.round(N.width/2);
I-=Math.round(N.height/2)
}else{if(D.anchor=="e"){I-=Math.round(N.height/2)
}else{if(D.anchor=="w"){L-=N.width;
I-=Math.round(N.height/2)
}else{if(D.anchor=="s"){L-=Math.round(N.width/2)
}}}}var M=Ext.getBody().getScroll(),K=Ext.lib.Dom.getViewWidth(),H=Ext.lib.Dom.getViewHeight();
L=Math.max(M.left+4,Math.min(M.left+K-N.width-4,L));
I=Math.min(M.top+H-N.height-4,Math.max(M.top+4,I));
F.el.moveTo(L,I);
E.on("destroy",F.destroy,F);
if(D.onpopup){D.onpopup.call(D.scope||window,F)
}};
if(D.url){ug.rpc({url:D.url,params:D.params,callback:A,errafter:E.destroy.createDelegate(E)})
}else{A(D.html)
}},popupActions:function(A,B){return ug.showActions(A,"/sys/popup/userActions",{user:B})
},permalinkActions:function(A,B){return ug.showActions(A,"/sys/popup/permalinkActions",{item:B})
},showActions:function(B,G,F){var D=Ext.get(B),E=D.getRegion();
var C,A,H=Math.round((E.top+E.bottom)/2);
if(E.left+E.right<Ext.getBody().getWidth()){C="e";
A=E.right
}else{C="w";
A=E.left
}D.addClass("cp_active");
ug.popup({url:G,params:F,anchor:C,x:A,y:H,ondestroy:D.removeClass.createDelegate(D,["cp_active"])});
return false
},login:function(A){if(!ug.loginWindow){ug.loginWindow=new ug.Dialog2({id:"loginDialog",title:"",listeners:{show:function(){ug.loginMechanism(Ext.getDom("mechanism"))
}}})
}ug.loginWindow.show(A);
ug.loginWindow.setTitle("Log In")
},help:function(A){var B=Ext.fly("helpMenu");
if(B.isDisplayed()){Ext.getBody().un("click",ug.help);
B.setDisplayed(false)
}else{B.setDisplayed(true);
Ext.getBody().on.defer(1,Ext.getBody(),["click",ug.help])
}},menu:function(A){if(!A.browserEvent){ug.openMenu=Ext.fly(A).next()
}if(ug.openMenu.isDisplayed()){Ext.getBody().un("click",ug.menu);
ug.openMenu.setDisplayed(false);
delete ug.openMenu
}else{ug.openMenu.setDisplayed(true);
Ext.getBody().on.defer(1,Ext.getBody(),["click",ug.menu])
}},print:function(){window.print()
},asCmp:function(B){var A=Ext.get(B);
return{getEl:function(){return A
},focus:function(){A.focus()
}}
},loginMechanism:function(A){var D=document.forms.loginForm,F=A&&A.value,C=null;
Ext.each(ug.loginMechanisms,function(G){if(F==G.id){C=G
}});
if(!ug.secure){var B=!C||C.chap;
D.action=B?ug.getHttpUrl("/control/dynamic/Login.login"):ug.getHttpsUrl("/control/dynamic/Login.login")
}if(C){D.mechanism.value=F;
ug.update("loginForm-componentForm","");
ug.update("loginForm-componentFields","");
ug.setClass("loginForm-static","undisplayed",(C.type!="local"));
ug.setClass("loginForm-componentForm","undisplayed",(C.type=="local"));
ug.setClass("loginForm-dialogButtons","undisplayed",(C.type=="remote"));
if(C.type=="local"){Ext.get("loginForm-username").focus()
}var E=function(G){ug.update((C.type=="local")?"loginForm-componentFields":"loginForm-componentForm",G,false,true)
};
ug.rpc("Login.getLoginForm",{mechanism:C.id},E)
}else{Ext.get("loginForm-username").focus()
}},loginFailed:function(A){if(A.failure=="NotCHAP"){var B=document.forms.loginForm;
B.credential.value=rstr2b64(str2rstr_utf8(ug.password));
ug.yield(function(){B.submit()
})
}else{if(ug.loginWindow){ug.loginWindow.setTitle("Log In");
ug.loginWindow.enable()
}ug.alert2(null,{title:"Login Failed",message:A.message,okay:function(){Ext.fly("loginForm-password").focus()
}})
}},logOut:function(){var A=function(B){if(B.close){try{window.close()
}catch(C){}}document.location.href=B.redirect
};
ug.rpc("Login.logout",{},A)
},getHttpUrl:function(B){var A=window.location.port;
if(window.location.protocol=="https:"){A=(A&&(A!=443))?Number(A)-101:""
}else{A=(A&&(A!=80))?A:""
}return"http://"+window.location.hostname+(A?":"+A:"")+(B||"/")
},getHttpsUrl:function(B){var A=window.location.port;
if(window.location.protocol=="https:"){A=(A&&(A!=443))?A:""
}else{A=(A&&(A!=80))?Number(A)+101:""
}return"https://"+window.location.hostname+(A?":"+A:"")+(B||"/")
},reload:function(){window.location.href=window.location.href.replace(/#.*/,"")
},reloadStrict:function(){window.location.reload()
},goBack:function(){window.location.href=window.location.href.replace(/#.*/,"").replace(/\?.*/,"").replace(/!.*/,"")
},redirect:function(A){ug.go((typeof (A)=="object")?A.url:A)
},go:function(A,B){if(A&&(A!="")){if(B){window.open(A,"_blank")
}else{window.location.href=A
}}},goParent:function(A){if(A&&(A!="")){window.open(A,"_top")
}},goWhenAvailable:function(A,B){var C=Ext.get(A);
if(!C.hasClass("unavailableLink")){ug.go(B)
}},ideaExchange:function(A){ug.go("/control/dynamic/IdeaExchange.go",true)
},toggleHighContrastView:function(A){ug.rpc("Login.toggleHighContrastView",{isHighContrastSession:A},ug.reload)
},escapeMeekView:function(){ug.goParent("/control/dynamic/IntegrationRpc.escapeMeekView?redirect="+encodeURIComponent(document.location.href))
},about:function(A){ug.popup({url:"/control/dynamic/Login.about",params:{},anchor:"s"})
},stopPropagation:Ext.lib.Event.stopPropagation,clearDesktopViewCookie:function(A){document.cookie="desktopView=;expires="+new Date().toGMTString()+"; path=/";
ug.reload()
},viewCookies:function(A){var D=document.cookie.split(";");
for(var C=0;
C<D.length;
C++){var B=D[C];
console.log(B)
}},reveal:function(D){var C=Ext.get(D);
C=C.parent(".fromReveal")||C;
var B=C.parent(".revealer");
var A=B.child(".toReveal");
A.setVisibilityMode(Ext.Element.DISPLAY);
if(C.hasClass("open")){C.replaceClass("open","closed");
A.hide()
}else{C.replaceClass("closed","open");
A.removeClass("unrevealed");
A.show(true)
}},showUploadForm:function(A,E,D){var C=ug[E+"-uploadWindow"];
if(!C){var B=function(){C.disableButtons();
document.forms[E+"-uploadForm"].onsubmit()
};
C=ug[E+"-uploadWindow"]=new ug.Dialog({id:E+"-uploadDialog",title:D,width:515,contentEl:E+"-uploadDiv",defaultButton:ug.asCmp(E+"-upload"),cancel:"Cancel",listeners:{beforeshow:function(){document.forms[E+"-uploadForm"].reset();
ug.update(E+"-uploadStatus","&nbsp;");
if(!this.timer){this.timer=new Ext.util.TaskRunner()
}this.timer.start({run:function(){if(document.forms[E+"-uploadForm"].upload.value!=""){this.timer.stopAll();
B()
}},interval:100,scope:this})
},beforehide:function(){this.timer.stopAll();
if(this.uploader){this.uploader.cancelUpload()
}window.frames.uploadFrame.location.replace(ug.staticUrl+"/blank.html")
}}})
}C.showEl=A;
C.show(A)
},upload:function(A,B,H,D,I,E,J,K){var G=ug[B+"-uploadWindow"];
var F={index:0,checkProgressTimeout:function(){delete F.progressTimeout;
ug.rpc({rpc:"Upload.uploadProgress",params:{id:F.uploadId,index:F.index++},timeout:30000,callback:F.uploadProgressCallback,failback:F.uploadProgressFailback})
},cancelUpload:function(){delete ug["uploader-"+F.uploadId];
delete ug["xuploader-"+B];
delete F.uploadId;
if(F.progressTimeout){clearTimeout(F.progressTimeout);
delete F.progressTimeout
}if(F.onCancel){F.onCancel()
}if(J){J.call(K||this)
}else{try{A.upload.value=""
}catch(L){}}},uploadProgressCallback:function(M){if(F.uploadId){if(M.progress||M.state){D.call(K||this,M.fileName+" ("+M.formattedProgress+")")
}var L=false;
try{L=window.frames.uploadFrame.document.title!=""
}catch(N){L=true
}if(L){if(G){G.hide()
}E.call(K||this,"An error occurred while uploading your file.  Please try again later.");
if(F.onError){F.onError()
}}if((M.state!="failed")&&(M.state!="complete")&&!L){F.progressTimeout=setTimeout(F.checkProgressTimeout,5000)
}}},uploadProgressFailback:function(){if(F.uploadId){F.progressTimeout=setTimeout(F.checkProgressTimeout,5000)
}return false
},uploadStarted:function(L){F.uploadId=L;
A.elements.id.value=L;
A.elements.formCookie.value=ug.formCookie;
ug["uploader-"+L]=F;
F.progressTimeout=setTimeout(F.checkProgressTimeout,1000);
A.submit();
D.call(K||this,"Starting upload...",true)
},uploadComplete:function(L){delete ug["uploader-"+L.id];
delete ug["xuploader-"+B];
delete F.uploadId;
if(F.progressTimeout){clearTimeout(F.progressTimeout);
delete F.progressTimeout
}var M=ug[B+"-uploadWindow"];
if(L.status=="error"){D.call(K||this,"Upload failed");
if(M){M.hide()
}if(F.onError){F.onError()
}}else{D.call(K||this,"Uploaded...");
if(M){M.hide()
}I.call(K||this,L,M&&M.showEl);
if(F.onComplete){F.onComplete()
}}}};
if(B!=""){ug["xuploader-"+B]=F
}if(G){G.uploader=F
}D.call(K||this,"Preparing upload...",true);
var C={fileName:A.elements.upload.value,guid:H};
ug.rpc("Upload.startUpload",C,F.uploadStarted);
return false
},uploadCallback:function(A){if(!ug.Uploader.uploadCallback(A)){var D=ug.staticUrl||"/static/static";
window.frames.uploadFrame.location.replace(D+"/blank.html");
var C=ug[A.id+"-uploadWindow"];
var B=ug["uploader-"+A.id];
if(B){B.uploadComplete(A)
}if(A.status=="error"){ug.error(null,{title:A.title,message:A.message})
}}},error:function(A,C){var B=C.guid?" (ID: "+C.guid+")":"";
ug.alert(A,{title:C.title||"Error",width:400,message:(C.message||"An error occurred.")+B,okay:"OK",onhide:C.onhide})
},error2:function(A,C){var B=C.guid?" (ID: "+C.guid+")":"";
ug.alert2(A,{title:C.title||"Error",width:400,message:(C.message||"An error occurred.")+B,listeners:C.listeners})
},rpcForm:function(B,C){tinyMCE.triggerSave();
C.params={};
var A=Ext.query("input,select,textarea",B);
Ext.each(A,function(D){if(D.name!=""&&D.id!="navBack"&&D.id!="navHistory"){if(D.type=="radio"&&!D.checked){return 
}if(D.type=="checkbox"){C.params[D.name]=D.checked?"on":"off"
}else{C.params[D.name]=D.value
}}});
ug.rpc(C)
},scrape:function(B){var A={};
Ext.each(Ext.getDom(B).elements,function(C){var H=null,F=C.type;
if(C.disabled){}else{if((F=="text")||(F=="password")||(F=="hidden")||(F=="textarea")||(((F=="checkbox")||(F=="radio"))&&C.checked)){H=C.value
}else{if(F=="select-one"){if(C.selectedIndex>=0){H=C.options[C.selectedIndex].value
}}else{if(F=="select-multiple"){H=[];
Ext.each(C.options,function(K){if(K.selected){H.push(K.value)
}})
}}}}if(H){var E=C.name,D=E.indexOf(":"),I=A;
while(D>=0){var J=E.substring(0,D),G=I[J];
E=E.substring(1+D);
D=E.indexOf(":");
if(!G){I[J]=G=E.match(/^\d/)?[]:{}
}I=G
}I[E]=H
}});
return A
},rpcupdate:function(D,C,E,A,B){if(typeof (C)=="string"){A=E;
E=C;
C={}
}ug.rpc(D,C,function(F){ug.update(E,F,false,true);
if(A){A.call(B||window)
}})
},blur:function(){if(document.activeElement){Ext.fly(document.activeElement).blur()
}},rpc:function(E,C,G,H){if(typeof (E)=="string"){var I=E.charAt(0)=="/";
E={rpc:I?null:E,url:I?E:null,params:C,callback:G,scope:H}
}if(ug.disableRpc[E.rpc||E.url]){return 
}var C={formCookie:ug.formCookie};
if(Ext.isString(E.params)){Ext.apply(C,ug.scrape(E.params))
}else{if(E.params){Ext.apply(C,E.params)
}}var D;
if(E.dialog){if(E.disableDialog!==false){E.dialog.disable()
}D=(E.hideDialog==false)?Ext.emptyFn:E.dialog.hide.createDelegate(E.dialog)
}else{D=ug.disable(E.disable,E.rpc||E.url)
}var F=function(){if(!E.dialog){D()
}ug.rpc(E)
};
var B=function(J){if(J&&(J.status=="confirm")){var L=function(){E.params["ug:confirmed"]=true;
F()
};
ug.confirm(null,{title:J.title,message:J.message,cancel:D,okay:L});
return true
}else{if(!J||(J.status!="error")){return false
}}if(J.logout){var K=Ext.getDom("pageLayout-userLink");
if(K){Ext.fly(K).addClass("loginExpired")
}}if(E.errback){E.errback.call(E.scope||this,J)
}D();
if(E.dialog&&(E.hideDialog==false)){E.dialog.enable()
}ug.error2(null,{title:J.title,message:J.message,guid:J.guid,listeners:E.errafter?{hide:E.errafter,scope:E.scope}:null});
return true
};
var A=new ug.Connection();
A.request({url:E.url||("/control/dynamic/"+E.rpc),method:E.method||"POST",params:C,timeout:E.timeout||300000,success:function(K){var L=K.getResponseHeader("Content-Type");
var J;
if(/application\/json/.test(L)){J=Ext.decode(K.responseText);
if(B(J)){return 
}}else{if(/^ ?text\/xml/.test(L)){J=K.responseXML
}else{if(/^ ?text\/html/.test(L)){J=K.responseText
}}}if(!E.noEnable&&(E.callback!=ug.reload)&&(E.callback!=ug.redirect)&&(E.callback!=ug.goBack)){D()
}E.callback.call(E.scope||this,J)
},failure:function(J){var L=!J.getResponseHeader?"unknown":J.getResponseHeader("Content-Type");
if(/application\/json/.test(L)&&B(Ext.decode(J.responseText))){return 
}if(E.failback&&(E.failback.call(E.scope)===false)){return 
}if(!ug.leaving){var K=new ug.Dialog2({title:"Network Error or Timeout",body:"Your request failed due to a server error, or a network error or timeout.",defaultButton:"okay",okay:(E.retry==false)?null:{label:"Retry",handler:F,autoHide:true},cancel:{label:"Cancel",handler:D,autoHide:true},listeners:E.errafter?{hide:E.errafter,scope:E.scope}:null});
K.show()
}}})
},disableRpc:{},disable:function(C,F){var B=[];
var D=function(J,K){B.push(function(){J.onclick=K
})
};
var H=function(J){B.push(function(){J.disabled=false
})
};
var A=function(J){B.push(function(){J.enable()
})
};
var I=function(J){if(J&&J.nodeName){if(J.nodeName=="A"){D(J,J.onclick);
J.onclick=function(){return false
}
}else{if(((J.nodeName=="INPUT")||(J.nodeName=="SELECT"))&&!J.disabled){H(J);
J.disabled=true
}}}else{if(J&&J.dom){A(J);
J.disable()
}}};
if(C){if(F){ug.disableRpc[F]=true
}if(typeof (C)=="string"){var G=C.split(",");
for(var E=0;
E<G.length;
++E){I(Ext.getDom(G[E]))
}}else{if(C.length){for(var E=0;
E<C.length;
++E){I(C[E])
}}else{I(C)
}}}return function(){if(F){delete ug.disableRpc[F]
}for(var J=0;
J<B.length;
++J){B[J]()
}}
},setBusy:function(C,F){var D=[];
var A=function(G,I){var H=Ext.get(G);
if(H){H.set({"aria-busy":I});
if(I){D.push(G)
}}};
if(C){if(typeof (C)=="string"){var E=C.split(",");
for(var B=0;
B<E.length;
B++){A(E[B],true)
}}else{if(C.length){for(var B=0;
B<C.length;
B++){A(C[B],true)
}}else{A(C,true)
}}}return function(){for(var G=0;
G<D.length;
G++){A(D[G],false)
}}
},ppr:function(E,F){if(typeof (E)=="string"){E={render:E,params:F}
}var D=new ug.Connection();
var B=document.location.href.replace(/[#?].*/,"");
var C=ug.disable(E.disable);
var A=ug.setBusy(E.render);
D.request({url:E.url||B,method:E.method||"POST",params:E.params||{},timeout:E.timeout||300000,headers:{"com.sun.faces.avatar.Partial":true,"com.sun.faces.avatar.Render":E.render},success:function(H){var M=H.responseXML;
var L=M.documentElement;
var O=L.firstChild;
for(var J=0;
J<O.childNodes.length;
++J){var G=O.childNodes[J];
var P=G.getAttribute("id");
var N=G.firstChild;
var K="";
for(var I=0;
I<N.childNodes.length;
++I){content=N.childNodes[I];
K+=content.text||content.data
}K=K.replace(/ *id=['"][^'"]*['"]/,"");
Ext.fly(P).update(K,true)
}C();
A();
if(E.callback){E.callback.call(E.scope)
}},failure:function(){var G=function(){C();
A();
ug.ppr(E)
};
if(!ug.leaving){ug.alert(null,{title:"Network Error or Timeout",message:"Your request failed due to a server error, or a network error or timeout.",okay:{text:"Cancel",handler:C,autoHide:true},okay2:{text:"Retry",handler:G,autoHide:true}})
}}})
},Connection:function(){ug.Connection.superclass.constructor.apply(this,arguments);
this.on({beforerequest:function(){ug.loading(1)
},requestcomplete:function(){ug.loading(-1)
},requestexception:function(){ug.loading(-1)
}})
},loadingCount:0,loading:function(C){try{var B=Ext.get("pageLayout-loading");
if(B){B.setVisible((ug.loadingCount+=C)>0)
}}catch(A){}},yield:function(A){setTimeout(A,1)
},wait:function(B,A){Ext.MessageBox.wait(A,B)
},doneWaiting:function(){Ext.MessageBox.hide()
},alert:function(B,A){var C=new ug.Dialog({title:A.title,width:A.width||280,defaultButton:"cancel",items:{xtype:"panel",cls:"dialog",bodyBorder:false,html:Ext.util.Format.htmlEncode(A.message)},cancel:ug.asButton(A.okay,{autoHide:true}),okay:A.okay2,destroyOnHide:true,onHideCallback:A.onhide});
C.show();
return C
},alert2:function(B,A){var C=new ug.Dialog2({title:A.title,body:A.message,width:A.width||280,okay:{autoHide:true,handler:A.okay},destroyOnHide:true,defaultButton:"okay",listeners:A.listeners});
C.show();
return C
},confirm:function(A,C){var B=new ug.Dialog({id:C.id,title:C.title||"Confirm",width:C.width||280,defaultButton:C.defaultButton||"okay",items:{xtype:"panel",cls:"dialog",bodyBorder:false,html:Ext.util.Format.htmlEncode(C.message||"Are you sure you want to do this?")},okay:Ext.isArray(C.okay)?C.okay:ug.asButton(C.okay,{text:"OK",autoHide:true}),cancel:ug.asButton(C.cancel,{text:"Cancel",autoHide:true}),destroyOnHide:true});
B.show(A)
},showMsg:function(C,B){var A=Ext.getDom(C);
if(B){A.innerHTML=B;
A.style.display=(A.nodeName=="SPAN")?"inline":"block"
}else{if(A){A.style.display="none"
}}},initForm:function(G,F,M){if(typeof F=="function"){M=F;
F={}
}else{F=F||{}
}var C=Ext.get(G);
if(M){C.on("submit",function(N){N.preventDefault();
M()
})
}var D=C.dom.name+":";
var A=[];
for(var J=0;
J<C.dom.length;
++J){A[J]=C.dom.elements[J]
}var H=function(O,P){O.setDisabled(!P.dom.checked);
var N=function(){O.setDisabled(!P.dom.checked);
if(O.isXType("datefield")){O.setValue(P.dom.checked?new Date():"")
}};
P.on("click",N)
};
for(var J=0;
J<A.length;
++J){var I=A[J];
var B=F[I.name.substring(D.length)];
var K=(B&&(typeof (B)=="string"))?B:(B&&B.type)||I.type;
var L=null;
switch(K){case"date":L=new Ext.form.DateField({format:"n/j/Y g:i A",applyTo:I});
break;
case"text":L=new Ext.form.TextField({applyTo:I});
break;
case"password":L=new Ext.form.TextField({applyTo:I});
break;
case"checkbox":break;
case"radio":break;
case"button":case"submit":break
}var E=B&&Ext.get(D+B.depends);
if(L&&E){H(L,E)
}}},initDateField:function(F,E,D){var C=new Ext.form.DateField({format:"n/j/Y g:i A",applyTo:F,listeners:{select:function(){ug.log("selected")
}}});
if(E){var A=Ext.get(E);
C.setDisabled(!A.dom.checked);
function B(){C.setDisabled(!A.dom.checked);
C.setValue(A.dom.checked?new Date():"");
if(D){ug.setDirty()
}}A.on("click",B)
}if(D){C.on("change",ug.setDirty)
}return C
},initBasicEditor:function(A){Ext.onReady(function(){tinyMCE.init({strict_loading_mode:true,mode:"textareas",theme:"advanced",force_br_newlines:true,force_p_newlines:false,theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_buttons0:"",theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,undo,redo,separator,cleanup,separator,bullist,numlist,separator,code",theme_advanced_buttons2:"",setupcontent_callback:function(B,C,D){document.getElementById(B).tabIndex="1"
}})
})
},getScrollBarWidth:function(){if(!Ext.isReady){return 0
}var D=Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),C=D.child("div",true);
var B=C.offsetWidth;
D.setStyle("overflow",(Ext.isWebKit||Ext.isGecko)?"auto":"scroll");
var A=C.offsetWidth;
D.remove();
scrollWidth=B-A+2;
return scrollWidth
},addAncestralOuterWidths:function(A){if(A){A=Ext.fly(A);
var B=A.getFrameWidth("lr")+A.getMargins("lr");
return B+ug.addAncestralOuterWidths(A.parent())
}return 0
},maximalHeight:function(D){var C=Ext.lib.Dom.getViewportHeight()-Ext.fly("pageLayout-header").getHeight()-Ext.fly("pageLayout-footer").getHeight();
var B=Ext.fly("pageLayout-body-inner-most").getHeight();
D=(typeof (D)=="string")?Ext.fly(D):D;
var A=D.dom?D.getHeight():D.getSize().height;
return C-B+A-20
},dispatcher:new Ext.util.Observable(),layoutStretchReduction:0,layout:function(){if(!ug.initialized){return 
}if(ug.layoutMaximize||ug.layoutStretch){var D=ug.layoutMaximize;
if(D){D=(typeof (D)=="string")?Ext.get(D):D;
var C=D.minHeight?D.minHeight:0;
D.setHeight(Math.max(C,ug.maximalHeight(D)))
}var A=ug.layoutStretch;
if(A){var E=document.body.clientWidth-Ext.fly("pageLayout-body-inner-most").getFrameWidth("lr");
var B=A.dom?A.getWidth():A.getSize().width;
if(E!=B){A.setWidth(E-ug.layoutStretchReduction)
}}}ug.dispatcher.fireEvent("layout")
},RadioDialog:function(B){var C=new Array();
for(var D=0;
D<B.options.length;
D++){var E=B.options[D];
C.push(new Ext.form.Radio({inputValue:E.optionValue,boxLabel:E.optionLabel,hideLabel:true,name:B.id}))
}var A=new Ext.form.FormPanel({items:C});
return new ug.Dialog({id:B.id,title:B.title,width:280,items:A,defaultButton:A.items.get(0),okay:{text:B.okay.text,handler:function(){B.okay.handler(A.items.get(0).getGroupValue())
}},cancel:B.cancel.text,destroyOnHide:B.destroyOnHide})
},Dialog:function(D){var E=D.items,G=[],I=this,F=D.defaultButton;
var A=function(M,L){var J=ug.asButton(M,L);
if(J.autoHide){var K=J.handler;
J.handler=function(){I.hide();
if(K){K.apply(this,arguments)
}}
}return J
};
var B=D.okay;
if(B){if(!Ext.isArray(B)){B=[B]
}for(var C=0;
C<B.length;
++C){G.push(A(B[C],{text:"OK"}))
}}if(D.cancel!==false){G.push(A(D.cancel,{text:"Cancel",autoHide:true}))
}var H=D.modal!=false;
if(F=="cancel"){F=G.length-1
}else{if((F=="okay")||(F=="okay0")){F=0
}else{if(F=="okay1"){F=1
}}}ug.Dialog.superclass.constructor.call(this,Ext.apply(D,{closeAction:"hide",modal:H,plain:true,resizable:D.resizable,stateful:false,autoShow:true,items:E,defaultButton:F,buttons:G,buttonAlign:"left",listeners:{beforeshow:function(){I.resetButtons();
I.enable()
},hide:function(){if(this.destroyOnHide){this.destroy()
}if(this.onHideCallback){this.onHideCallback()
}}}}));
this.disableButtons=function(){for(var J=0;
J<this.buttons.length-1;
++J){this.buttons[J].disable()
}};
this.resetButtons=function(){for(var J=0;
J<this.buttons.length;
++J){this.buttons[J].enable()
}}
},asButton:function(D,C){var A,B=typeof (D);
if(B=="object"){A=D
}else{if(B=="function"){A={handler:D}
}else{if(B=="string"){A={text:D}
}else{A={}
}}}return Ext.applyIf(A,C)
},doubleConfirm:function(A,B){var C=function(){ug.confirm(A,B.subsequent)
};
ug.confirm(A,Ext.apply(B.initial,{okay:ug.asButton(B.initial.okay,{handler:C})}))
},tinymceTabIndexSetter:function(A){return function(B,C,D){document.getElementById(B+"_ifr").tabIndex=A
}
},tinymceUriCleanupInit:function(A){A.onPreProcess.add(function(B,E){if(E.get){var D=B.dom;
var C=function(F){return function(I){var G=D.getAttrib(I,F);
if(G&&(G.length>0)&&(G.charAt(0)!="/")){var H=A.documentBaseURI.toAbsolute(G,true);
if(H!=G){D.setAttrib(I,F,H)
}}}
};
tinymce.each(D.select("IMG",E.node),C("src"));
tinymce.each(D.select("A",E.node),C("href"))
}})
},timeElapsed:function(D){var C=parseInt(D/60+0.5);
var A=parseInt(C/60);
var B=C%60;
return String.format("{0}h:{1}m",A,B)
},SelectionAction:function(A){var D=A.sm||A.scope.getSelectionModel();
ug.SelectionAction.superclass.constructor.call(this,Ext.apply({},A,{disabled:!D.hasSelection(),sm:D}));
D.on("selectionchange",function(){this.setDisabled(!D.hasSelection());
if(A.onSelectionChange){A.onSelectionChange(this)
}},this);
var C=A.handler,B=A.scope;
this.setHandler(function(F,G){var E=D.singleSelect?D.getSelected():D.getSelections();
if(E){C.apply(B||window,[E,G])
}});
if(A.dblclick){A.dblclick.on("rowdblclick",function(E,H,G){if(G.browserEvent.ctrlKey){D.selectRow(H,true)
}var F=D.singleSelect?D.getSelected():D.getSelections();
if(F){C.apply(B||window,[F,G])
}})
}},animStyle:function(B,A,C){if(ug.animTask){Ext.TaskMgr.stop(ug.animTask);
delete ug.animTask
}if(B&&parseInt(B.getStyle(A))!=C){ug.animTask={run:function(){var D=parseInt(B.getStyle(A))||0;
var E=parseInt((((D<C)?(C-D):(D-C))+1)/2);
D=(D<C)?(D+E):(D-E);
if(E!=0){B.setStyle(A,D+"px")
}if(D==C){Ext.TaskMgr.stop(ug.animTask);
delete ug.animTask
}},interval:20};
Ext.TaskMgr.start(ug.animTask)
}},escape:function(A){return Ext.util.Format.htmlEncode(A)
},updater:function(C,B,A){return function(D){ug.update(C,D,false,true)
}
},update:function(E,D,C,A){var B=Ext.fly(E);
if(B){ug.updatez(B,C?ug.escape(D):D,A);
ug.initHyperlinks(B.dom)
}},updatez:function(el,html,loadScripts,callback){if(!el.dom){return el
}html=html||"";
if(loadScripts!==true){el.dom.innerHTML=html;
if(typeof callback=="function"){callback()
}return el
}var id=Ext.id(),dom=el.dom;
html+='<span id="'+id+'"></span>';
Ext.lib.Event.onAvailable(id,function(){var DOC=document,hd=DOC.getElementsByTagName("head")[0],re=/(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,srcRe=/\ssrc=([\'\"])(.*?)\1/i,typeRe=/\stype=([\'\"])(.*?)\1/i,match,attrs,srcMatch,typeMatch,el,s;
while((match=re.exec(html))){attrs=match[1];
srcMatch=attrs?attrs.match(srcRe):false;
if(srcMatch&&srcMatch[2]){var src=srcMatch[2];
if(!ug.scripts[src]){ug.scripts[src]=true;
s=DOC.createElement("script");
s.src=src;
typeMatch=attrs.match(typeRe);
if(typeMatch&&typeMatch[2]){s.type=typeMatch[2]
}hd.appendChild(s)
}}else{if(match[2]&&match[2].length>0){try{if(window.execScript){window.execScript(match[2])
}else{window.eval(match[2])
}}catch(ex){var trace=ug.getStackTrace(ex)().join("\n");
ug.log(ex,trace)
}}}}el=DOC.getElementById(id);
if(el){Ext.removeNode(el)
}if(typeof callback=="function"){callback()
}});
dom.innerHTML=html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,"");
return el
},innerText:function(D,B){var C=Ext.fly(D,"_internal").dom;
var A=C.textContent||C.innerText||"";
return B?A:Ext.util.Format.trim(A)
},getValue:function(D,B){var A=Ext.fly(D,"_internal");
var C=A&&A.dom.value;
return(!C||B)?C:Ext.util.Format.trim(C)
},setValue:function(C,B){var A=Ext.fly(C,"_internal");
if(A){A.dom.value=B
}},setClass:function(D,A,C){var B=Ext.fly(D,"_internal");
if(B){if(C){B.addClass(A)
}else{B.removeClass(A)
}}},scrollTo:function(A){if(Ext.isWebKit){document.body.scrollTop=A
}else{document.documentElement.scrollTop=A
}},scrollIntoView:function(F){var C=Ext.fly(F).getBox();
C.bottom=C.y+C.height;
var E=document.documentElement;
var A=parseInt(Ext.isWebKit?document.body.scrollTop:document.documentElement.scrollTop,10);
var B=document.documentElement.clientHeight;
var D=A+B;
if((C.y<=A)&&(C.bottom>=D)){}else{if((C.y<A)||(C.height>B)){ug.scrollTo(C.y)
}else{if(C.bottom>D){ug.scrollTo(C.bottom-B)
}}}},concatArrays:function(B){var A=[];
return A.concat.apply(A,B)
},insertArray:function(D,B,C){var A=[B,0].concat(C);
return D.splice.apply(D,A)
},flyChild:function(A,B){var C=Ext.fly(A);
return Ext.fly(C.child(B,true))
},radioClass:function(B,A){Ext.fly(B).radioClass(A)
},toDomainUrl:function(A){return(A&&(A.indexOf(ug.host)==0))?A.substring(ug.host.length-1):A
},initSearch:function(A){Ext.each(Ext.fly(A||document.body).query(".cp_emptySearch"),function(B){ug.initEmptyInput(B,B.value)
})
},initEmptyInput:function(F,E){var C=Ext.get(F);
var B=function(){if(C.hasClass("cp_emptyInput")){C.dom.value="";
C.removeClass("cp_emptyInput")
}};
var D=function(){if((C.dom.value=="")||(C.dom.value==E)){C.addClass("cp_emptyInput");
C.dom.value=E
}};
var A=function(){if(C.hasClass("cp_emptyInput")&&(C.dom.value!="")&&(C.dom.value!=E)){C.removeClass("cp_emptyInput")
}};
C.on({focus:B,blur:D,change:A});
D()
},initEmptyInputLabel:function(G,F){var D=Ext.get(G),B=Ext.get(F);
var C=function(){ug.setClass(B,"undisplayed",true)
};
var E=function(){ug.setClass(B,"undisplayed",D.dom.value!="")
};
var A=E;
D.on({focus:C,blur:E,change:A});
B.on({click:function(){D.focus()
}});
E()
},initHyperlinks:function(A){Ext.each(Ext.fly(A||document.body).query(".permacontent a"),function(B){var C=ug.toDomainUrl(B.href);
if(C&&(C.charAt(0)=="/")&&(C.replace(/#.*/,"")!=document.location.pathname)){Ext.EventManager.on(B,"click",ug.onPermalink)
}})
},onPermalink:function(){var B=Ext.fly(this).parent(".permacontext");
if(B){var C=B.child(".permalink a",true);
if(C&&C.href){var A=new Date(new Date().getTime()+1000*16*15);
document.cookie="UGREF="+escape(C.href)+"; expires="+A.toGMTString()
}}},jsreport:function(C,B){var E="";
try{E=this.getStackTrace(C)().join("\n");
ug.log(C,E)
}catch(A){}var D=new ug.Connection();
D.request({url:"/control/javascriptException",method:"POST",params:{exception:""+C,trace:E,userAgent:navigator.userAgent,url:document.location.href},timeout:10000,success:function(F){if(B){ug.error(null,{message:"A script error prevented this operation from being performed.",guid:F.responseText})
}}})
},themeData:{first:true},testTrace:function(){this.onReady(function(){(0)()
})
},getStackTrace:function(A){var B=A.stack?"Firefox":window.opera?"Opera":"Other";
switch(B){case"Firefox":return function(){return A.stack.replace(/^.*?\n/,"").replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")
};
case"Opera":return function(){var E=A.message.split("\n"),D="{anonymous}",H=/Line\s+(\d+).*?in\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,G,F,C;
for(G=4,F=0,C=E.length;
G<C;
G+=2){if(H.test(E[G])){E[F++]=(RegExp.$3?RegExp.$3+"()@"+RegExp.$2+RegExp.$1:D+RegExp.$2+":"+RegExp.$1)+" -- "+E[G+1].replace(/^\s+/,"")
}}E.splice(F,E.length-F);
return E
};
default:return function(){var K=arguments.callee.caller,D="function",C="{anonymous}",J=/function\s*([\w\-$]+)?\s*\(/i,I=[],E=0,H,G,F;
while(K){H=J.test(K.toString())?RegExp.$1||C:C;
G=I.slice.call(K.arguments);
F=G.length;
while(F--){switch(typeof G[F]){case"string":G[F]='"'+G[F].replace(/"/g,'\\"')+'"';
break;
case"function":G[F]=D;
break
}}I[E++]=H+"("+G.join()+")";
K=K.caller
}return I
}
}},isFramed:function(){return parent!==window
},el:{measureEffectiveHeight:function(B){B=Ext.get(B);
if(null==B){return 0
}var A=0;
A+=B.getComputedHeight(true);
if(Ext.isIE6||Ext.isIE7){A+=B.getMargins("tb")
}else{A+=B.getMargins("tb")*2
}A+=B.getFrameWidth("tb");
return A
},measureAncestralOuterHeights:function(A){A=Ext.get(A);
if(null==A){return 0
}var B=A.getFrameWidth("tb")+A.getMargins("tb");
return B+ug.el.measureAncestralOuterHeights(A.parent())
},measureViewport:function(){var A;
var B;
if(window.innerWidth){A=window.innerWidth;
B=window.innerHeight
}else{if(document.documentElement&&document.documentElement.clientWidth){A=document.documentElement.clientWidth;
B=document.documentElement.clientHeight
}else{A=document.getElementsByTagName("body")[0].clientWidth;
B=document.getElementsByTagName("body")[0].clientHeight
}}return{width:A,height:B}
}},xss:{postMessage:function(B,E,C){if(!E){return 
}B=Ext.isString(B)?B:Ext.encode(B);
C=C||parent;
if(hasPostMessage){var D=E.replace(/([^:]+:\/\/[^\/]+).*/,"$1");
C.postMessage(B,D)
}else{var A=E.replace(/#.*$/,"")+"#"+(+new Date)+(postMessageCounter++)+"&"+B;
C.location=A
}},receiveMessage:function(C,B,A){if(hasPostMessage){if(C){ug.rm_callback&&ug.receiveMessage();
ug.rm_callback=function(D){if((typeof B==="string"&&D.origin!==B)||(Ext.isFunction(B)&&B(D.origin)===FALSE)){return FALSE
}C(D)
}
}if(window.addEventListener){window[C?"addEventListener":"removeEventListener"]("message",ug.rm_callback,false)
}else{window[C?"attachEvent":"detachEvent"]("onmessage",ug.rm_callback)
}}else{ug.interval_id&&clearInterval(ug.interval_id);
ug.interval_id=null;
if(C){A=typeof B==="number"?B:typeof A==="number"?A:100;
ug.interval_id=setInterval(function(){var E=document.location.hash,D=/^#?\d+&/;
if(E!==ug.last_hash&&D.test(E)){ug.last_hash=E;
C({data:E.replace(D,"")})
}},A)
}}}},integration:{calculateContentHeight:function(){var A=0;
A+=ug.el.measureEffectiveHeight("innerPage");
A+=ug.el.measureEffectiveHeight("pageLayout-footer");
return A
},managedContentSizing:false,initializeContentSizing:function(C,B){if(ug.isFramed()&&!Ext.isIE7){ug.integration.managedContentSizing=true;
var A=function(){if(ug.layoutMaximize){return 
}ug.xss.postMessage({height:ug.integration.calculateContentHeight()},C,B)
};
Ext.onReady(function(){Ext.fly(window).on({resize:A});
ug.dispatcher.on({layout:A});
A()
})
}}},showStatus:function(E,A,B,D){var C=Ext.fly(E);
C.update(A?B:D);
C.replaceClass(A?"cp_incorrectResponse":"cp_correctResponse",A?"cp_correctResponse":"cp_incorrectResponse")
}};
Ext.extend(ug.Connection,Ext.data.Connection);
Ext.extend(ug.Dialog,Ext.Window,{beforeShow:function(){if(this.animateTarget){var C=this.animateTarget.getRegion(),B=this.getSize();
if(C){var A=C.left+C.right<Ext.getBody().getWidth();
this.x=A?C.right:C.left-B.width;
this.y=Math.max(0,(C.top+C.bottom-B.height)/2)
}}ug.Dialog.superclass.beforeShow.call(this)
}});
Ext.reg("ugdialog",ug.Dialog);
Ext.extend(ug.SelectionAction,Ext.Action);
ug.Uploader=Ext.extend(Ext.util.Observable,{constructor:function(A){Ext.apply(this,A||{},{state:0,disabled:false,downloadable:true,removable:true,checkProgressInterval:3000,deferFormTimer:false});
ug.Uploader.registerUploader(this);
this.addEvents({progress:true,upload:true,reset:true});
ug.Uploader.superclass.constructor.call(this);
this.checkProgressTimer=new Ext.util.DelayedTask(this.onProgressTimer,this);
this.on({progress:this.onProgress,upload:this.onUpload,reset:this.onReset,scope:this});
this.mapButtons({uploadCancel:this.reset,uploadReset:this.reset,uploadRemove:this.remove})
},mapButtons:function(A){Ext.iterate(A,function(B,D){var C=Ext.fly(this.upload+"-"+B);
if(C){C.on("click",D,this)
}},this)
},initialize:function(){this.checkProgressTimer.cancel();
this.destroyFrame();
if(this.uploaded&&!this.minimal){this.transition(-1,3);
this.fireEvent("upload",this.uploaded)
}else{this.transition(-1,0);
this.createFrame();
Ext.fly(this.upload+"-uploader").radioClass("displayed");
if(!this.minimal){Ext.fly(this.upload+"-uploadDiv").child("input:last",true).value="";
this.fireEvent("reset")
}}},reset:function(){delete this.uploaded;
this.initialize()
},remove:function(){this.uploaded="remove";
this.initialize()
},disable:function(){this.setEnabled(false)
},enable:function(){this.setEnabled(true)
},setEnabled:function(A){if(this.disabled!=!A){this.disabled=!A;
if(this.state!=0){this.reset()
}else{this.getUploadField().disabled=!A;
var B=this.getRemoveButton();
if(B){B.disable=!A
}}}},isUploading:function(){return(this.state==1)||(this.state==2)
},isUploaded:function(){return(this.state==3)
},onProgress:function(A){A=A.replace(/([\S]+s)-1/,'<nobr>$1<sup style="font-size: 75%;">-1</sup></nobr>');
ug.update(this.upload+"-uploadStatus",A,false);
Ext.fly(this.upload+"-uploading").radioClass("displayed")
},onUpload:function(A){this.response=A;
Ext.fly(this.upload+"-uploadDiv").child("input:last",true).value=A.id||A;
if(this.minimal){this.initialize()
}else{var B=(A=="remove")?ug.escape(this.noneLabel):A.fileName+" (<em>"+A.mimeType+"</em>) "+A.fileSizeStr+" (<a href='/control/dynamic/Upload.download?id="+A.id+"'>Download</a>)";
ug.update(this.upload+"-uploadInfo",B);
Ext.fly(this.upload+"-uploaded").radioClass("displayed")
}if(this.enables){Ext.getDom(this.enables).disabled=false
}ug.Uploader.uploadCompleted()
},onReset:function(){if(this.enables){Ext.getDom(this.enables).disabled=true
}ug.Uploader.uploadCompleted()
},createFrame:function(){if(this.frame){return 
}this.frame=document.createElement("iframe");
this.frame.id=this.frame.name=this.upload+"-iframe";
this.frame.className="uploadIframe";
this.frame.scrolling="no";
this.frame.src=this.image?"/static/static/uploadImage.html":"/static/static/upload.html";
Ext.getDom(this.upload+"-uploader").appendChild(this.frame);
Ext.EventManager.on(this.frame,"load",this.onFrameLoad,this)
},destroyFrame:function(){if(!this.frame){return 
}Ext.fly(this.upload+"-label").radioClass("undisplayed");
var C=this.frame;
var B=this.getFrameDocument();
delete this.frame;
try{C.style.display="none"
}catch(A){}try{if(C.stop){C.stop()
}}catch(A){}try{if(B.location){B.location.href=ug.staticUrl+"/blank.html"
}}catch(A){}setTimeout(function(){Ext.removeNode(C)
},100)
},onFrameLoad:function(){Ext.EventManager.un(this.frame,"load",this.onFrameLoad,this);
Ext.fly(this.upload+"-initializing").radioClass("undisplayed");
this.getUploadField().disabled=this.disabled;
var A=this.getFrameDocument();
this.frame.style.height=A.body.scrollHeight+"px";
this.frame.style.width=A.body.scrollWidth+"px";
this.frame.style.visibility="visible";
Ext.fly(this.getUploadField()).on({change:{fn:function(){this.startUpload()
},scope:this}})
},startUpload:function(){if(this.getUploadField().value==""){return 
}if(!this.transition(0,1)){return 
}this.fireEvent("progress","Preparing upload...");
var A=this.getUploadField().value;
ug.rpc({rpc:"Upload.startUpload",params:{fileName:A,guid:this.upload},callback:this.onUploadPrepared,scope:this})
},onUploadPrepared:function(B){if(!this.transition(1,2)){return 
}this.fireEvent("progress","Starting upload...");
var A=this.getUploadForm();
A.elements.id.value=B;
A.elements.formCookie.value=ug.formCookie;
this.progressIndex=0;
A.submit();
this.checkProgressTimer.delay(250)
},onProgressTimer:function(){if(this.state!=2){return 
}var A=false;
try{A=this.getFrameDocument().title!=""
}catch(B){A=true
}if(A){ug.error(null,{message:"An error occurred while uploading your file.  Please try again later."});
this.reset()
}else{ug.rpc({rpc:"Upload.uploadProgress",params:{id:this.upload,index:this.progressIndex++},timeout:30000,callback:this.onProgressSucceeded,failback:this.onProgressFailed,scope:this})
}},onProgressSucceeded:function(A){if(this.state!=2){return 
}if(A.progress||A.state){this.fireEvent("progress",A.fileName+" ("+A.formattedProgress+")")
}if((A.state!="failed")&&(A.state!="complete")){this.checkProgressTimer.delay(this.checkProgressInterval)
}},onProgressFailed:function(){if(this.state!=2){return false
}this.checkProgressTimer.delay(this.checkProgressInterval);
return false
},onUploadCompleted:function(A){if(!this.transition(2,3)){return 
}this.checkProgressTimer.cancel();
this.destroyFrame();
if(A.status=="error"){ug.error(null,{title:A.title,message:A.message});
this.reset()
}else{this.fireEvent("upload",A)
}},getFrameDocument:function(){return this.frame.contentDocument?this.frame.contentDocument:this.frame.contentWindow.document
},getUploadForm:function(){return this.getFrameDocument().forms.uploadForm
},getUploadField:function(){return this.getUploadForm().elements.upload
},getRemoveButton:function(){return Ext.getDom(this.upload+"-uploadRemove")
},transition:function(B,A){if((B!=-1)&&(this.state!=B)){return false
}this.state=A;
return true
}});
Ext.apply(ug.Uploader,{uploaders:{},registerUploader:function(A){this.uploaders["_"+A.upload]=A
},getUploader:function(A){return this.uploaders["_"+A]
},getResponse:function(A){return this.uploaders["_"+A].response
},uploadCallback:function(A){var B=this.getUploader(A.id);
if(B){B.onUploadCompleted(A)
}return B!=null
},getInProgressCount:function(){var A=0;
Ext.iterate(this.uploaders,function(B,C){if(C.isUploading()){++A
}});
return A
},uploadCompleted:function(){var C=this.uponCompletion;
if(C){var B=Ext.getDom(C.button);
var A=this.getInProgressCount();
if(A==0){if(B){B.value=C.oldValue;
B.disabled=false
}delete this.uponCompletion;
if(C.callback){C.callback.call(C.scope||C)
}else{B.click()
}}}},uponUpload:function(D,A){if(typeof (D)=="string"){D={button:D,onsubmit:A}
}var C=this.getInProgressCount();
if(C>0){var B=Ext.getDom(D.button);
if(B){D.oldValue=B.value;
B.disabled=true;
B.value="Uploading..."
}this.uponCompletion=D;
return false
}return D.onsubmit?D.onsubmit.call(D.scope||D):true
}});
ug.Dialog2=Ext.extend(Ext.util.Observable,{constructor:function(A){Ext.apply(this,A);
this.zIndex=ug.zIndex;
ug.zIndex+=2;
this.addEvents({okay:true,cancel:true,show:true,hide:true});
ug.Dialog2.superclass.constructor.call(this)
},setTitle:function(A){if(this.el){ug.update(this.el.child(".portletHeaderTitle"),A)
}else{this.title=A
}},render:function(){if(this.mask){return 
}this.id=this.id||Ext.id();
var B=Ext.isString(this.okay)?{label:this.okay}:Ext.isFunction(this.okay)?{handler:this.okay}:this.okay;
var D=Ext.isString(this.cancel)?{label:this.cancel}:Ext.isFunction(this.cancel)?{handler:this.cancel}:this.cancel;
if(this.body){var C=[];
C.push({tag:"input",type:"submit",cls:"cp_button cp_primaryButton cp_dialog_okay",value:B.label||"OK"});
if(D){C.push({tag:"input",type:"button",cls:"cp_button cp_dialog_cancel",value:D.label||"Cancel"})
}var A={tag:"form",id:this.id,cls:"cp_dialog portlet x-hidden "+(this.cls||""),onsubmit:"return false;",children:[{cls:"portletHeader",children:[{tag:"span",cls:"portletHeaderTitle",html:Ext.util.Format.htmlEncode(this.title)}]},{cls:"cp_dialog_body",children:this.body},{cls:"cp_dialog_buttons",children:C}]};
Ext.DomHelper.append(document.body,{id:this.id+"-mask",cls:"ext-el-mask undisplayed"});
Ext.DomHelper.append(document.body,Ext.apply({id:this.id},A))
}this.el=Ext.get(this.id);
this.el.setStyle("z-index",this.zIndex+1);
this.mask=Ext.get(this.id+"-mask");
this.mask.setStyle("z-index",this.zIndex);
this.okay=this.el.child(".cp_dialog_okay");
this.cancel=this.el.child(".cp_dialog_cancel");
if(B){if(B.handler){this.on("okay",B.handler,B.scope)
}if(B.autoHide){this.on("okay",this.hide)
}this.el.on("submit",function(){this.fireEvent("okay")
},this,{preventDefault:true})
}if(D){if(D.handler){this.on("cancel",D.handler,D.scope)
}if(D.autoHide){this.on("cancel",this.hide)
}this.cancel.on("click",function(){this.fireEvent("cancel")
},this)
}if(this.width){this.el.setWidth(this.width)
}if(this.height){this.el.setHeight(this.height)
}},position:function(B){if(B){var D=Ext.fly(B).getRegion();
if(D){var C=D.left+D.right<Ext.getBody().getWidth();
this.x=C?D.right:D.left-this.el.getWidth();
this.y=Math.max(0,(D.top+D.bottom-this.el.getHeight())/2)
}}else{var A=this.el.getCenterXY();
this.x=A[0];
this.y=150
}this.el.moveTo(this.x,this.y)
},show:function(A){this.render();
this.position(A);
this.enable();
this.el.removeClass("x-hidden");
this.mask.show();
this.mask.on("click",Ext.emptyFn,Ext,{stopEvent:true});
this.mask.on("mousedown",Ext.emptyFn,Ext,{stopEvent:true});
this.mask.on("mouseup",Ext.emptyFn,Ext,{stopEvent:true});
this.km=Ext.getDoc().addKeyListener(27,this.hide,this);
if(this.defaultButton){this[this.defaultButton].focus()
}else{ug.blur()
}this.fireEvent("show")
},disable:function(){ug.blur();
this.el.setStyle("z-index",this.zIndex);
this.mask.setStyle("z-index",this.zIndex+1)
},enable:function(){this.el.setStyle("z-index",this.zIndex+1);
this.mask.setStyle("z-index",this.zIndex)
},hide:function(){this.fireEvent("hide");
if(this.destroyOnHide){this.destroy()
}else{this.el.addClass("x-hidden");
this.mask.hide();
this.km.disable()
}},destroy:function(){this.el.remove();
this.mask.remove();
this.km.disable();
if(ug.zIndex==this.zIndex+2){ug.zIndex=this.zIndex
}},disableButtons:function(){this.okay.dom.disabled=true;
this.cancel.dom.disabled=true
},resetButtons:function(){this.okay.dom.disabled=false;
this.cancel.dom.disabled=false
}});
ug.DataSection=Ext.extend(Ext.util.Observable,{constructor:function(A){Ext.apply(this,A);
this.addEvents({expand:true,save:true,cancel:true,close:true});
if(this.el){this.el.on("click",function(B){this.expand(B)
},this);
this.cancelButton=this.el.child(".cp_dataSectionCancel");
this.cancelButton.on("click",function(B){B.stopEvent();
this.cancel()
},this);
this.form=this.el.child("form");
this.form.on("submit",function(B){this.save()
},this);
this.valueSummary=this.el.child(".cp_dataSectionValueSummary")
}ug.DataSection.superclass.constructor.call(this)
},expand:function(){this.el.radioClass("open");
this.fireEvent("expand")
},save:function(){this.close();
this.fireEvent("save",this.form.dom,this.valueSummary)
},cancel:function(){this.close();
this.fireEvent("cancel")
},close:function(){this.el.removeClass("open");
this.fireEvent("close")
}});

