/*	
	Copyright (c) 2007-2009, Amplafi for amplafi.js

	Copyright (c) 2004-2006, The Dojo Foundation
	All Rights Reserved. http://dojotoolkit.org/community/licensing.shtml
*/

dojo.provide("layer.amplafi");
dojo.provide("dojo.lang.timing.Timer");
dojo.require("dojo.lang.func");
dojo.lang.timing.Timer=function(_1){
this.timer=null;
this.isRunning=false;
this.interval=_1;
this.onStart=null;
this.onStop=null;
};
dojo.extend(dojo.lang.timing.Timer,{onTick:function(){
},setInterval:function(_2){
if(this.isRunning){
dj_global.clearInterval(this.timer);
}
this.interval=_2;
if(this.isRunning){
this.timer=dj_global.setInterval(dojo.lang.hitch(this,"onTick"),this.interval);
}
},start:function(){
if(typeof this.onStart=="function"){
this.onStart();
}
this.isRunning=true;
this.timer=dj_global.setInterval(dojo.lang.hitch(this,"onTick"),this.interval);
},stop:function(){
if(typeof this.onStop=="function"){
this.onStop();
}
this.isRunning=false;
dj_global.clearInterval(this.timer);
}});
dojo.provide("tapestry.core");
dojo.provide("tapestry.html");
dojo.provide("tapestry.event");
dojo.provide("tapestry.lang");
dojo.require("dojo.lang.common");
dojo.require("dojo.io.BrowserIO");
dojo.require("dojo.event.browser");
dojo.require("dojo.html.style");
dojo.require("dojo.lang.func");
dojo.require("dojo.string.extras");
if(dj_undef("logging",dojo)){
dojo.log={debug:function(){
dojo.debug.apply(this,arguments);
},info:function(){
dojo.debug.apply(this,arguments);
},warn:function(){
dojo.debug.apply(this,arguments);
},err:function(){
dojo.debug.apply(this,arguments);
},exception:function(){
dojo.debug.apply(this,arguments);
}};
}
var tapestry={version:"4.1.4",scriptInFlight:false,ScriptFragment:new RegExp("(?:<script.*?>)((\n|.|\r)*?)(?:</script>)","im"),GlobalScriptFragment:new RegExp("(?:<script.*?>)((\n|.|\r)*?)(?:</script>)","img"),requestsInFlight:0,isIE:dojo.render.html.ie,isMozilla:dojo.render.html.mozilla,requestEncoding:"UTF-8",bind:function(_3,_4,_5){
var _6={url:_3,content:_4,useCache:true,preventCache:true,encoding:tapestry.requestEncoding,error:(function(){
tapestry.error.apply(this,arguments);
})};
if(typeof _5!="undefined"&&_5){
_6.mimetype="text/json";
_6.headers={"json":true};
_6.load=(function(){
tapestry.loadJson.apply(this,arguments);
});
}else{
_6.headers={"dojo-ajax-request":true};
_6.mimetype="text/xml";
_6.load=(function(){
tapestry.load.apply(this,arguments);
});
}
tapestry.requestsInFlight++;
dojo.io.queueBind(_6);
},error:function(_7,_8,_9,_a){
tapestry.requestsInFlight--;
dojo.log.exception("Error received in IO response.",_8);
},load:function(_b,_c,_d,_e){
dojo.log.debug("tapestry.load() Response received.",_c);
tapestry.requestsInFlight--;
if(!_c){
dojo.log.warn("No data received in response.");
return;
}
var _f=_c.getElementsByTagName("ajax-response");
if(!_f||_f.length<1||!_f[0].childNodes){
dojo.log.warn("No ajax-response elements received.");
return;
}
var _10=_f[0].childNodes;
var _11=[];
var _12=[];
var _13=[];
for(var i=0;i<_10.length;i++){
var _15=_10[i].getAttribute("type");
var id=_10[i].getAttribute("id");
if(_15=="exception"){
dojo.log.err("Remote server exception received.");
tapestry.presentException(_10[i],_e);
return;
}else{
if(_15=="page"){
window.location=_10[i].getAttribute("url");
return;
}else{
if(_15=="status"){
dojo.event.topic.publish(id,{message:tapestry.html.getContentAsString(_10[i])});
continue;
}
}
}
if(_15=="script"){
if(id=="initializationscript"){
_12.push(_10[i]);
continue;
}else{
if(id=="bodyscript"){
_11.push(_10[i]);
continue;
}else{
if(id=="includescript"){
var _17=_10[i].getElementsByTagName("include");
if(!_17){
continue;
}
for(var e=0;e<_17.length;e++){
tapestry.loadScriptFromUrl(_17[e].getAttribute("url"));
}
continue;
}
}
}
}else{
_13.push(_10[i]);
}
if(!id){
dojo.log.warn("No element id found in ajax-response node.");
continue;
}
var _19=dojo.byId(id);
if(!_19){
dojo.log.warn("No node could be found to update content in with id "+id);
continue;
}
tapestry.loadContent(id,_19,_10[i]);
}
for(var i=0;i<_11.length;i++){
tapestry.loadScriptContent(_11[i],true);
}
for(var i=0;i<_13.length;i++){
tapestry.loadScriptContent(_13[i],true);
}
for(var i=0;i<_12.length;i++){
tapestry.loadScriptContent(_12[i],true);
}
},loadJson:function(_1a,_1b,_1c,_1d){
dojo.log.debug("tapestry.loadJson() Response received.",_1b);
tapestry.requestsInFlight--;
},loadContent:function(id,_1f,_20){
if(typeof _20.childNodes!="undefined"&&_20.childNodes.length>0){
for(var i=0;i<_20.childNodes.length;i++){
if(_20.childNodes[i].nodeType!=1){
continue;
}
var _22=_20.childNodes[i].getAttribute("id");
if(_22){
_20=_20.childNodes[i];
break;
}
}
}
var _23=tapestry.html.getContentAsString(_20);
if(djConfig["isDebug"]){
dojo.log.debug("Received element content for id <"+id+"> of: "+_23);
}
if(!tapestry.isIE||(tapestry.isIE&&_1f.childNodes&&_1f.childNodes.length>0)){
dojo.event.browser.clean(_1f);
}
if(tapestry.isIE&&!dj_undef("outerHTML",_1f)&&_1f.nodeName=="SELECT"){
_1f.outerHTML=_1f.outerHTML.replace(/(<SELECT[^<]*>).*(<\/SELECT>)/,"$1"+_23+"$2");
_1f=dojo.byId(id);
}else{
if(_23&&_23.length>0&&(!tapestry.isIE||_23.length>1)){
_1f.innerHTML=_23;
}
}
var _24=_20.attributes;
var _25,i=0;
while((_25=_24[i++])){
if(tapestry.isIE){
if(!_25){
continue;
}
if((typeof _25=="object")&&(typeof _25.nodeValue=="undefined")||(_25.nodeValue==null)||(_25.nodeValue=="")){
continue;
}
}
var nn=_25.nodeName;
var nv=_25.nodeValue;
if(nn=="id"||nn=="type"||nn=="name"){
continue;
}
if(nn=="style"){
dojo.html.setStyleText(_1f,nv);
}else{
if(nn=="class"){
dojo.html.setClass(_1f,nv);
}else{
if(nn=="value"){
_1f.value=nv;
}else{
_1f.setAttribute(nn,nv);
}
}
}
}
var _28=_20.getAttribute("disabled");
if(!_28&&_1f["disabled"]){
_1f.disabled=false;
}else{
if(_28){
_1f.disabled=true;
}
}
},loadScriptContent:function(_29,_2a){
if(typeof _2a=="undefined"){
_2a=true;
}
_2a=this.isIE;
if(tapestry.scriptInFlight){
dojo.log.debug("loadScriptContent(): scriptInFlight is true, sleeping");
setTimeout(function(){
tapestry.loadScriptContent(_29,_2a);
},5);
return;
}
var _2b=tapestry.html.getContentAsString(_29);
_2b.replace(this.GlobalScriptFragment,"");
var _2c=_2b.match(this.GlobalScriptFragment);
if(!_2c){
return;
}
if(_2a){
setTimeout(function(){
tapestry.evaluateScripts(_2c);
},60);
}else{
tapestry.evaluateScripts(_2c);
}
},evaluateScripts:function(_2d){
tapestry.scriptInFlight=true;
for(var i=0;i<_2d.length;i++){
var scr=_2d[i].match(this.ScriptFragment)[1];
if(!scr||scr.length<=0){
continue;
}
try{
dojo.log.debug("evaluating script:",scr);
eval(scr);
}
catch(e){
tapestry.scriptInFlight=false;
dojo.log.exception("Error evaluating script: "+scr,e,false);
}
}
tapestry.scriptInFlight=false;
},loadScriptFromUrl:function(url){
var _31=window.document.getElementsByTagName("script");
if(_31){
for(var i=0;i<_31.length;i++){
var src=_31[i].src;
if(src&&src.length>0&&src.indexOf(url)>=0){
return;
}
}
}
if(djConfig.isDebug){
dojo.log.debug("loadScriptFromUrl: "+url+" success?: "+dojo.hostenv.loadUri(url));
}else{
dojo.hostenv.loadUri(url);
}
},presentException:function(_34,_35){
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Dialog");
var _36=document.createElement("div");
_36.setAttribute("id","exceptiondialog");
document.body.appendChild(_36);
var _37=document.createElement("div");
_37.innerHTML=tapestry.html.getContentAsString(_34);
dojo.html.setClass(_37,"exceptionDialog");
var _38=document.createElement("div");
_38.setAttribute("id","exceptionDialogHandle");
dojo.html.setClass(_38,"exceptionCloseLink");
_38.appendChild(document.createTextNode("Close"));
_36.appendChild(_38);
_36.appendChild(_37);
var _39=dojo.widget.createWidget("Dialog",{widgetId:"exception"},_36);
dojo.event.connect(_38,"onclick",_39,"hide");
dojo.event.connect(_39,"hide",_39,"destroy");
setTimeout(function(){
_39.show();
},100);
},cleanConnect:function(_3a,_3b,_3c){
_3a=dojo.byId(_3a);
if(!dj_undef(_3c,tapestry)){
dojo.event.disconnect(_3a,_3b,tapestry,_3c);
}
},cleanConnectWidget:function(_3d,_3e,_3f){
tapestry.cleanConnect(dojo.widget.byId(_3d),_3e,_3f);
},connect:function(_40,_41,_42){
_40=dojo.byId(_40);
if(!dj_undef(_42,tapestry)){
dojo.event.connect(_40,_41,tapestry,_42);
}
},connectBefore:function(_43,_44,_45){
_43=dojo.byId(_43);
if(!dj_undef(_45,tapestry)){
dojo.event.connect("before",_43,_44,tapestry,_45);
}
},connectWidget:function(_46,_47,_48){
tapestry.connect(dojo.widget.byId(_46),_47,_48);
},stopEvent:function(_49){
dojo.event.browser.stopEvent(_49);
},byId:dojo.byId,raise:dojo.raise,addOnLoad:dojo.addOnLoad,provide:dojo.provide,linkOnClick:function(url,id,_4c,_4d){
var _4e={beventname:(_4d||"onClick")};
_4e["beventtarget.id"]=id;
tapestry.bind(url,_4e,_4c);
return false;
},isServingRequests:function(){
return (this.requestsInFlight>0);
}};
tapestry.html={CompactElementRegexp:/<([a-zA-Z](?!nput)[a-zA-Z]*)([^>]*?)\/>/g,CompactElementReplacer:"<$1$2></$1>",getContentAsString:function(_4f){
if(typeof _4f.xml!="undefined"){
return this._getContentAsStringIE(_4f);
}else{
if(typeof XMLSerializer!="undefined"){
return this._getContentAsStringMozilla(_4f);
}else{
return this._getContentAsStringGeneric(_4f);
}
}
},getElementAsString:function(_50){
if(!_50){
return "";
}
var s="<"+_50.nodeName;
if(_50.attributes&&_50.attributes.length>0){
for(var i=0;i<_50.attributes.length;i++){
s+=" "+_50.attributes[i].name+"=\""+_50.attributes[i].value+"\"";
}
}
s+=">";
s+=this._getContentAsStringGeneric(_50);
s+="</"+_50.nodeName+">";
return s;
},enhanceExceptionPage:function(){
var _53=dojo.html.getElementsByClass("toggle");
if(_53&&_53.length>0){
for(var i=0;i<_53.length;i++){
dojo.event.connect(_53[i],"onclick",function(e){
var _56=e.target;
dojo.html.toggleShowing(dojo.byId(_56.id+"Data"));
if(dojo.html.hasClass(_56,"toggleSelected")){
dojo.html.removeClass(_56,"toggleSelected");
}else{
dojo.html.addClass(_56,"toggleSelected");
}
if(e.preventDefault){
dojo.event.browser.stopEvent(e);
}
return false;
});
dojo.html.toggleShowing(_53[i].id+"Data");
}
}
_53=dojo.html.getElementsByClass("exception-link");
if(_53&&_53.length>0){
_53[_53.length-1].onclick({target:_53[_53.length-1]});
}
},_getContentAsStringIE:function(_57){
var s=" ";
for(var i=0;i<_57.childNodes.length;i++){
s+=_57.childNodes[i].xml;
}
return s;
},_getContentAsStringMozilla:function(_5a){
if(!this.xmlSerializer){
this.xmlSerializer=new XMLSerializer();
}
var s="";
for(var i=0;i<_5a.childNodes.length;i++){
s+=this.xmlSerializer.serializeToString(_5a.childNodes[i]);
if(s=="undefined"){
return this._getContentAsStringGeneric(_5a);
}
}
return this._processCompactElements(s);
},_getContentAsStringGeneric:function(_5d){
var s="";
if(_5d==null){
return s;
}
for(var i=0;i<_5d.childNodes.length;i++){
switch(_5d.childNodes[i].nodeType){
case 1:
case 5:
s+=this.getElementAsString(_5d.childNodes[i]);
break;
case 3:
case 2:
case 4:
s+=_5d.childNodes[i].nodeValue;
break;
default:
break;
}
}
return s;
},_processCompactElements:function(_60){
return _60.replace(this.CompactElementRegexp,this.CompactElementReplacer);
}};
tapestry.event={buildEventProperties:function(_61,_62,_63){
if(!_62){
_62={};
}
if(dojo.event.browser.isEvent(_61)){
if(_61["type"]){
_62.beventtype=_61.type;
}
if(_61["keys"]){
_62.beventkeys=_61.keys;
}
if(_61["charCode"]){
_62.beventcharCode=_61.charCode;
}
if(_61["pageX"]){
_62.beventpageX=_61.pageX;
}
if(_61["pageY"]){
_62.beventpageY=_61.pageY;
}
if(_61["layerX"]){
_62.beventlayerX=_61.layerX;
}
if(_61["layerY"]){
_62.beventlayerY=_61.layerY;
}
if(_61["target"]){
this.buildTargetProperties(_62,_61.target);
}
}
_62.methodArguments=dojo.json.serialize(_63);
return _62;
},buildTargetProperties:function(_64,_65){
if(!_65){
return;
}
if(dojo.dom.isNode(_65)){
return this.buildNodeProperties(_64,_65);
}else{
dojo.raise("buildTargetProperties() Unknown target type:"+_65);
}
},buildNodeProperties:function(_66,_67){
if(_67.getAttribute("id")){
_66["beventtarget.id"]=_67.getAttribute("id");
}
},stopEvent:dojo.event.browser.stopEvent};
tapestry.lang={find:function(_68,_69,_6a){
if(!_68||!_69||_68.length<1){
return null;
}
var _6b=dojo.lang.isString(_69);
if(_6b&&!_6a){
return null;
}
for(var i=0;i<_68.length;i++){
if(!_68[i]){
continue;
}
if(_6b){
if(_68[i]&&_68[i][_69]&&_68[i][_69]==_6a){
return _68[i];
}
}else{
if(this.matchProperty(_69,_68[i])){
return _68[i];
}
}
}
return null;
},matchProperty:function(_6d,_6e){
if(!dojo.lang.isObject(_6d)||!dojo.lang.isObject(_6e)){
return _6d.valueOf()==_6e.valueOf();
}
for(var p in _6d){
if(!(p in _6e)){
return false;
}
if(!this.matchProperty(_6d[p],_6e[p])){
return false;
}
}
return true;
}};
dojo.provide("dojo.AdapterRegistry");
dojo.provide("dojo.json");
dojo.AdapterRegistry=function(_70){
this.pairs=[];
this.returnWrappers=_70||false;
};
dojo.lang.extend(dojo.AdapterRegistry,{register:function(_71,_72,_73,_74,_75){
var _76=(_75)?"unshift":"push";
this.pairs[_76]([_71,_72,_73,_74]);
},match:function(){
for(var i=0;i<this.pairs.length;i++){
var _78=this.pairs[i];
if(_78[1].apply(this,arguments)){
if((_78[3])||(this.returnWrappers)){
return _78[2];
}else{
return _78[2].apply(this,arguments);
}
}
}
throw new Error("No match found");
},unregister:function(_79){
for(var i=0;i<this.pairs.length;i++){
var _7b=this.pairs[i];
if(_7b[0]==_79){
this.pairs.splice(i,1);
return true;
}
}
return false;
}});
dojo.json={jsonRegistry:new dojo.AdapterRegistry(),register:function(_7c,_7d,_7e,_7f){
dojo.json.jsonRegistry.register(_7c,_7d,_7e,_7f);
},evalJson:function(_80){
try{
return eval("("+_80+")");
}
catch(e){
dojo.debug(e);
return _80;
}
},serialize:function(o){
var _82=typeof (o);
if(_82=="undefined"){
return "undefined";
}else{
if((_82=="number")||(_82=="boolean")){
return o+"";
}else{
if(o===null){
return "null";
}
}
}
if(_82=="string"){
return dojo.string.escapeString(o);
}
var me=arguments.callee;
var _84;
if(typeof (o.__json__)=="function"){
_84=o.__json__();
if(o!==_84){
return me(_84);
}
}
if(typeof (o.json)=="function"){
_84=o.json();
if(o!==_84){
return me(_84);
}
}
if(_82!="function"&&typeof (o.length)=="number"){
var res=[];
for(var i=0;i<o.length;i++){
if(dojo.event.browser.isEvent(o[i])||o[i]["stopPropagation"]){
continue;
}
var val=me(o[i]);
if(typeof (val)!="string"){
val="undefined";
}
res.push(val);
}
return "["+res.join(",")+"]";
}
try{
window.o=o;
_84=dojo.json.jsonRegistry.match(o);
return me(_84);
}
catch(e){
}
if(_82=="function"){
return null;
}
res=[];
for(var k in o){
var _89;
if(typeof (k)=="number"){
_89="\""+k+"\"";
}else{
if(typeof (k)=="string"){
_89=dojo.string.escapeString(k);
}else{
continue;
}
}
val=me(o[k]);
if(typeof (val)!="string"){
continue;
}
res.push(_89+":"+val);
}
return "{"+res.join(",")+"}";
}};
dojo.provide("tapestry.fx");
tapestry.fx={preEffects:{},postEffects:{},ajaxStatusAction:"loading",attachPreEffect:function(_8a,_8b,_8c){
if(dojo.lang.isEmpty(this.preEffects)){
this._initPreEffects();
}
this.preEffects[_8a]={async:_8c,animation:_8b};
},attachPostEffect:function(_8d,_8e){
if(dojo.lang.isEmpty(this.postEffects)){
this._initPostEffects();
}
this.postEffects[_8d]={animation:_8e};
},removeAll:function(){
this.preEffects={};
this.postEffects={};
},attachAjaxStatus:function(a1){
dojo.log.debug("Attaching ajax status listener");
if(dojo.lang.isString(a1)){
tapestry.fx.ajaxStatusAction=function(_90){
if(_90){
dojo.html.show(a1);
}else{
dojo.html.hide(a1);
}
};
}else{
if(dojo.lang.isFunction(a1)){
tapestry.fx.ajaxStatusAction=a1;
}else{
dojo.log.warn("Argument to tapestry.fx.attachAjaxStatus should be either a string or a function");
return;
}
}
dojo.event.connectOnce(dojo.io,"queueBind",tapestry.fx._processAjaxStatus);
dojo.event.connectOnce(tapestry,"error",tapestry.fx._processAjaxStatus);
dojo.event.connectOnce(tapestry,"load",tapestry.fx._processAjaxStatus);
dojo.event.connectOnce(tapestry,"loadJson",tapestry.fx._processAjaxStatus);
},_processAjaxStatus:function(){
tapestry.fx.ajaxStatusAction.apply(this,[tapestry.isServingRequests()]);
},_initPreEffects:function(){
dojo.log.debug("Advising tapestry.linkOnClick");
dojo.event.connectAround(tapestry,"linkOnClick",tapestry.fx,"_applyPreEffects");
},_initPostEffects:function(){
dojo.log.debug("Advising tapestry.loadContent");
dojo.event.connectAround(tapestry,"loadContent",tapestry.fx,"_applyPostEffects");
},_applyPreEffects:function(_91){
var id=_91.args[1];
var _93=this.preEffects[id];
if(_93){
dojo.log.debug("Found pre-effect:",_93,id);
var _94=_93.animation();
if(_93.async){
_94.play();
return _91.proceed();
}else{
_94.connect("onEnd",function(){
_91.proceed();
});
_94.play();
return false;
}
}else{
return _91.proceed();
}
},_applyPostEffects:function(_95){
var id=_95.args[0];
var _97=this.postEffects[id];
if(_97){
dojo.log.debug("Found post-effect:",_97,id);
var ret=_95.proceed();
var _99=_97.animation();
_99.play();
return ret;
}else{
return _95.proceed();
}
}};
dojo.provide("tapestry.namespace");
dojo.require("dojo.ns");
(function(){
var map={html:{"alertdialog":"tapestry.widget.AlertDialog","timepicker":"tapestry.widget.TimePicker"}};
function resolveNamespace(_9b,_9c){
if(!_9c){
_9c="html";
}
if(!map[_9c]){
return null;
}
return map[_9c][_9b];
}
var _9d;
if(dojo.hostenv.moduleHasPrefix("tapestry")){
_9d=dojo.hostenv.getModulePrefix("tapestry");
}else{
_9d="../tapestry";
}
dojo.registerNamespaceManifest("tapestry",_9d,"tapestry","tapestry.widget");
dojo.registerNamespaceResolver("tapestry",resolveNamespace);
})();
dojo.provide("tapestry.widget.AlertDialog");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Dialog");
dojo.require("dojo.event.common");
dojo.require("dojo.html.common");
dojo.widget.defineWidget("tapestry.widget.AlertDialog",dojo.widget.Dialog,{bgColor:"white",bgOpacity:0.6,okButton:null,messageNode:null,message:"",dialogClass:"alertDialog",contentClass:"alertContent",buttonClass:"alertButton",buttonText:"OK",postCreate:function(_9e,_9f,_a0){
dojo.widget.Dialog.prototype.postCreate.call(this,_9e,_9f,_a0);
var _a1=document.createElement("div");
dojo.html.setClass(_a1,this.contentClass);
this.containerNode.appendChild(_a1);
dojo.html.addClass(this.containerNode,this.dialogClass);
this.messageNode=document.createElement("div");
this.messageNode.innerHTML=this.message;
_a1.appendChild(this.messageNode);
var _a2=document.createElement("button");
dojo.html.setClass(_a2,this.buttonClass);
_a2.setAttribute("id","alertButton");
_a2.innerHTML=this.buttonText;
_a1.appendChild(_a2);
this.okButton=_a2;
this.tabStart=this.okButton;
this.tabEnd=this.okButton;
this.show();
dojo.event.connect(this.okButton,"onclick",this,"hideDialog");
this.okButton.focus();
dojo.event.connect(this.wrapper,"onkeyup",this,"dialogKeys");
dojo.event.connect(document.body,"onkeyup",this,"bodyKeys");
},dialogKeys:function(e){
if(e.keyCode==e.KEY_ESCAPE){
this.hideDialog(e);
}
if(e.stopPropagation){
e.stopPropagation();
}else{
e.cancelBubble=true;
}
},bodyKeys:function(e){
if(e.keyCode==e.KEY_ESCAPE){
this.hideDialog(e);
}else{
if(!dojo.dom.isDescendantOf(e.target,this.wrapper,true)){
dojo.event.browser.stopEvent(e);
this.tabStart.focus();
}
}
},setMessage:function(str){
this.messageNode.innerHTML=str;
},hideDialog:function(e){
dojo.event.disconnect(this.wrapper,"onkeyup",this,"dialogKeys");
dojo.event.disconnect(document.body,"onkeyup",this,"bodyKeys");
this.hideModalDialog();
dojo.dom.removeNode(this.okButton);
tapestry.widget.AlertDialog.prototype.destroy.call(this);
dojo.dom.removeNode(this.bg);
tapestry.form._focusCurrentField();
}},"html");
dojo.provide("tapestry.form");
dojo.provide("tapestry.form.datetime");
dojo.provide("tapestry.form.validation");
dojo.require("dojo.event.browser");
dojo.require("dojo.dom");
dojo.require("dojo.html.selection");
dojo.require("dojo.date.format");
dojo.require("dojo.validate.datetime");
dojo.require("dojo.validate.check");
dojo.require("dojo.html.style");
tapestry.form={forms:{},currentFocus:null,focusField:function(_a7){
if(arguments.length<1){
return;
}
try{
var f=dojo.widget.byId(_a7);
if(f&&!dj_undef("focus",f)){
if(dojo.html.isVisible(f)){
f.focus();
}
return;
}else{
f=dojo.byId(_a7);
}
if(!f){
return;
}
if(_a7.disabled||_a7.clientWidth<1){
return;
}
if(!dj_undef("focus",f)&&dojo.html.isShowing(f)){
f.focus();
return;
}
dojo.html.selectInputText(_a7);
}
catch(e){
dojo.log.debug(e);
}
},_focusCurrentField:function(){
if(!this.currentFocus){
return;
}
this.focusField(this.currentFocus);
},registerForm:function(id,_aa,_ab){
var _ac=dojo.byId(id);
if(!_ac){
dojo.raise("Form not found with id "+id);
return;
}
id=_ac.getAttribute("id");
if(this.forms[id]){
dojo.event.disconnect(_ac,"onsubmit",this,"onFormSubmit");
for(var i=0;i<_ac.elements.length;i++){
var _ae=_ac.elements[i];
if(_ae&&_ae.type&&dojo.lang.inArray(["submit","button"],_ae.type.toLowerCase())){
dojo.event.disconnect(_ae,"onclick",tapestry.form,"inputClicked");
}
}
var _af=_ac.getElementsByTagName("input");
for(var i=0;i<_af.length;i++){
var _b0=_af[i];
if(_b0.type.toLowerCase()=="image"&&_b0.form==_ac){
dojo.event.disconnect(_b0,"onclick",tapestry.form,"inputClicked");
}
}
dojo.event.disconnect(_ac,"onsubmit",this,"overrideSubmit");
delete this.forms[id];
}
this.forms[id]={};
this.forms[id].validateForm=true;
this.forms[id].profiles=[];
this.forms[id].async=(typeof _aa!="undefined")?_aa:false;
this.forms[id].json=(typeof _ab!="undefined")?_ab:false;
if(!this.forms[id].async){
dojo.event.connect(_ac,"onsubmit",this,"onFormSubmit");
}else{
for(var i=0;i<_ac.elements.length;i++){
var _ae=_ac.elements[i];
if(_ae&&_ae.type&&dojo.lang.inArray(["submit","button"],_ae.type.toLowerCase())){
dojo.event.connect(_ae,"onclick",tapestry.form,"inputClicked");
}
}
var _af=_ac.getElementsByTagName("input");
for(var i=0;i<_af.length;i++){
var _b0=_af[i];
if(_b0.type.toLowerCase()=="image"&&_b0.form==_ac){
dojo.event.connect(_b0,"onclick",tapestry.form,"inputClicked");
}
}
dojo.event.connect(_ac,"onsubmit",this,"overrideSubmit");
}
},overrideSubmit:function(e){
dojo.event.browser.stopEvent(e);
var elm=e.target;
if(!dj_undef("form",elm)){
dojo.log.debug("Submit event was generated from element: ",elm);
elm=elm.form;
}
tapestry.form.submitAsync(elm);
},registerProfile:function(id,_b4){
if(!this.forms[id]){
dojo.raise("registerProfile("+id+") No form previously registered with that id.");
return;
}
this.forms[id].profiles.push(_b4);
},clearProfiles:function(id){
if(!this.forms[id]){
return;
}
for(var i=0;i<this.forms[id].profiles.length;i++){
delete this.forms[id].profiles[i];
}
this.forms[id].profiles=[];
},inputClicked:function(e){
var _b8=e.currentTarget;
if(_b8.disabled||dj_undef("form",_b8)){
return;
}
this.forms[_b8.form.getAttribute("id")].clickedButton=_b8;
},setFormValidating:function(_b9,_ba){
if(this.forms[_b9]){
this.forms[_b9].validateForm=_ba;
}
},onFormSubmit:function(evt){
if(!evt||dj_undef("target",evt)){
dojo.raise("No valid form event found with argument: "+evt);
return;
}
var id=evt.target.getAttribute("id");
if(!id){
dojo.raise("Form had no id attribute.");
return;
}
var _bd=dojo.byId(id);
if(!dj_undef("value",_bd.submitmode)&&(_bd.submitmode.value=="cancel"||_bd.submitmode.value=="refresh")){
return;
}
if(!tapestry.form.validation.validateForm(_bd,this.forms[id])){
dojo.event.browser.stopEvent(evt);
}
},submit:function(_be,_bf,_c0){
_be=dojo.byId(_be);
if(!_be){
dojo.raise("Form not found with id "+_be);
return;
}
var id=_be.getAttribute("id");
if(_bf){
_be.submitname.value=_bf;
}
if(!dj_undef("value",_be.submitmode)&&(_be.submitmode.value=="cancel"||_be.submitmode.value=="refresh")&&!_c0){
_be.submit();
return;
}
if(!tapestry.form.validation.validateForm(_be,this.forms[id])){
return;
}
if(_c0&&!dj_undef("async",_c0)&&_c0.async){
tapestry.form.submitAsync(_be,null,_bf,_c0);
return;
}else{
if(!dj_undef(id,this.forms)&&this.forms[id].async){
tapestry.form.submitAsync(_be);
return;
}
}
_be.submit();
},cancel:function(_c2,_c3,_c4){
_c2=dojo.byId(_c2);
if(!_c2){
dojo.raise("Form not found with id "+_c2);
return;
}
var _c5=_c2.getAttribute("id");
var _c6=tapestry.form.forms[_c5].validateForm;
tapestry.form.setFormValidating(_c5,false);
var _c7=_c2.submitmode.value;
_c2.submitmode.value="cancel";
if(_c4&&!dj_undef("async",_c4)&&_c4.async){
this.submitAsync(_c2,null,_c3,_c4);
_c2.submitmode.value=_c7;
tapestry.form.setFormValidating(_c5,_c6);
}else{
this.submit(_c2,_c3,_c4);
}
},refresh:function(_c8,_c9,_ca){
_c8=dojo.byId(_c8);
if(!_c8){
dojo.raise("Form not found with id "+_c8);
return;
}
var _cb=_c8.getAttribute("id");
var _cc=tapestry.form.forms[_cb].validateForm;
tapestry.form.setFormValidating(_cb,false);
var _cd=_c8.submitmode.value;
_c8.submitmode.value="refresh";
if(_ca&&!dj_undef("async",_ca)&&_ca.async){
this.submitAsync(_c8,null,_c9,_ca);
_c8.submitmode.value=_cd;
tapestry.form.setFormValidating(_cb,_cc);
}else{
this.submit(_c8,_c9,_ca);
}
},submitAsync:function(_ce,_cf,_d0,_d1){
_ce=dojo.byId(_ce);
if(!_ce){
dojo.raise("Form not found with id "+id);
return;
}
var _d2=_ce.getAttribute("id");
if(!tapestry.form.validation.validateForm(_ce,this.forms[_d2])){
dojo.log.debug("Form validation failed for form with id "+_d2);
return;
}
if(_d0){
var _d3=_ce.submitname.value;
_ce.submitname.value=_d0;
if(!_cf){
_cf={};
}
if(_ce[_d0]){
_cf[_d0]=_ce[_d0].value;
}
}
if(!dj_undef("clickedButton",this.forms[_d2])){
if(!_cf){
_cf={};
}
_cf[this.forms[_d2].clickedButton.getAttribute("name")]=this.forms[_d2].clickedButton.getAttribute("value");
delete this.forms[_d2].clickedButton;
}
var _d4={formNode:_ce,content:_cf,useCache:true,preventCache:true,error:(function(){
tapestry.error.apply(this,arguments);
}),encoding:tapestry.requestEncoding};
if(_d1){
if(!dj_undef("url",_d1)){
_d4.url=_d1.url;
}
}
if(this.forms[_d2].json||_d1&&_d1.json){
_d4.headers={"json":true};
_d4.mimetype="text/json";
_d4.load=(function(){
tapestry.loadJson.apply(this,arguments);
});
}else{
_d4.headers={"dojo-ajax-request":true};
_d4.mimetype="text/xml";
_d4.load=(function(){
tapestry.load.apply(this,arguments);
});
}
tapestry.requestsInFlight++;
dojo.io.queueBind(_d4);
if(_d0){
_ce.submitname.value=_d3;
}
}};
tapestry.form.validation={missingClass:"fieldMissing",invalidClass:"fieldInvalid",dialogName:"tapestry:AlertDialog",validateForm:function(_d5,_d6){
if(typeof _d5=="undefined"){
return false;
}
if(typeof _d6=="undefined"){
return true;
}
if(!_d6.validateForm){
return true;
}
try{
this.clearValidationDecorations(_d5,_d6);
for(var i=0;i<_d6.profiles.length;i++){
var _d8=dojo.validate.check(_d5,_d6.profiles[i]);
if(!this.processResults(_d5,_d8,_d6.profiles[i])){
this.summarizeErrors(_d5,_d8,_d6.profiles[i]);
return false;
}
}
}
catch(e){
dojo.log.exception("Error validating",e,true);
return false;
}
return true;
},processResults:function(_d9,_da,_db){
if(_da.isSuccessful()){
return true;
}
var _dc=true;
if(_da.hasMissing()){
var _dd=_da.getMissing();
for(var i=0;i<_dd.length;i++){
this.handleMissingField(_dd[i],_db);
}
_dc=false;
}
if(_da.hasInvalid()){
var _df=_da.getInvalid();
for(var i=0;i<_df.length;i++){
this.handleInvalidField(_df[i],_db);
}
_dc=false;
}
return _dc;
},handleMissingField:function(_e0,_e1){
_e0=dojo.byId(_e0);
if(dj_undef("type",_e0)){
return;
}
dojo.html.removeClass(_e0,this.invalidClass);
if(!dojo.html.hasClass(_e0,this.missingClass)){
dojo.html.prependClass(_e0,this.missingClass);
}
},handleInvalidField:function(_e2,_e3){
_e2=dojo.byId(_e2);
if(dj_undef("type",_e2)){
return;
}
dojo.html.removeClass(_e2,this.missingClass);
if(!dojo.html.hasClass(_e2,this.invalidClass)){
dojo.html.prependClass(_e2,this.invalidClass);
}
},clearValidationDecorations:function(_e4,_e5){
for(var i=0;i<_e5.profiles.length;i++){
for(var _e7 in _e5.profiles[i]){
if(dj_undef("type",_e4.elements[_e7])||typeof _e4.elements[_e7].type=="undefined"||_e4.elements[_e7].type=="submit"||_e4.elements[_e7].type=="hidden"){
continue;
}
dojo.html.removeClass(_e4.elements[_e7],this.missingClass);
dojo.html.removeClass(_e4.elements[_e7],this.invalidClass);
}
}
},summarizeErrors:function(_e8,_e9,_ea){
var _eb=[];
var _ec=[];
tapestry.form.currentFocus=null;
if(_e9.hasMissing()){
var _ed=_e9.getMissing();
for(var i=0;i<_ed.length;i++){
if(i==0&&!tapestry.form.currentFocus){
tapestry.form.currentFocus=_ed[i];
}
if(_ea[_ed[i]]&&_ea[_ed[i]]["required"]){
if(dojo.lang.isArray(_ea[_ed[i]]["required"])){
for(var z=0;z<_ea[_ed[i]]["required"].length;z++){
_eb.push(_ea[_ed[i]]["required"][z]);
}
}else{
_eb.push(_ea[_ed[i]]["required"]);
}
}
}
}
if(_e9.hasInvalid()){
var _ed=_e9.getInvalid();
for(var i=0;i<_ed.length;i++){
if(i==0&&!tapestry.form.currentFocus){
tapestry.form.currentFocus=_ed[i];
}
if(_ea[_ed[i]]&&_ea[_ed[i]]["constraints"]){
if(dojo.lang.isArray(_ea[_ed[i]]["constraints"])){
for(var z=0;z<_ea[_ed[i]]["constraints"].length;z++){
_ec.push(_ea[_ed[i]]["constraints"][z]);
}
}else{
_ec.push(_ea[_ed[i]]["constraints"]);
}
}
}
}
var msg="";
if(_eb.length>0){
msg+="<ul class=\"missingList\">";
for(var i=0;i<_eb.length;i++){
msg+="<li>"+_eb[i]+"</li>";
}
msg+="</ul>";
}
if(_ec.length>0){
msg+="<ul class=\"invalidList\">";
for(var i=0;i<_ec.length;i++){
msg+="<li>"+_ec[i]+"</li>";
}
msg+="</ul>";
}
dojo.require("dojo.widget.*");
var ad=dojo.widget.byId("validationDialog");
if(ad){
ad.setMessage(msg);
ad.show();
return;
}
var _f2=document.createElement("span");
document.body.appendChild(_f2);
var _f3=dojo.widget.createWidget(this.dialogName,{widgetId:"validationDialog",message:msg},_f2);
_f3.show();
},isValidPattern:function(_f4,_f5){
if(typeof _f4!="string"||typeof _f5!="string"){
return false;
}
var re=new RegExp(_f5);
return re.test(_f4);
},isPalleteSelected:function(_f7){
return _f7.length>0;
},isEqual:function(_f8,_f9){
var _fa=dojo.byId(_f9).value;
return _f8==_fa;
},isNotEqual:function(_fb,_fc){
return !tapestry.form.validation.isEqual(_fb,_fc);
},greaterThanOrEqual:function(_fd,_fe,_ff){
dojo.require("dojo.i18n.number");
_ff.validate=false;
var min=dojo.i18n.number.parse(_fe,null,_ff);
var num=dojo.i18n.number.parse(_fd,null,_ff);
if(Number.NaN==num){
return false;
}
return num>=min;
},lessThanOrEqual:function(_102,_103,_104){
dojo.require("dojo.i18n.number");
_104.validate=false;
var max=dojo.i18n.number.parse(_103,null,_104);
var num=dojo.i18n.number.parse(_102,null,_104);
if(Number.NaN==num){
return false;
}
return num<=max;
},isText:dojo.validate.isText,isEmailAddress:function(){
dojo.require("dojo.validate.web");
return dojo.validate.isEmailAddress.apply(dojo.validate,arguments);
},isReal:function(){
dojo.require("dojo.i18n.number");
return dojo.i18n.number.isReal.apply(dojo.i18n.number,arguments);
}};
tapestry.form.datetime={isValidDate:function(_107,_108){
if(!_107){
return false;
}
if(!_108){
dojo.raise("isValidDate: value and flags must be specified");
return;
}
var _109=null;
try{
_109=dojo.date.parse(_107,_108);
}
catch(e){
dojo.log.exception("Error parsing input date.",e,true);
return false;
}
if(_109==null){
return false;
}
_107=dojo.date.format(_109,_108);
if(!dj_undef("max",_108)){
if(typeof _108.max=="string"){
_108.max=dojo.date.parse(_108.max,_108);
}
if(dojo.date.compare(_109,_108.max,dojo.date.compareTypes.DATE)>0){
return false;
}
}
if(!dj_undef("min",_108)){
if(typeof _108.min=="string"){
_108.min=dojo.date.parse(_108.min,_108);
}
if(dojo.date.compare(_109,_108.min,dojo.date.compareTypes.DATE)<0){
return false;
}
}
return true;
}};
dojo.provide("tapestry.widget");
dojo.provide("tapestry.widget.Widget");
dojo.require("dojo.widget.*");
tapestry.widget={synchronizeWidgetState:function(_10a,type,_10c,_10d,_10e){
if(typeof _10d=="undefined"){
_10d=true;
}
var _10f=dojo.widget.byId(_10a);
if(!_10f){
this.createWidget(_10a,type,_10c,_10e);
}else{
if(_10d){
_10f.destroy();
this.createWidget(_10a,type,_10c,_10e);
}else{
this.setWidgetProperties(_10f,_10c);
}
}
},createWidget:function(_110,type,_112,_113){
var node=dojo.byId(_110);
if(!node){
dojo.raise("createWidget() Node not found with specified id of '"+_110+"'.");
return;
}
if(!_112["widgetId"]){
_112["widgetId"]=_110;
}
var w=dojo.widget.createWidget(type,_112,node,_113);
this.setWidgetProperties(w,_112);
},setWidgetProperties:function(w,_117){
if(!dj_undef("disabled",_117)&&_117.disabled&&dojo.lang.isFunction(w["disable"])){
w.disable();
}
}};
dojo.provide("amplafi.validation");
amplafi.validation={messageReplaceTokens:["{{UPDATE_DATE}}","{{HEADLINE}}","{{MESSAGE}}","{{EVENT_START}}","{{EVENT_END}}","{{EVENT_LOCATION}}","{{DEADLINE}}","{{CONTACT}}"],validateMessageFormat:function(_118){
var _119=amplafi.validation.messageReplaceTokens;
for(var i=0;i<_119.length;i++){
var _11b=_118.indexOf(_119[i]);
if(_11b>=0){
var _11c=_118.indexOf(_119[i],_11b+1);
if(_11c>=0){
return false;
}
}
}
return true;
},validateFlow:function(form){
var _11e=tapestry.form.forms[form];
if(!_11e.profiles[0].quick){
return true;
}
var _11f=_11e.formValues;
var _120=dojo.io.encodeForm(dojo.byId(form));
var _121=_11f?_11e.formValidation:true;
_11e.formValidation=_121;
if(_11f==_120){
return _121;
}
_11e.formValues=_120;
if(_11f){
tapestry.form.refresh(form,null,{async:true,json:true});
}
return _121;
},setupFieldValidation:function(form){
form=dojo.byId(form);
var _123=tapestry.form.forms[form.id].profiles[0];
for(var id in _123){
var node=dojo.byId(id);
if(node&&node["blur"]){
dojo.event.connect(node,"onblur",amplafi.validation,"validateFieldOnEvent");
}
}
},validateFieldOnEvent:function(e){
var _127=e.target;
var res=amplafi.validation.isFieldInError(_127);
if(res){
amplafi.validation.clearFieldDecoration(_127);
amplafi.validation.decorateField(_127,res.msg,res.type);
}else{
amplafi.validation.clearFieldDecoration(_127,true);
}
},isFieldInError:function(_129){
_129=dojo.byId(_129);
var form=_129.form;
var _12b=tapestry.form.forms[form.id].profiles[0];
var _12c=dojo.validate.check(form,_12b);
if(_12c.isSuccessful()){
return false;
}
var _12d=function(arr,elmt){
for(var i=0;i<arr.length;i++){
if(arr[i]==elmt){
return true;
}
}
return false;
};
var _131=_12d(_12c.getMissing(),_129.id);
if(_131){
if(dojo.lang.isArray(_12b[_129.id]["required"])){
return {msg:_12b[_129.id]["required"][0],type:"fieldMissing"};
}else{
return {msg:_12b[_129.id]["required"],type:"fieldMissing"};
}
}
_131=_12d(_12c.getInvalid(),_129.id);
if(_131){
if(dojo.lang.isArray(_12b[_129.id]["constraints"])){
return {msg:_12b[_129.id]["constraints"][0],type:"fieldInvalid"};
}else{
return {msg:_12b[_129.id]["constraints"],type:"fieldInvalid"};
}
}
return false;
},quickValidateForm:function(_132,_133,_134,stop){
var _136=_133.profiles[0];
if(!_136.quickStarted&&!_134){
return;
}
_136.quick=true;
_136.oneshot=_134;
var res=tapestry.form.validation.validateForm(_132,_133);
_136.quick=false;
_136.oneshot=false;
},decorateField:function(_138,msg,_13a){
if(!_13a){
_13a="fieldMissing";
}
var _13b="<span class=\""+_13a+"\">";
var end="</span>";
var lbl=amplafi.util.findLabelFor(_138);
if(lbl){
var prev=lbl.innerHTML;
var pos=this._indexOfSpanWithClass(prev,_13a);
if(pos>=0){
prev=prev.substring(0,pos);
}
lbl.innerHTML=prev+_13b+msg+end;
dojo.html.removeClass(lbl,"fieldValid");
if(!dojo.html.hasClass(lbl,_13a)){
dojo.html.prependClass(lbl,_13a);
}
}else{
dojo.event.topic.publish("info",{message:_13b+msg+end,delay:10000,type:"WARNING"});
}
dojo.event.connectOnce(dojo.byId(_138),"onkeypress",amplafi.validation,"clearFieldDecoration");
},summarizeErrors:function(_140){
var form=_140.args[0],_142=_140.args[1],_143=_140.args[2];
if(_143.quick){
return;
}
var i,z,_146,_147,cmnt;
var _149=[];
var _14a=[];
tapestry.form.currentFocus=null;
if(_142.hasMissing()){
_146=_142.getMissing();
for(i=0;i<_146.length;i++){
_147=_146[i];
cmnt="";
if(i==0&&!tapestry.form.currentFocus){
tapestry.form.currentFocus=_146[i];
}
if(_143[_146[i]]&&_143[_147]["required"]){
if(dojo.lang.isArray(_143[_147]["required"])){
for(z=0;z<_143[_147]["required"].length;z++){
_149.push(_143[_147]["required"][z]);
cmnt+=_143[_147]["required"][z];
}
}else{
_149.push(_143[_147]["required"]);
cmnt+=_143[_147]["required"];
}
}
amplafi.validation.decorateField(_147,cmnt);
}
}
if(_142.hasInvalid()){
_146=_142.getInvalid();
for(i=0;i<_146.length;i++){
_147=_146[i];
cmnt="";
if(i==0&&!tapestry.form.currentFocus){
tapestry.form.currentFocus=_146[i];
}
if(_143[_146[i]]&&_143[_147]["constraints"]){
if(dojo.lang.isArray(_143[_147]["constraints"])){
for(z=0;z<_143[_147]["constraints"].length;z++){
_14a.push(_143[_147]["constraints"][z]);
cmnt+=_143[_147]["constraints"][z];
}
}else{
_14a.push(_143[_147]["constraints"]);
cmnt+=_143[_147]["constraints"];
}
}
amplafi.validation.decorateField(_147,cmnt,"fieldInvalid");
}
}
if(tapestry.form.currentFocus){
tapestry.form.focusField(tapestry.form.currentFocus);
}
var msg="";
if(_149.length>0){
msg+="<ul class=\"missingList\">";
for(i=0;i<_149.length;i++){
msg+="<li>"+_149[i]+"</li>";
}
msg+="</ul>";
}
if(_14a.length>0){
msg+="<ul class=\"invalidList\">";
for(i=0;i<_14a.length;i++){
msg+="<li>"+_14a[i]+"</li>";
}
msg+="</ul>";
}
},processResults:function(_14c){
var form=_14c.args[0],_14e=_14c.args[1],_14f=_14c.args[2];
if(!_14f.quick){
_14f.quickStarted=false;
}
if(!_14f.oneshot){
return _14c.proceed();
}else{
return _14e.isSuccessful();
}
},clearFieldDecoration:function(e,_151){
var _152=e.target?e.target:e;
dojo.html.removeClass(_152,"fieldMissing");
dojo.html.removeClass(_152,"fieldInvalid");
var lbl=amplafi.util.findLabelFor(_152);
if(lbl){
var prev=lbl.innerHTML;
var pos=this._indexOfSpanWithClass(prev,"fieldMissing");
if(pos>=0){
prev=prev.substring(0,pos);
}
pos=this._indexOfSpanWithClass(prev,"fieldInvalid");
if(pos>=0){
prev=prev.substring(0,pos);
}
lbl.innerHTML=prev;
dojo.html.removeClass(lbl,"fieldMissing");
dojo.html.removeClass(lbl,"fieldInvalid");
dojo.html.removeClass(lbl,"fieldValid");
if(_151&&!dojo.html.hasClass(lbl,"fieldValid")){
dojo.html.prependClass(lbl,"fieldValid");
}
}
},_indexOfSpanWithClass:function(str,cls){
var pos=str.indexOf("<span class=\""+cls+"\">");
if(pos<0){
pos=str.indexOf("<SPAN class="+cls+">");
}
return pos;
}};
dojo.addOnLoad(function(){
dojo.event.connectAround(tapestry.form.validation,"processResults",amplafi.validation,"processResults");
dojo.event.connectAround(tapestry.form.validation,"summarizeErrors",amplafi.validation,"summarizeErrors");
dojo.event.connect(tapestry.form,"registerProfile",amplafi.validation,"setupFieldValidation");
});
dojo.provide("amplafi.animation");
amplafi.animation={reScope:function(_159,end,fn){
fn=fn||dojo.lfx.easeIn;
return function(n){
return fn(_159+(end-_159)*n);
};
},fadeWipeNodes:[],fadeCount:0,fadeWipeOut:function(_15d,_15e,_15f,_160){
_15d=dojo.lfx.html._byId(_15d);
var _161=[];
var _162=0.4;
dojo.lang.forEach(_15d,function(node){
amplafi.animation.fadeWipeNodes.push(node.id||"."+dojo.html.getClass(node));
var _164={};
var anim=dojo.lfx.propertyAnimation(node,{"height":{start:function(){
return dojo.html.getContentBox(node).height;
},end:function(){
var _166=_162*dojo.html.getContentBox(node).height;
return 200;
}}},_15e,_15f,{"beforeBegin":function(){
_164.overflow=node.style.overflow;
_164.height=node.style.height;
with(node.style){
overflow="hidden";
}
dojo.html.show(node);
with(dojo.byId("loading").style){
display="block";
}
dojo.html.placeOnScreen("loading",500,170);
},"onEnd":function(){
with(node.style){
}
if(_160){
_160(node,anim);
}
}});
_161.push(anim);
_161.push(dojo.lfx.html.fade(node,{end:0.2}));
});
if(dojo.widget.PopupManager.currentMenu){
dojo.widget.PopupManager.currentMenu.close();
}
return dojo.lfx.combine(_161);
},fadeWipeIn:function(_167,_168,_169,_16a){
_167=dojo.lfx.html._byId(_167);
var _16b=[];
dojo.lang.forEach(_167,function(node){
var _16d={};
var _16e,_16f,_170,_171,_172;
with(node.style){
_16e=top;
_16f=left;
_170=position;
_171=height;
_172=display;
top="-9999px";
left="-9999px";
position="absolute";
display="";
height="auto";
}
var _173=dojo.html.getBorderBox(node).height;
with(node.style){
top=_16e;
left=_16f;
position=_170;
height=_171;
display=_172;
}
var anim=dojo.lfx.propertyAnimation(node,{"height":{end:function(){
return _173;
}}},_168,_169);
anim.connect("beforeBegin",function(){
_16d.overflow=node.style.overflow;
_16d.height=node.style.height;
with(node.style){
overflow="hidden";
height="200px";
}
dojo.html.show(node);
});
anim.connect("onEnd",function(){
with(node.style){
overflow=_16d.overflow;
height="auto";
}
with(dojo.byId("loading").style){
display="none";
}
dojo.html.placeOnScreen("loading",10,10);
if(_16a){
_16a(node,anim);
}
});
_16b.push(anim);
_16b.push(dojo.lfx.html.fade(node,{end:1}));
});
return dojo.lfx.combine(_16b);
},setupTransition:function(kw){
var _176;
if(kw.content){
for(var i in kw.content){
var id=(i=="beventtarget.id")?kw.content[i]:i;
if(dojo.byId(id)){
if(dojo.html.hasClass(id,"noanimation")){
return;
}
var cs=dojo.html.getClass(id);
if(cs.indexOf("refresh-")==0){
_176=cs.substring("refresh-".length);
}
}
}
}
if(_176){
amplafi.util.attachIndicator(_176);
return;
}
var node=kw.formNode;
if(node){
var _17b=dojo.html.getElementsByClass("flow",node);
if(_17b&&_17b.length==1){
amplafi.animation.fadeCount++;
amplafi.animation.fadeWipeOut(_17b[0].getElementsByTagName("div")[1]).play();
}
}
},setupEndTransition:function(id,node,_17e){
if(id.indexOf("FullFlow">=0)&&amplafi.animation.fadeCount>0){
id=dojo.byId(id);
var _17f=dojo.html.getElementsByClass("flow",id);
if(_17f&&_17f.length==1){
amplafi.animation.fadeCount--;
var _180=dojo.html.getElementsByClass("flowBody",_17f[0])[0];
_180.style.height="200px";
dojo.html.setOpacity(_180,0.2);
amplafi.animation.fadeWipeIn(_180).play();
}
}
}};
dojo.addOnLoad(function(){
amplafi.util.runIfNot("skipAnim",function(){
dojo.event.connect(dojo.io,"queueBind",amplafi.animation,"setupTransition");
dojo.event.connect(tapestry,"loadContent",amplafi.animation,"setupEndTransition");
});
});
dojo.provide("amplafi.ui");
dojo.require("dojo.html.*");
dojo.require("dojo.io.cookie");
amplafi.ui={_highlightNode:null,_highlightedNode:null,_highlightFn:null,_userTimeZone:-1*(new Date().getTimezoneOffset()/60),toggleDebugPanel:function(){
if(dojo.byId("debug")){
dojo.html.toggleDisplay(dojo.byId("debug"));
}
return false;
},toggleFadeFieldset:function(_181,url,_183){
var _184=_181.parentNode;
var node=_184.getElementsByTagName("div")[0];
var dic=dojo.io.cookie;
var _187=dic.getCookie("ui_state");
var pos;
if(dojo.html.isShowing(node)){
dojo.html.setShowing(node,false);
dojo.html.addClass(_184,"toggle_close");
dojo.html.removeClass(_184,"toggle_open");
if(_187&&(pos=_187.indexOf(_184.id+"-"))>=0){
_187=_187.substring(0,pos)+_187.substring(pos+_184.id.length+1);
dic.setCookie("ui_state",_187,30,"/");
}
}else{
dojo.html.setShowing(node,true);
dojo.html.addClass(_184,"toggle_open");
dojo.html.removeClass(_184,"toggle_close");
if(!_187||(pos=_187.indexOf(_184.id+"-"))<0){
_187=_187||"";
_187+=_184.id+"-";
dic.setCookie("ui_state",_187,30,"/");
}
if(url&&node.childNodes.length==0){
tapestry.linkOnClick(url,_183,false);
node.innerHTML="&nbsp;";
amplafi.util.attachIndicator(node);
}
}
},applyToClass:function(_189,fn,_18b){
var _18c=dojo.html.getElementsByClass(_189,_18b);
for(var i=0;i<_18c.length;i++){
var node=_18c[i];
fn(node);
}
},showHideClass:function(_18f){
amplafi.ui.applyToClass(_18f,dojo.html.toggleDisplay);
},setupHideables:function(_190){
amplafi.ui.applyToClass("hideable",function(node){
if(dojo.html.getElementsByClass("hideSpan",node).length>0){
return;
}
var _192=node.title;
var _193="Hide ";
if(_192){
_193=_193+_192;
}
var _194=amplafi.html.createNode("span",node.firstChild,{innerHTML:_193,className:"hide hideSpan"},"before");
if(_192){
_193="Show "+_192;
}else{
_193="Show";
}
var _195=amplafi.html.createNode("span",node,{innerHTML:_193,className:"hide hideSpan"},"before");
dojo.event.connect(node,"onmouseover",function(){
dojo.html.removeClass(_194,"hide");
});
dojo.event.connect(node,"onmouseout",function(){
dojo.html.addClass(_194,"hide");
});
dojo.event.connect(_194,"onclick",function(){
dojo.lfx.fadeHide(_194.parentNode,200).play();
dojo.html.removeClass(_195,"hide");
});
dojo.event.connect(_195,"onclick",function(){
dojo.lfx.fadeShow(_194.parentNode,200).play();
dojo.html.addClass(_195,"hide");
});
},_190);
},setupToggables:function(_196){
amplafi.ui.applyToClass("toggable",function(node){
if(dojo.html.getElementsByClass("contracted",node).length!=1){
return;
}
if(dojo.html.getElementsByClass("expanded",node).length!=1){
return;
}
var _198=dojo.html.getElementsByClass("contracted",node)[0];
var _199=dojo.html.getElementsByClass("expanded",node)[0];
var _19a=amplafi.html.createNode("span",_199.firstChild,{innerHTML:"[-]",className:"contractSpan"},"before");
dojo.html.hide(_199);
dojo.event.connect(_198,"onclick",function(){
dojo.html.addClass(_198,"hide");
dojo.lfx.fadeShow(_199,400).play();
});
dojo.event.connect(_19a,"onclick",function(){
dojo.html.removeClass(_198,"hide");
dojo.lfx.fadeHide(_199,400).play();
});
},_196);
},notifyOnSubmit:function(node,btn,fn){
node=dojo.byId(node);
while(node.tagName&&node.tagName.toLowerCase()!="form"){
node=node.parentNode;
}
if(node.tagName){
dojo.event.connect(tapestry.form,"submit",function(fId,bId){
if(fId==node.id&&bId==btn){
fn.apply(this,arguments);
}
});
}
},startNavMenu:function(e){
var _1a1=e.target.id+"_bt";
var id=_1a1.substring(0,_1a1.length-3);
var _1a3=dojo.byId(id);
var mn=dojo.byId(id+"_mn");
if(dojo.html.isShowing(mn)&&dojo.html.isDisplayed(mn)){
return false;
}
dojo.html.toggleDisplay(mn);
dojo.html.addClass(_1a3,"a-hovered");
mn.isNew=(typeof e.type=="unknown")?false:(e.type!="mouseover"&&e.type!="focus");
if(!mn.isNew&&document.onclick){
if(document.fireEvent){
document.fireEvent("onclick");
}else{
document.onclick(e);
}
}
mn.outclick=function(e){
if(!this.isNew){
dojo.html.hide(this);
dojo.html.removeClass(_1a3,"a-hovered");
dojo.event.disconnect(document,"onclick",this,"outclick");
}
this.isNew=false;
};
dojo.event.connect(document,"onclick",mn,"outclick");
try{
e.preventDefault();
}
catch(e){
}
return false;
},setupMenu:function(){
var menu=dojo.byId("menu");
var _1a7=dojo.html.getElementsByClassName("menu_head");
for(var i=0;i<_1a7.length;i++){
dojo.event.connect(_1a7[i],"onmouseover",function(e){
e.target._isOver=true;
setTimeout(function(){
if(e.target._isOver){
amplafi.ui.startNavMenu(e);
}
},10);
});
dojo.event.connect(_1a7[i],"onfocus",function(e){
e.target._isOver=true;
setTimeout(function(){
if(e.target._isOver){
amplafi.ui.startNavMenu(e);
}
},10);
});
dojo.event.connect(_1a7[i],"onmouseout",function(e){
e.target._isOver=false;
});
dojo.event.connect(_1a7[i],"onblur",function(e){
e.target._isOver=false;
});
}
var _1ad=function(){
var _1ae=function(item){
dojo.event.connect(item,"onclick",function(e){
dojo.event.browser.stopEvent(e);
amplafi.ui.stopHighlight();
if(document.fireEvent){
document.fireEvent("onclick");
}else{
document.onclick(e);
}
tapestry.bind(e.target.href+"?updateParts=content&updateParts=header");
});
};
dojo.lang.forEach(dojo.byId("nav").getElementsByTagName("a"),_1ae);
dojo.lang.forEach(dojo.byId("toolbar").getElementsByTagName("a"),_1ae);
};
amplafi.util.runIf("ajaxMenu",_1ad);
},setupDecisionNodes:function(_1b1,_1b2,btn){
btn=btn||"finish";
var _1b4=function(node,_1b6){
dojo.html.removeClass(node,"aye");
dojo.html.removeClass(node,"nay");
dojo.html.removeClass(node,"mmm");
if(_1b6){
dojo.html.addClass(node,_1b6);
}
};
dojo.addOnLoad(function(){
var _1b7=dojo.html.getElementsByClassName(_1b1)[0];
dojo.event.connectOnce(_1b7,"onclick",function(e){
var t=e.target;
var _1ba=t.tagName.toLowerCase();
var _1bb=null;
if(_1ba=="option"){
_1bb=t.parentNode.parentNode;
}
if(_1ba=="input"){
_1bb=t.parentNode;
}
if(_1bb&&dojo.html.hasClass(_1bb,_1b2)){
var p=_1bb;
var mess=p.parentNode;
if(!dojo.html.hasClass(mess,"message")){
mess=mess.parentNode;
}
if(t.value==0||t.value=="a"){
_1b4(mess,"aye");
}else{
if(t.value==1||t.value=="r"){
_1b4(mess,"nay");
}else{
if(t.value==2){
_1b4(mess,"mmm");
}else{
_1b4(mess);
}
}
}
if(e.shiftKey&&amplafi._lastClicked){
var _1be=parseInt(t.name.substring(t.name.lastIndexOf("_")+1));
var to=parseInt(amplafi._lastClicked.substring(amplafi._lastClicked.lastIndexOf("_")+1));
if(!_1be&&_1be!=0){
_1be=-1;
}
if(!to&&to!=0){
to=-1;
}
do{
var _1c0=t.form["RadioGroup"+(_1be>=0?"_"+_1be:"")][t.value];
_1c0.checked=true;
mess=_1c0.parentNode.parentNode.parentNode;
if(t.value==0){
_1b4(mess,"aye");
}else{
if(t.value==1){
_1b4(mess,"nay");
}else{
if(t.value==2){
_1b4(mess,"mmm");
}else{
_1b4(mess);
}
}
}
_1be+=(to>_1be?1:to<_1be?-1:0);
}while(to!=_1be);
}
amplafi._lastClicked=t.name;
}
});
amplafi.ui.notifyOnSubmit(_1b7,btn,function(){
var decP=dojo.html.getElementsByClassName(_1b2,_1b7);
dojo.lang.forEach(decP,function(it){
var inps=it.getElementsByTagName("input");
if(inps&&inps.length>0&&(inps[0].checked||inps[1].checked)){
dojo.lfx.fadeHide(it.parentNode);
}
});
});
});
},setupDependent:function(ctrl,_1c5,_1c6,_1c7,_1c8,prop){
if(!_1c8){
_1c8="onchange";
}
if(!prop){
prop="value";
}
ctrl=dojo.byId(ctrl);
_1c5=dojo.byId(_1c5);
var fn=function(e){
dojo.lang.forEach(_1c5.childNodes,function(it){
dojo.html.hide(it);
});
var cur=ctrl[prop];
var _1ce=_1c6[cur];
if(_1ce){
var node=dojo.byId(_1ce);
dojo.html.show(node);
}
if(_1c7){
var inps=ctrl.form.getElementsByTagName("input");
for(var i=0;i<inps.length;i++){
if(inps[i].type=="submit"){
inps[i].disabled=!_1ce;
}
}
}
};
dojo.event.connect(ctrl,_1c8,fn);
fn.apply(this,[]);
},setupAbbr:function(ctrl){
var _1d3=200;
ctrl=dojo.byId(ctrl);
var text=dojo.html.textContent(ctrl);
if(text.length<_1d3){
dojo.html.removeClass(ctrl,"hide");
return;
}
ctrl.style.display="none";
text=text.substring(0,_1d3)+"...<span class=\"cli\" id=\""+ctrl.id+"_more\"> (more) </span>";
var _1d5=amplafi.html.createNode("span",ctrl,{id:ctrl.id+"_less",className:"cli",innerHTML:"(less)"});
var _1d6=amplafi.html.createNode("div",ctrl.parentNode,{id:ctrl.id+"_summary",innerHTML:text});
dojo.event.connect(dojo.byId(ctrl.id+"_more"),"onclick",this,"_toggleAbbr");
dojo.event.connect(_1d5,"onclick",this,"_toggleAbbr");
},_toggleAbbr:function(e){
var ctrl=e.target.id;
var base=ctrl.substring(0,ctrl.length-5);
dojo.html.toggleDisplay(base);
dojo.html.toggleDisplay(base+"_summary");
},setupPopup:function(node,_1db){
_1db=dojo.byId(_1db);
var _1dc=function(){
var vis=!dojo.html.isDisplayed(_1db);
dojo.html.show(_1db);
if(amplafi.ui._openPopup&&amplafi.ui._openPopup!=_1db){
dojo.html.hide(amplafi.ui._openPopup);
}
amplafi.ui._openPopup=vis?_1db:null;
};
dojo.event.connect(dojo.byId(node),"onmousemove",_1dc);
dojo.event.connect(dojo.byId(_1db),"onmouseout",this,"_closePopup");
if(!amplafi.ui._popupManager){
amplafi.ui._popupManager=true;
dojo.event.connect(document,"onclick",this,"_closePopup");
}
},_closePopup:function(e){
var node=e.currentTarget;
if(e.type!="mouseout"&&amplafi.ui._openPopup){
node=amplafi.ui._openPopup;
}
if(node&&!dojo.dom.isDescendantOf(e.target,node,true)){
dojo.html.hide(node);
if(amplafi.ui._openPopup){
dojo.html.hide(amplafi.ui._openPopup);
}
amplafi.ui._openPopup=null;
}
},setupTimeline:function(_1e0){
var _1e1=Timeline.ClassicTheme.create();
_1e1.event.label.width=250;
_1e1.event.bubble.width=350;
_1e1.event.bubble.height=200;
var _1e2=[Timeline.createBandInfo({eventSource:_1e0,width:"70%",intervalUnit:Timeline.DateTime.DAY,intervalPixels:100,timeZone:amplafi.ui._userTimeZone,theme:_1e1}),Timeline.createBandInfo({showEventText:false,trackHeight:0.5,eventSource:_1e0,width:"30%",intervalUnit:Timeline.DateTime.MONTH,timeZone:amplafi.ui._userTimeZone,intervalPixels:200})];
_1e2[1].syncWith=0;
_1e2[1].highlight=true;
return _1e2;
},setupHighlight:function(node,area){
if(!node){
node=amplafi.ui._highlightNode;
if(!node){
node=amplafi.html.createNode("div",document.body,{className:"dashboard-highlight",innerHTML:"<div class=\"tr\"><div class=\"bl\"><div class=\"br\"></div></div></div>"});
amplafi.ui._highlightNode=node;
}
}
node=dojo.byId(node);
var _1e5=node.getElementsByTagName("div");
var _1e6=_1e5[_1e5.length-1];
_1e6.innerHTML="";
node.style.display="block";
node.style.zIndex="10";
_1e6.style.width="0px";
_1e6.style.height="0px";
if(area){
area=dojo.byId(area);
area.style.position="relative";
area.style.zIndex="20";
}
var fn=function(li,_1e9){
if(!li||!li.tagName){
li=amplafi.ui._highlightedNode;
if(!li){
return;
}
}else{
amplafi.ui._highlightedNode=li;
}
var dha=dojo.html.getAbsolutePosition;
var _1eb=5;
var _1ec=dha(node);
var ns=node.style;
ns.left="0px";
ns.top="0px";
var _1ee=dha(li).x-dha(node).x-_1eb;
var _1ef=dha(li).y-dha(node).y-_1eb;
var box=dojo.html.getContentBox(li);
if(!_1e9){
node.style.left=(parseInt(ns.left||0)+_1ee)+"px";
node.style.top=(parseInt(ns.top||0)+_1ef)+"px";
_1e6.style.width=box.width+_1eb+_1eb+"px";
_1e6.style.height=box.height+_1eb+_1eb+"px";
}else{
var _1f1=dojo.html.getContentBox(_1e6);
dojo.lfx.html.propertyAnimation(_1e6,[{property:"width",start:_1f1.width,end:box.width+_1eb+_1eb,unit:"px"},{property:"height",start:_1f1.height,end:box.height+_1eb+_1eb,unit:"px"}]).play();
dojo.lfx.html.propertyAnimation(node,[{property:"left",start:_1ec.x,end:(parseInt(ns.left||0)+_1ee),unit:"px"},{property:"top",start:_1ec.y,end:(parseInt(ns.top||0)+_1ef),unit:"px"}]).play();
}
amplafi.util.runIfNot("skipHighlightAnim",function(){
var lis=amplafi.ui._highlightedNode.parentNode.getElementsByTagName("li");
if(lis&&lis.length>0){
var pos=dojo.lang.find(lis,amplafi.ui._highlightedNode);
pos++;
if(pos>=lis.length){
pos=0;
}
var _1f4=lis[pos];
setTimeout(function(){
if(amplafi.ui._highlightFn){
amplafi.ui._highlightFn(_1f4,true);
}
},25000);
}
});
};
if(amplafi.ui._highlightFn==null){
dojo.event.connect(window,"onresize",amplafi.ui,"_highlightFn");
}
amplafi.ui._highlightFn=fn;
return fn;
},stopHighlight:function(){
amplafi.ui._highlightFn=null;
if(amplafi.ui._highlightNode){
dojo.html.removeNode(amplafi.ui._highlightNode);
amplafi.ui._highlightNode=null;
}
}};
dojo.addOnLoad(amplafi.ui.setupHideables);
dojo.addOnLoad(amplafi.ui.setupToggables);
dojo.provide("amplafi.util");
dojo.provide("amplafi.html");
dojo.require("dojo.io.cookie");
amplafi.flow={start:function(_1f5,_1f6,_1f7){
var _1f8=location.protocol+"//"+location.host+"/flow/"+_1f5;
var _1f9={fsRenderResult:"json"};
for(var key in _1f6){
var _1fb=dojo.json.serialize(_1f6[key]);
_1f9[key]=_1fb;
}
var _1fc={url:_1f8,method:"POST",content:_1f9,useCache:true,preventCache:true,encoding:tapestry.requestEncoding,mimetype:"text/json",error:(function(){
dojo.html.hide("loading");
}),load:(function(e,_1fe){
dojo.html.hide("loading");
var _1ff=_1fe.flowState.fsParameters;
if(_1ff.fsNextFlow){
window.location.href=location.protocol+"//"+location.host+"/flow/"+_1ff.fsNextFlow+"/current";
}else{
window.location.reload();
}
})};
dojo.html.show("loading");
dojo.io.bind(_1fc);
}};
amplafi.html={ie:/MSIE/i.test(navigator.userAgent),appendToHead:function(node){
document.getElementsByTagName("head")[0].appendChild(node);
},addScript:function(src){
var _202=document.createElement("script");
_202.src=src;
_202.type="text/javascript";
this.appendToHead(_202);
},getElementsByTagNames:function(_203,obj){
if(!obj){
var obj=document;
}
var _205=_203.split(",");
var _206=new Array();
for(var i=0;i<_205.length;i++){
var tags=obj.getElementsByTagName(_205[i]);
for(var j=0;j<tags.length;j++){
_206.push(tags[j]);
}
}
var _20a=_206[0];
if(!_20a){
return [];
}
if(_20a.sourceIndex){
_206.sort(function(a,b){
return a.sourceIndex-b.sourceIndex;
});
}else{
if(_20a.compareDocumentPosition){
_206.sort(function(a,b){
return 3-(a.compareDocumentPosition(b)&6);
});
}
}
return _206;
},addStyle:function(node,_210){
for(var key in _210){
key=key=="float"?amplafi.html.ie?"styleFloat":"cssFloat":key;
if(key=="opacity"&&amplafi.html.ie){
amplafi.html.setOpacity(node,_210[key]);
continue;
}
try{
node.style[key]=_210[key];
}
catch(e){
}
}
},setOpacity:function(node,_213){
if(!amplafi.html.ie){
return amplafi.html.addStyle(node,{"opacity":_213});
}
_213*=100;
amplafi.html.addStyle(node,{"filter":"alpha(opacity="+_213+")"});
},createNode:function(_214,_215,_216,_217){
var d=_215.ownerDocument||document;
var node=d.createElement(_214);
if(_216&&_216["type"]){
node.setAttribute("type",_216["type"]);
delete _216["type"];
}
if(_217=="after"){
_215.parentNode.insertBefore(node,_215.nextSibling||null);
}else{
if(_217=="before"){
_215.parentNode.insertBefore(node,_215);
}else{
_215.appendChild(node);
}
}
if(_216){
for(var i in _216){
if(i=="options"){
for(var j in _216[i]){
node.options[node.options.length]=new Option(_216[i][j],j);
}
}else{
if(i=="className"||i=="innerHTML"||i=="onclick"){
node[i]=_216[i];
}else{
if(i=="style"){
amplafi.html.addStyle(node,_216[i]);
}else{
node.setAttribute(i,_216[i]);
}
}
}
}
}
return node;
}};
amplafi.util={actOn:function(node){
node=dojo.byId(node);
if(node.action){
tapestry.form.submitAsync(node);
}else{
if(node.href){
tapestry.linkOnClick(node.href,node.id);
}
}
},attachIndicator:function(node){
node=dojo.byId(node);
if(node){
amplafi.html.createNode("span",node,{innerHTML:"",className:"loading_sm"});
}
},togglePageLoadingIndicator:function(_21e){
if(_21e){
if(dojo.byId("refresh")&&dojo.byId("tipManager")){
dojo.byId("loading").style.position="absolute";
var pos=dojo.html.getAbsolutePosition("refresh");
dojo.html.placeOnScreen("loading",pos.x,pos.y);
dojo.html.setMarginBox("loading",dojo.html.getElementBox("refresh"));
}
dojo.html.show("loading");
}else{
if(dojo.byId("refresh")&&dojo.byId("tipManager")){
}
dojo.html.hide("loading");
}
},findLabelFor:function(node){
node=dojo.byId(node);
var id=node.id;
var form=node.form;
if(form){
var _223=form.getElementsByTagName("label");
for(var i=0;i<_223.length;i++){
if(dojo.html.getAttribute(_223[i],"for")==id){
return _223[i];
}
}
}
return null;
},callWhenInactive:function(obj,fn,time){
if(!time){
time=1000;
}
if(!obj["_amp_ver"]){
obj._amp_ver=1;
}else{
obj._amp_ver++;
}
var cur=obj._amp_ver;
setTimeout(function(){
if(cur==obj._amp_ver){
fn();
}
},time);
},searchPublicFlickr:function(tags,_22a){
if(!_22a){
_22a="flickr";
}
window.jsonFlickrFeed=amplafi.util._displayFlickrResults;
window.jsonFlickrNodeId=_22a;
var _22b=escape(tags);
amplafi.html.addScript("http://flickr.com/services/feeds/photos_public.gne?tags="+_22b+"&format=json");
document.getElementById(_22a).style.display="block";
document.getElementById(_22a).innerHTML="Loading...";
return false;
},searchYouTube:function(tags,_22d){
if(!_22d){
_22d="youtube";
}
window.jsonYouTubeNodeId=_22d;
var _22e=escape(tags);
amplafi.html.addScript("http://gdata.youtube.com/feeds/api/videos?vq="+_22e+"&racy=include&orderby=viewCount&alt=json-in-script&callback=amplafi.util._displayYouTubeResults");
document.getElementById(_22d).style.display="block";
document.getElementById(_22d).innerHTML="Loading...";
return false;
},insertAtCursor:function(_22f,_230){
_22f=dojo.byId(_22f);
if(!dojo.html.isShowing(_22f)||dojo.html.getAbsoluteX(_22f)<0){
var _231=amplafi.util._findDojoEditor();
if(_231){
_231.replaceEditorContent(_231.getEditorContent()+_230);
setTimeout(function(){
_231._updateHeight();
},500);
setTimeout(function(){
_231._updateHeight();
},3000);
}else{
_231=amplafi.util._findTinyMceEditor();
if(_231){
_231.setContent(_231.getContent()+_230);
}
}
return;
}
if(document.selection){
_22f.focus();
var sel=document.selection.createRange();
sel.text=_230;
}else{
if(_22f.selectionStart||_22f.selectionStart=="0"){
var _233=_22f.selectionStart;
var _234=_22f.selectionEnd;
_22f.value=_22f.value.substring(0,_233)+_230+_22f.value.substring(_234,_22f.value.length);
}else{
_22f.value+=_230;
}
}
},processJson:function(type,data,http,_238){
if(data.type=="validation"){
var form=data.form;
var _23a=tapestry.form.forms[form];
if(data.validation){
_23a.formValidation=false;
}else{
_23a.formValidation=true;
}
_23a.formValues=dojo.io.encodeForm(dojo.byId(form));
amplafi.validation.quickValidateForm(dojo.byId(form),_23a,false,true);
}
},processError:function(type,exc,http,_23e){
dojo.event.topic.publish("info",{message:exc.message,type:"WARNING",delay:10000});
},handleWarningStatus:function(msg){
var node=dojo.byId("infoMessagePanel");
if(false&&node){
setTimeout(function(){
node.innerHTML="";
amplafi.html.createNode("div",node,{innerHTML:msg["message"],className:"warn hideable"});
dojo.require("amplafi.ui");
amplafi.ui.setupHideables(node);
},300);
}else{
dojo.event.topic.publish("info",{message:msg["message"],type:"WARNING",delay:6000});
}
},_findDojoEditor:function(){
if(!dojo.widget.Editor2Manager){
return null;
}
var _241=dojo.widget.Editor2Manager.getCurrentInstance();
if(!_241){
var _242=dojo.widget.manager.getWidgetsByType("editor2");
if(_242&&_242.length>0){
_241=_242[0];
}
}
return _241;
},_findTinyMceEditor:function(){
return tinymce?tinymce.EditorManager.activeEditor:null;
},_displayFlickrResults:function(feed){
var z="";
for(var x=0;x<feed.items.length;x++){
var _246=feed.items[x].media.m;
var _247=_246.replace(/_m\.jpg/g,"_s.jpg");
z+="<a href=\""+_246+"\" onclick=\"return amplafi.util._embedImage(this.href);\""+" style=\"border:0\" title=\"Click to embed image\">";
z+="<img src=\""+_247+"\" alt=\"some img\" width=\"75px\" height=\"75px\" style=\"margin: 2px;\">";
z+="</a>";
}
var _248=window.jsonFlickrNodeId||"flickr";
document.getElementById(_248).style.display="block";
document.getElementById(_248).innerHTML=z;
},_displayYouTubeResults:function(root){
var feed=root.feed;
var _24b=feed.entry||[];
var z=[];
for(var x=0;x<_24b.length;x++){
var _24e=_24b[x].title.$t;
var url=_24b[x].media$group.media$thumbnail[0].url;
var _250=_24b[x].media$group.media$content;
if(!_250||_250.length==0){
continue;
}
_250=_250[0].url;
z.push("<div style=\"float:left; clear:none\">");
z.push("<img src=\""+url+"\" alt=\""+_24e+"\" style=\"margin: 2px;\">");
z.push("<div style=\"clear:none; background: white; color: blue;opacity: 0.7;\">");
z.push("<a href=\""+_250+"\" onclick=\"return amplafi.util._playTube(this.href);\" title=\"Click to play video\">PLAY</a> &nbsp; ");
z.push("<a href=\""+_250+"\" onclick=\"return amplafi.util._embedTube(this.href);\" title=\"Click to embed video\">EMBED</a></div>");
z.push("</div>");
}
var _251=window.jsonYouTubeNodeId||"youtube";
document.getElementById(_251).style.display="block";
document.getElementById(_251).innerHTML=z.join("");
},_playTube:function(url){
var ifrm=amplafi.html.createNode("iframe",document.body,{src:url,className:"tubeFrame",style:{display:"none"}});
dojo.lfx.fadeShow(ifrm).play();
setTimeout(function(){
dojo.event.connectOnce(document,"onclick",function(){
dojo.lfx.fadeHide(ifrm,0,1000,function(){
if(ifrm.parentNode){
ifrm.parentNode.removeChild(ifrm);
}
}).play();
});
},1000);
return false;
},_embedTube:function(url){
var text="<object width=\"425\" height=\"344\"><param name=\"movie\" value=\""+url+"\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\""+url+"\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"425\" height=\"344\"></embed></object>";
this.insertAtCursor(document.getElementsByTagName("textarea")[0],text);
return false;
},_embedImage:function(url){
this.insertAtCursor(document.getElementsByTagName("textarea")[0]," <img src=\""+url+"\" /> ");
return false;
},_embedLink:function(url,text){
this.insertAtCursor(document.getElementsByTagName("textarea")[0]," <a href=\""+url+"\">"+text+"</a>");
return false;
},findAndInsertMessageText:function(_259,_25a){
_25a=dojo.byId(_25a);
var text=_25a.parentNode.parentNode.getElementsByTagName("div")[2].innerHTML;
var lbl=text.indexOf("</label>");
if(lbl<0){
lbl=text.indexOf("-->");
}
if(lbl>=0){
text=text.substring(lbl+8);
}
text=text.replace(/&amp;/gm,"&").replace(/&lt;/gm,"<").replace(/&gt;/gm,">").replace(/&quot;/gm,"\"");
this.insertAtCursor(_259,"\n<p>"+text+"</p>\n");
},_fixRelativeImagePaths:function(node){
var imgs=node.getElementsByTagName("img");
dojo.lang.forEach(imgs,function(img){
img.src=img.src;
});
return node;
},createDefaultButtonHandler:function(id){
var _261=dojo.byId(id).form;
tapestry.form.forms[_261.id].defaultButton=id;
dojo.html.addClass(id,"defaultButton");
return function(e){
amplafi.util.fireDefaultButton(e,id);
};
},fireDefaultButton:function(_263,_264){
var src=_263.srcElement||_263.target;
var _266=src.tagName.toLowerCase();
if(_263.keyCode==13&&!(_266=="textarea"||_266=="a"||src.type=="submit"||dojo.html.hasClass(src,"nodefault"))){
tapestry.event.stopEvent(_263);
var no=function(){
};
var btn=dojo.byId(_264);
var ev=dojo.event.browser.fixEvent({currentTarget:btn,preventDefault:no,stopPropagation:no},btn);
if(btn&&!btn.disabled){
if(btn.fireEvent){
btn.fireEvent("onclick");
}else{
if(btn.onclick){
btn.onclick(ev);
}
}
}
}
},submit:function(_26a){
_26a=dojo.byId(_26a);
tapestry.form.submit(_26a.form,_26a.id,{async:true});
},refresh:function(_26b){
_26b=dojo.byId(_26b);
tapestry.form.refresh(_26b.form,_26b.id,{async:true});
},mepCallback:function(args,_26d){
if(!_26d||!_26d.count||_26d.count==0){
return;
}
if(!args){
args=amplafi.openingArgs||{};
}
var _26e=args.componentBuildPath,_26f=args.componentSiteUrl,_270=args.usageComponent;
if(_26e&&amplafi.window&&amplafi.window.callbackForPosition){
var url=_26d.url;
var path;
for(var i in _26d){
if(i.indexOf("ampmep")!=0){
continue;
}
path=_26d[i].path;
if(path){
break;
}
}
if(path){
amplafi.window.callbackForPosition(_26e,_26f,_270,path,url);
}
return;
}
var _274=location.protocol+"//"+location.host+"/flow/EditWebPoints";
var _275=dojo.json.serialize(_26d);
var _276={url:_274,method:"POST",content:{fsRenderResult:"json",mepChanges:_275},useCache:true,preventCache:true,encoding:tapestry.requestEncoding,mimetype:"text/json",error:(function(){
dojo.html.hide("loading");
}),load:(function(e,_278){
dojo.html.hide("loading");
var _279=_278.flowState.fsParameters;
if(_279.fsNextFlow){
window.location.href=location.protocol+"//"+location.host+"/flow/"+_279.fsNextFlow+"/current";
}else{
window.location.reload();
}
})};
dojo.html.show("loading");
dojo.io.bind(_276);
},onContentChanged:function(){
setTimeout(function(){
if(window.SNAP_COM){
if(!SNAP_COM.amp_running){
SNAP_COM.amp_running=true;
SNAP_COM.shot.Rescan();
SNAP_COM.amp_running=false;
}
}
},100);
},_runners:{},runIf:function(key,fn,_27c){
var dic=dojo.io.cookie;
if(location.href.indexOf(key+"=")>0){
if(location.href.indexOf(key+"=false")>0){
dic.setCookie(key,"-",0,"/");
}else{
_27e=true;
dic.setCookie(key,"true",30,"/");
}
}
var _27e=dic.getCookie(key);
if((_27e&&!_27c)||(!_27e&&_27c)){
fn();
_27e=true;
}else{
_27e=false;
}
if(!this._runners[key]){
this._runners[key]={on:_27e&&!_27c};
}
},runIfNot:function(key,fn){
amplafi.util.runIf(key,fn,true);
}};
dojo.event.topic.subscribe("action",function(msg){
setTimeout(function(){
amplafi.util.actOn(msg["message"]);
},3000);
});
dojo.event.topic.subscribe("loading",function(msg){
setTimeout(function(){
amplafi.util.attachIndicator(msg["message"]);
},150);
});
dojo.event.topic.subscribe("redirect",function(msg){
setTimeout(function(){
location.href=msg["message"];
},150);
});
dojo.event.topic.subscribe("close",function(msg){
setTimeout(function(){
if(window.opener){
window.close();
}else{
location.href=msg["message"];
}
},150);
});
dojo.event.topic.subscribe("warn",amplafi.util.handleWarningStatus);
dojo.event.connect(tapestry,"loadJson",amplafi.util,"processJson");
dojo.event.connect(tapestry,"error",amplafi.util,"processError");
dojo.provide("amplafi.widget.TopicCloud");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.uri.Uri");
dojo.require("dojo.html");
dojo.widget.defineWidget("amplafi.widget.TopicCloud",dojo.widget.HtmlWidget,{isContainer:true,templatePath:"",topicCloudCssClass:"tp_topicCloud",topicCssClass:"tp_topicCloud_topic",tagCssClass:"tp_topicCloud_tag",topicSelectedCssClass:"tp_topicCloud_selected",topicUnselectedCssClass:"tp_topicCloud_unselected",topicUnselectedDefaultCssClass:"tp_topicCloud_unselectedDefault",tagSelectedCssClass:"tp_topicCloud_selected",tagUnselectedCssClass:"tp_topicCloud_unselected",mepUnselectedCssClass:"line-through",templateCssPath:dojo.uri.dojoUri("../../../js/amplafi/widget/templates/TopicCloudTemplate.css"),selectedTopicIdsNodeId:"selectedTopicIdsNode",selectedTopicIdsNode:null,defaultTopicId:null,selectedTagsNodeId:"selectedTagsNode",selectedTagsNode:null,selectAllTopicsNode:null,unselectedMepIdsNodeId:"unselectedMepIdsNode",unselectedMepIdsNode:null,selectedMepIdsNodeId:"selectedMepIdsNode",selectedMepIdsNode:null,mepData:null,mepUrlDisplayId:null,_tagListNode:null,_topicListNode:null,_topicNodes:null,postCreate:function(){
this.selectedTopicIdsNode=dojo.byId(this.selectedTopicIdsNodeId);
this.unselectedMepIdsNode=dojo.byId(this.unselectedMepIdsNodeId);
this.selectedMepIdsNode=dojo.byId(this.selectedMepIdsNodeId);
if(this.mepData){
eval("this.mepData="+this.mepData);
this.displayMeps();
}
if(!this.selectedTopicIdsNode){
dojo.debug("selectedTopicIdsNode is not set! Looking for node with id="+this.selectedTopicIdsNodeId);
}
this._topicNodes=this._findAllTopics();
if(this._topicNodes){
dojo.lang.forEach(this._topicNodes,dojo.lang.hitch(this,"addTopicBehavior"));
var _285=this._findTopicListNode();
if(_285){
dojo.event.connect(_285,"onclick",this,"focusFirstTopic");
}
}
this.selectedTagsNode=dojo.byId(this.selectedTagsNodeId);
if(!this.selectedTagsNode){
dojo.debug("selectedTagsNode is not set! Looking for node with id="+this.selectedTagsNodeId);
}
var _286=dojo.html.getElementsByClass(this.tagCssClass,this.domNode);
dojo.lang.forEach(_286,dojo.lang.hitch(this,"addTagBehavior"));
if(this.domNode){
var _287=this.domNode.getElementsByTagName("input");
if(_287.length==2&&dojo.string.endsWith(_287[0].id,"addTag")&&dojo.string.endsWith(_287[1].id,"addTagButton")){
dojo.event.connect(_287[0],"onkeypress",this,"triggerNewTag");
dojo.event.connect(_287[1],"onclick",this,"triggerNewTag");
dojo.event.connect(this._findTagListNode(),"onclick",this,"focusTagInput");
}
}
},addChild:function(){
return null;
},triggerNewTag:function(evt){
var inp=evt.target.id;
if(dojo.string.endsWith(inp,"Button")){
inp=inp.substring(0,inp.length-6);
evt=null;
}
if(!evt||(evt.keyCode||evt.which)==13){
inp=dojo.byId(inp);
this.addNewTag(inp.value,true);
inp.value="";
if(evt){
evt.preventDefault();
}
}
},addTopicBehavior:function(_28a,_28b,pos,ref,_28e){
if(this.disabled){
return;
}
if(dojo.html.hasClass(_28a,this.topicCssClass)){
this._setDeselectedClass(_28a);
dojo.event.kwConnect({srcObj:_28a,srcFunc:"onclick",targetObj:this,targetFunc:"_handleOnTopicClick",once:true});
dojo.event.kwConnect({srcObj:_28a,srcFunc:"onkeypress",targetObj:this,targetFunc:"_handleTopicKey",once:true});
}else{
dojo.raise(_28a+" does not have class "+this.topicCssClass);
}
if(this._getPaddedTopicId(_28a)==" all "){
this.selectAllTopicsNode=_28a;
}
if(this._isTopicSelected(_28a)){
this._setSelectedClass(_28a);
}
},_handleOnTopicClick:function(evt){
var _290=evt.target;
var add=false;
if(this._isTopicSelected(_290)){
this._deselectTopic(_290);
if(this.selectAllTopicsNode&&this._isTopicSelected(this.selectAllTopicsNode)){
this._deselectTopic(this.selectAllTopicsNode);
}
}else{
this._selectTopic(_290);
add=true;
}
if(_290==this.selectAllTopicsNode){
var _292=this._findAllTopics();
dojo.lang.forEach(_292,dojo.lang.hitch(this,add?"_selectTopic":"_deselectTopic"));
}
var self=this;
dojo.lang.forEach(this._topicNodes,function(node){
if(node!=_290&&dojo.html.getAttribute(node,"topicId")==dojo.html.getAttribute(_290,"topicId")){
if(add){
self._setSelectedClass(node);
}else{
self._setDeselectedClass(node);
}
}
});
dojo.debug("selected topic ids now="+this.selectedTopicIdsNode.value);
this.displayMeps();
if(evt.preventDefault){
evt.preventDefault();
}
},_handleTopicKey:function(evt){
if(evt.key==" "){
this._handleOnTopicClick(evt);
}
},_getTopicId:function(_296){
var _297=dojo.html.getAttribute(_296,"topicId");
if(_297==null){
dojo.raise("'topicId' attribute missing from "+_296);
}
return _297;
},_getPaddedTopicId:function(_298){
var _299=this._getTopicId(_298);
return " "+_299+" ";
},handleOnMepClick:function(evt){
var _29b=evt.target.parentNode.getElementsByTagName("a")[0];
if(this._isMepSelected(_29b)){
this._deselectMep(_29b);
}else{
this._selectMep(_29b);
}
if(evt.preventDefault){
evt.preventDefault();
}
},displayMeps:function(){
if(!this.mepData){
return;
}
var _29c=dojo.string.splitEscaped(dojo.string.trim(this.selectedTopicIdsNode.value)," ");
var _29d=[];
for(var mep in this.mepData){
var _29f=this.mepData[mep][0];
var _2a0=this.mepData[mep][1];
var _2a1=this.mepData[mep][2];
var _2a2=this.mepData[mep][3];
for(var i in _29c){
if(dojo.lang.inArray(_2a0,_29c[i])){
var _2a4;
var _2a5;
if(_2a2){
_2a4="<a href=\"#\" title=\"Exclude\" class=\"removeMep\">X</a>";
_2a5="mepOne ext-link";
}else{
_2a4="";
_2a5="mepOneViewOnly ext-link";
}
var _2a6=this.unselectedMepIdsNode.value||"";
if(_2a6.indexOf(_29f)>=0){
_2a5+=" "+this.mepUnselectedCssClass;
}
var _2a7="<a target=\"_blank\" class=\""+_2a5+"\" href=\""+mep+"\" title=\"Visit "+mep+"\" mepId=\""+_29f+"\">"+_2a1+"</a>";
_29d.push("<span class=\"tp_topicCloud_tag tp_topicCloud tp_topicCloud_half\">"+_2a7+_2a4+"</span>");
break;
}
}
}
if(_29d.length>0){
var _2a8=_29d.join(" ");
dojo.byId(this.mepUrlDisplayId).innerHTML=_2a8;
if(!dojo.html.isShowing(this.mepUrlDisplayId)){
dojo.lfx.html.fadeShow(this.mepUrlDisplayId,100).play();
}
}else{
if(dojo.byId(this.mepUrlDisplayId)){
dojo.lfx.html.fadeHide(this.mepUrlDisplayId,100).play();
}
}
amplafi.util.onContentChanged();
var meps=dojo.html.getElementsByClass("removeMep",this.domNode);
for(var j=0;j<meps.length;j++){
dojo.event.connect(meps[j],"onclick",this,"handleOnMepClick");
}
},_getUnselectedMepId:function(_2ab){
var _2ac=dojo.html.getAttribute(_2ab,"mepId");
if(_2ac==null){
dojo.raise("'mepId' attribute missing from "+_2ab);
}
return " "+_2ac+" ";
},messagesErrorCallback:function(_2ad,_2ae,id){
alert(_2ae);
},addTagBehavior:function(_2b0,_2b1,pos,ref,_2b4){
if(this.disabled){
return;
}
if(dojo.html.hasClass(_2b0,this.tagCssClass)){
dojo.html.addClass(_2b0,this.tagUnselectedCssClass);
dojo.html.removeClass(_2b0,this.tagSelectedCssClass);
dojo.event.kwConnect({srcObj:_2b0,srcFunc:"onclick",targetObj:this,targetFunc:"_handleOnTagClick",once:true});
dojo.event.kwConnect({srcObj:_2b0,srcFunc:"onkeypress",targetObj:this,targetFunc:"_handleTagKey",once:true});
}else{
dojo.raise(_2b0+" does not have class "+this.tagCssClass);
}
if(this.selectedTagsNode){
var _2b5=this.selectedTagsNode.value!=null?this.selectedTagsNode.value:"";
var _2b6=this._getPaddedTag(_2b0);
if(_2b5.indexOf(_2b6)>=0){
dojo.html.removeClass(_2b0,this.tagUnselectedCssClass);
dojo.html.addClass(_2b0,this.tagSelectedCssClass);
}
}
},_handleOnTagClick:function(evt){
if(!this.selectedTagsNode){
return;
}
var _2b8=evt.target;
var _2b9=this.selectedTagsNode.value!=null?this.selectedTagsNode.value:"";
var _2ba=this._getPaddedTag(_2b8);
if(_2b9.indexOf(_2ba)>=0){
this.selectedTagsNode.value=_2b9.replace(_2ba,"");
dojo.html.replaceClass(_2b8,this.tagUnselectedCssClass,this.tagSelectedCssClass);
}else{
this.selectedTagsNode.value=_2b9+_2ba;
dojo.html.replaceClass(_2b8,this.tagSelectedCssClass,this.tagUnselectedCssClass);
}
dojo.debug("selected tags now="+this.selectedTagsNode.value);
if(evt.preventDefault){
evt.preventDefault();
}
},_handleTagKey:function(evt){
if(evt.key==" "){
this._handleOnTagClick(evt);
}
},addNewTag:function(_2bc,_2bd){
_2bc=dojo.string.trim(_2bc);
if(dojo.string.isBlank(_2bc)){
this.focusTagInput();
return;
}
var _2be=this.getTagNode(_2bc);
if(_2be){
this.switchTagSelection(_2be);
this.focusTagInput();
return;
}
var a=document.createElement("a");
a.href="#";
a.innerHTML=_2bc;
dojo.html.setClass(a,this.topicCloudCssClass+" "+this.tagCssClass);
a.setAttribute("tagId",_2bc);
var _2c0=this._findTagListNode();
var form=_2c0.getElementsByTagName("div")[0];
_2c0.insertBefore(a,form);
_2c0.insertBefore(document.createTextNode(" "),form);
this.addTagBehavior(a);
if(_2bd){
this.switchTagSelection(a);
}
this.focusTagInput();
},focusTagInput:function(e){
var node=this._findTagListNode();
if(e&&e.target!=node){
return;
}
var inp=dojo.html.getElementsByClass("tagInput",node)[0];
inp.focus();
},focusFirstTopic:function(e){
var node=this._findTopicListNode();
if(e&&e.target!=node){
return;
}
var inp=node.getElementsByTagName("a");
if(inp&&inp.length>0){
inp[0].focus();
}
},getTagNode:function(text){
var _2c9=this._findTagListNode();
var kids=_2c9.getElementsByTagName("a");
var _2cb;
dojo.lang.forEach(kids,function(kid){
var _2cd=dojo.html.getAttribute(kid,"tagId");
if(_2cd==text){
_2cb=kid;
}
},this);
return _2cb;
},switchTagSelection:function(_2ce){
var evt={};
evt.target=_2ce;
this._handleOnTagClick(evt);
},_getPaddedTag:function(_2d0){
var tag=dojo.html.getAttribute(_2d0,"tagId");
if(tag==null){
return "";
}
return tag+"|";
},_findTagListNode:function(){
if(!this._tagListNode){
this._tagListNode=this._findAncestorNode("tagsList");
}
return this._tagListNode;
},_findTopicListNode:function(){
if(!this._topicListNode){
this._topicListNode=this._findAncestorNode("topicsList");
}
return this._topicListNode;
},_findAncestorNode:function(_2d2){
var _2d3=dojo.html.getElementsByClassName(_2d2,this.domNode);
return _2d3.length>0?_2d3[0]:null;
},_findAllTopics:function(){
return dojo.html.getElementsByClass(this.topicCssClass,this.domNode);
},_deselectTopic:function(_2d4){
var _2d5=this.selectedTopicIdsNode.value||"";
var _2d6=this._getPaddedTopicId(_2d4);
if(_2d5.indexOf(_2d6)>=0){
this.selectedTopicIdsNode.value=_2d5.replace(_2d6,"");
this._setDeselectedClass(_2d4);
}
},_selectTopic:function(_2d7){
var _2d8=this.selectedTopicIdsNode.value||"";
var _2d9=this._getPaddedTopicId(_2d7);
if(_2d8.indexOf(_2d9)<0){
this.selectedTopicIdsNode.value=_2d8+_2d9;
this._setSelectedClass(_2d7);
}
},_deselectMep:function(node){
var _2db=this.unselectedMepIdsNode.value||"";
var _2dc=this.selectedMepIdsNode.value||"";
var _2dd=this._getUnselectedMepId(node);
if(_2db.indexOf(_2dd)<0){
this.unselectedMepIdsNode.value=_2db+_2dd;
this.selectedMepIdsNode.value=_2dc.replace(_2dd,"");
dojo.html.addClass(node,this.mepUnselectedCssClass);
}
},_selectMep:function(node){
var _2df=this.unselectedMepIdsNode.value||"";
var _2e0=this.selectedMepIdsNode.value||"";
var _2e1=this._getUnselectedMepId(node);
if(_2df.indexOf(_2e1)>=0){
this.unselectedMepIdsNode.value=_2df.replace(_2e1,"");
this.selectedMepIdsNode.value=_2e0+_2e1;
dojo.html.removeClass(node,this.mepUnselectedCssClass);
}
},_setDeselectedClass:function(_2e2){
var _2e3=dojo.html.getAttribute(_2e2,"unselectedCssClass");
if(_2e3!=null){
dojo.html.addClass(_2e2,_2e3);
}else{
if(this._isDefaultTopic(_2e2)){
dojo.html.addClass(_2e2,this.topicUnselectedDefaultCssClass);
}else{
dojo.html.addClass(_2e2,this.topicUnselectedCssClass);
}
}
dojo.html.removeClass(_2e2,this.topicSelectedCssClass);
},_setSelectedClass:function(_2e4){
var _2e5=dojo.html.getAttribute(_2e4,"unselectedCssClass");
if(_2e5!=null){
dojo.html.removeClass(_2e4,_2e5);
}
dojo.html.removeClass(_2e4,this.topicUnselectedCssClass);
dojo.html.removeClass(_2e4,this.topicUnselectedDefaultCssClass);
dojo.html.addClass(_2e4,this.topicSelectedCssClass);
},_isTopicSelected:function(_2e6){
var _2e7=this.selectedTopicIdsNode.value||"";
return _2e7.indexOf(this._getPaddedTopicId(_2e6))>=0;
},_isDefaultTopic:function(_2e8){
var _2e9=this._getTopicId(_2e8);
var _2ea=this.defaultTopicId==_2e9;
return _2ea;
},_isMepSelected:function(node){
return !dojo.html.hasClass(node,this.mepUnselectedCssClass);
}},"html");
dojo.provide("amplafi.widget.MessagePointCloud");
dojo.require("dojo.widget.HtmlWidget");
dojo.require("dojo.uri.Uri");
dojo.widget.defineWidget("amplafi.widget.MessagePointCloud",dojo.widget.HtmlWidget,{isContainer:true,templatePath:"",mepUnselectedCssClass:"line-through",templateCssPath:dojo.uri.dojoUri("../../../js/amplafi/widget/templates/TopicCloudTemplate.css"),unselectedMepIdsNodeId:"unselectedMepIdsNode",unselectedMepIdsNode:null,selectedMepIdsNodeId:"selectedMepIdsNode",selectedMepIdsNode:null,selectedCategories:null,mepData:null,mepUrlDisplayId:null,postCreate:function(){
this.unselectedMepIdsNode=dojo.byId(this.unselectedMepIdsNodeId);
this.selectedMepIdsNode=dojo.byId(this.selectedMepIdsNodeId);
if(this.mepData){
eval("this.mepData="+this.mepData);
}
if(this.selectedCategories){
eval("this.selectedCategories="+this.selectedCategories);
}
this.displayMeps();
},handleOnMepClick:function(evt){
var _2ed=evt.target.parentNode.getElementsByTagName("a")[0];
if(this._isMepSelected(_2ed)){
this._deselectMep(_2ed);
}else{
this._selectMep(_2ed);
}
if(evt.preventDefault){
evt.preventDefault();
}
},displayMeps:function(){
if(!this.mepData){
return;
}
var _2ee=[];
for(var mep in this.mepData){
var _2f0=this.mepData[mep][0];
var _2f1=this.mepData[mep][1];
var _2f2=this.mepData[mep][2];
var _2f3=this.mepData[mep][3];
for(var i in this.selectedCategories){
if(dojo.lang.inArray(_2f1,this.selectedCategories[i])){
var _2f5;
var _2f6;
if(_2f3){
_2f5="<a href=\"#\" title=\"Exclude\" class=\"removeMep\">X</a>";
_2f6="mepOne ext-link";
}else{
_2f5="";
_2f6="mepOneViewOnly ext-link";
}
var _2f7=this.unselectedMepIdsNode.value||"";
if(_2f7.indexOf(_2f0)>=0){
_2f6+=" "+this.mepUnselectedCssClass;
}
var _2f8="<a target=\"_blank\" class=\""+_2f6+"\" href=\""+mep+"\" title=\"Visit "+mep+"\" mepId=\""+_2f0+"\">"+_2f2+"</a>";
_2ee.push("<span class=\"tp_topicCloud_tag tp_topicCloud tp_topicCloud_half\">"+_2f8+_2f5+"</span>");
break;
}
}
}
if(_2ee.length>0){
var _2f9=_2ee.join(" ");
dojo.byId(this.mepUrlDisplayId).innerHTML=_2f9;
if(!dojo.html.isShowing(this.mepUrlDisplayId)){
dojo.lfx.html.fadeShow(this.mepUrlDisplayId,100).play();
}
}else{
dojo.lfx.html.fadeHide(this.mepUrlDisplayId,100).play();
}
amplafi.util.onContentChanged();
var meps=dojo.html.getElementsByClass("removeMep",this.domNode);
for(var j=0;j<meps.length;j++){
dojo.event.connect(meps[j],"onclick",this,"handleOnMepClick");
}
},_getUnselectedMepId:function(_2fc){
var _2fd=dojo.html.getAttribute(_2fc,"mepId");
if(_2fd==null){
dojo.raise("'mepId' attribute missing from "+_2fc);
}
return " "+_2fd+" ";
},_deselectMep:function(node){
var _2ff=this.unselectedMepIdsNode.value||"";
var _300=this.selectedMepIdsNode.value||"";
var _301=this._getUnselectedMepId(node);
if(_2ff.indexOf(_301)<0){
this.unselectedMepIdsNode.value=_2ff+_301;
this.selectedMepIdsNode.value=_300.replace(_301,"");
dojo.html.addClass(node,this.mepUnselectedCssClass);
}
},_selectMep:function(node){
var _303=this.unselectedMepIdsNode.value||"";
var _304=this.selectedMepIdsNode.value||"";
var _305=this._getUnselectedMepId(node);
if(_303.indexOf(_305)>=0){
this.unselectedMepIdsNode.value=_303.replace(_305,"");
this.selectedMepIdsNode.value=_304+_305;
dojo.html.removeClass(node,this.mepUnselectedCssClass);
}
},_isMepSelected:function(node){
return !dojo.html.hasClass(node,this.mepUnselectedCssClass);
},messagesErrorCallback:function(_307,_308,id){
alert(_308);
}},"html");
dojo.provide("dojo.validate");
dojo.require("dojo.validate.common");
dojo.provide("amplafi.widget.BookmarkCloud");
dojo.require("dojo.widget.HtmlWidget");
dojo.widget.defineWidget("amplafi.widget.BookmarkCloud",dojo.widget.HtmlWidget,{bookmarks:[],isContainer:true,textControl:null,linksNode:null,templateString:"<div style=\"display:none\"><span dojoAttachPoint=\"handle\" class=\"cli popdown\">Resources</span>"+"<div dojoAttachPoint=\"linksNode\" style=\"display:none;position:absolute;border-left:1px solid #eee;border-bottom:1px solid #eee;background:white;padding:4px;\"></div></div>",timer:new dojo.lang.timing.Timer(1000),allowIP:false,maxLength:30,addBookmark:function(_30a){
for(var i=0;i<this.bookmarks.length;i++){
if(this.bookmarks[i].href==_30a){
this.bookmarks[i].remove=false;
return false;
}
}
this.bookmarks.push(this.createBookmark(_30a));
return true;
},createBookmark:function(_30c){
var obj={href:_30c,remove:false};
if(_30c.indexOf("http://flickr.com")==0||_30c.indexOf("http://www.flickr.com")==0){
obj.loading=true;
var _30e={url:"http://flickr.com/services/oembed?format=json&url="+encodeURIComponent(_30c),transport:"ScriptSrcTransport",error:(function(){
obj.loading=false;
}),mimetype:"text/json",load:(function(){
obj.loading=false;
})};
dojo.io.bind(_30e);
}
return obj;
},storeBookmarks:function(_30f){
dojo.lang.forEach(this.bookmarks,function(it){
it.remove=true;
});
dojo.lang.forEach(_30f,dojo.lang.hitch(this,"addBookmark"));
for(var i=0;i<this.bookmarks.length;i++){
if(this.bookmarks[i].remove){
this.bookmarks.splice(i,1);
}
}
},findLinks:function(text){
var _313=text.split(" ");
var _314=[];
var func=this.shouldAccept;
var _316=this.allowIP;
dojo.lang.forEach(_313,function(word){
if(func(word)&&dojo.validate.isUrl(word,{allowIP:_316})){
if(word.indexOf("://")<0){
word="http://"+word;
}
_314.push(word);
}
});
return _314;
},shouldAccept:function(word){
return word.indexOf("http://")==0||word.indexOf("https://")==0;
},processText:function(){
var text=this.textControl.value;
var all=this.findLinks(text);
this.storeBookmarks(all);
this.redraw();
this.timer.stop();
},redraw:function(){
var html="";
dojo.lang.forEach(this.bookmarks,function(b){
if(!b.remove){
html+="<a href='"+b.href+"' title='"+b.href+"' target='_blank'>"+dojo.string.summary(b.href,this.maxLength)+"</a>";
if(b.loading){
html+="<span class='loading_sm'> </span>";
}
if(b.oembed){
html+="<br/><span>"+b.oembed.title+" by "+b.oembed.author_name+"</span>";
}
html+="<br/>";
}
});
this.linksNode.innerHTML=html;
if(this.bookmarks.length>0){
if(!dojo.html.isShowing(this.domNode)){
dojo.lfx.html.fadeShow(this.domNode,300).play();
}
}
},scheduleProcessing:function(){
if(!this.timer.isRunning){
this.timer.start();
}
},onRefresh:function(e){
this.processText();
if(e){
e.preventDefault();
}
},toggleDetails:function(e){
dojo.html.toggleShowing(this.linksNode);
},postCreate:function(){
this.textControl=dojo.byId(this.textControl);
dojo.event.connect(this.textControl,"onkeydown",this,"scheduleProcessing");
dojo.event.connect(this.handle,"onclick",this,"toggleDetails");
this.timer.onTick=dojo.lang.hitch(this,"processText");
this.processText();
}},"html");
dojo.provide("dojo.widget.Toaster");
dojo.require("dojo.widget.*");
dojo.require("dojo.lfx.*");
dojo.require("dojo.html.iframe");
dojo.widget.defineWidget("dojo.widget.Toaster",dojo.widget.HtmlWidget,{templateString:"<div dojoAttachPoint=\"clipNode\"><div dojoAttachPoint=\"containerNode\" dojoAttachEvent=\"onClick:onSelect\"><div dojoAttachPoint=\"contentNode\"></div></div></div>",templateCssPath:dojo.uri.moduleUri("dojo.widget","templates/Toaster.css"),messageTopic:"",messageTypes:{MESSAGE:"MESSAGE",WARNING:"WARNING",ERROR:"ERROR",FATAL:"FATAL"},defaultType:"MESSAGE",clipCssClass:"dojoToasterClip",containerCssClass:"dojoToasterContainer",contentCssClass:"dojoToasterContent",messageCssClass:"dojoToasterMessage",warningCssClass:"dojoToasterWarning",errorCssClass:"dojoToasterError",fatalCssClass:"dojoToasterFatal",positionDirection:"br-up",positionDirectionTypes:["br-up","br-left","bl-up","bl-right","tr-down","tr-left","tl-down","tl-right"],showDelay:2000,postCreate:function(){
this.hide();
dojo.html.setClass(this.clipNode,this.clipCssClass);
dojo.html.addClass(this.containerNode,this.containerCssClass);
dojo.html.setClass(this.contentNode,this.contentCssClass);
if(this.messageTopic){
dojo.event.topic.subscribe(this.messageTopic,this,"_handleMessage");
}
if(!this.positionDirection||!dojo.lang.inArray(this.positionDirectionTypes,this.positionDirection)){
this.positionDirection=this.positionDirectionTypes.BRU;
}
},_handleMessage:function(msg){
if(dojo.lang.isString(msg)){
this.setContent(msg);
}else{
this.setContent(msg["message"],msg["type"],msg["delay"]);
}
},setContent:function(msg,_321,_322){
var _322=_322||this.showDelay;
if(this.slideAnim&&this.slideAnim.status()=="playing"){
dojo.lang.setTimeout(50,dojo.lang.hitch(this,function(){
this.setContent(msg,_321);
}));
return;
}else{
if(this.slideAnim){
this.slideAnim.stop();
if(this.fadeAnim){
this.fadeAnim.stop();
}
}
}
if(!msg){
dojo.debug(this.widgetId+".setContent() incoming content was null, ignoring.");
return;
}
if(!this.positionDirection||!dojo.lang.inArray(this.positionDirectionTypes,this.positionDirection)){
dojo.raise(this.widgetId+".positionDirection is an invalid value: "+this.positionDirection);
}
dojo.html.removeClass(this.containerNode,this.messageCssClass);
dojo.html.removeClass(this.containerNode,this.warningCssClass);
dojo.html.removeClass(this.containerNode,this.errorCssClass);
dojo.html.removeClass(this.containerNode,this.fatalCssClass);
dojo.html.clearOpacity(this.containerNode);
if(msg instanceof String||typeof msg=="string"){
this.contentNode.innerHTML=msg;
}else{
if(dojo.html.isNode(msg)){
this.contentNode.innerHTML=dojo.html.getContentAsString(msg);
}else{
dojo.raise("Toaster.setContent(): msg is of unknown type:"+msg);
}
}
switch(_321){
case this.messageTypes.WARNING:
dojo.html.addClass(this.containerNode,this.warningCssClass);
break;
case this.messageTypes.ERROR:
dojo.html.addClass(this.containerNode,this.errorCssClass);
break;
case this.messageTypes.FATAL:
dojo.html.addClass(this.containerNode,this.fatalCssClass);
break;
case this.messageTypes.MESSAGE:
default:
dojo.html.addClass(this.containerNode,this.messageCssClass);
break;
}
this.show();
var _323=dojo.html.getMarginBox(this.containerNode);
if(this.positionDirection.indexOf("-up")>=0){
this.containerNode.style.left=0+"px";
this.containerNode.style.top=_323.height+10+"px";
}else{
if(this.positionDirection.indexOf("-left")>=0){
this.containerNode.style.left=_323.width+10+"px";
this.containerNode.style.top=0+"px";
}else{
if(this.positionDirection.indexOf("-right")>=0){
this.containerNode.style.left=0-_323.width-10+"px";
this.containerNode.style.top=0+"px";
}else{
if(this.positionDirection.indexOf("-down")>=0){
this.containerNode.style.left=0+"px";
this.containerNode.style.top=0-_323.height-10+"px";
}else{
dojo.raise(this.widgetId+".positionDirection is an invalid value: "+this.positionDirection);
}
}
}
}
this.slideAnim=dojo.lfx.html.slideTo(this.containerNode,{top:0,left:0},450,null,dojo.lang.hitch(this,function(_324,anim){
dojo.lang.setTimeout(dojo.lang.hitch(this,function(evt){
if(this.bgIframe){
this.bgIframe.hide();
}
this.fadeAnim=dojo.lfx.html.fadeOut(this.containerNode,1000,null,dojo.lang.hitch(this,function(evt){
this.hide();
})).play();
}),_322);
})).play();
},_placeClip:function(){
var _328=dojo.html.getScroll();
var view=dojo.html.getViewport();
var _32a=dojo.html.getMarginBox(this.containerNode);
this.clipNode.style.height=_32a.height+"px";
this.clipNode.style.width=_32a.width+"px";
if(this.positionDirection.match(/^t/)){
this.clipNode.style.top=_328.top+"px";
}else{
if(this.positionDirection.match(/^b/)){
this.clipNode.style.top=(view.height-_32a.height-2+_328.top)+"px";
}
}
if(this.positionDirection.match(/^[tb]r-/)){
this.clipNode.style.left=(view.width-_32a.width-1-_328.left)+"px";
}else{
if(this.positionDirection.match(/^[tb]l-/)){
this.clipNode.style.left=0+"px";
}
}
this.clipNode.style.clip="rect(0px, "+_32a.width+"px, "+_32a.height+"px, 0px)";
if(dojo.render.html.ie){
if(!this.bgIframe){
this.bgIframe=new dojo.html.BackgroundIframe(this.containerNode);
this.bgIframe.setZIndex(this.containerNode);
}
this.bgIframe.onResized();
this.bgIframe.show();
}
},onSelect:function(e){
},show:function(){
dojo.widget.Toaster.superclass.show.call(this);
this._placeClip();
if(!this._scrollConnected){
this._scrollConnected=true;
dojo.event.connect(window,"onscroll",this,"_placeClip");
}
},hide:function(){
dojo.widget.Toaster.superclass.hide.call(this);
if(this._scrollConnected){
this._scrollConnected=false;
dojo.event.disconnect(window,"onscroll",this,"_placeClip");
}
dojo.html.setOpacity(this.containerNode,1);
}});
dojo.provide("amplafi.widget.TipManager");
dojo.require("dojo.widget.HtmlWidget");
dojo.widget.defineWidget("amplafi.widget.TipManager",dojo.widget.Toaster,{templateString:"<div dojoAttachPoint=\"clipNode\"><div dojoAttachPoint=\"containerNode\" dojoAttachEvent=\"onClick:onSelect\">"+"<div dojoAttachPoint=\"contentNode\"></div><div dojoAttachEvent=\"onClick:onClose\" class=\"dojoToasterClose\" title=\"Close\"><span>x</span></div></div></div>",tipNode:null,showingTip:0,total:2,showDelay:6000,clipCssClass:"tipToasterClip",previousTip:function(e){
if(e){
e.preventDefault();
}
var ul=this.tipNode.getElementsByTagName("ul")[0];
var lis=ul.getElementsByTagName("li");
for(var i=lis.length-1;i>=0;i--){
if(dojo.html.isShowing(lis[i])||i==0){
this.showingTip=(i==0)?lis.length-1:i-1;
this._doTipTransition(lis[i],lis[this.showingTip]);
break;
}
}
return false;
},nextTip:function(e){
if(e){
e.preventDefault();
}
var ul=this.tipNode.getElementsByTagName("ul")[0];
var lis=ul.getElementsByTagName("li");
for(var i=0;i<lis.length;i++){
if(dojo.html.isShowing(lis[i])||i==lis.length-1){
this.showingTip=(i==lis.length-1)?0:i+1;
this._doTipTransition(lis[i],lis[this.showingTip]);
break;
}
}
return false;
},_setupTips:function(){
var lis=this.tipNode.getElementsByTagName("li");
this.total=lis.length;
this.showingTip=parseInt(Math.random()*this.total);
dojo.lfx.html.fadeShow(lis[this.showingTip],100).play();
},addTip:function(data){
if(typeof (data)=="string"){
data={id:Math.random(),message:data};
}
var _336=this.showingTip;
var lis=this.tipNode.getElementsByTagName("li");
this.showingTip=this.total;
var _338=dojo.html.createNodesFromText("<li style=\"display:none\">"+data.message+"</li>")[0];
this.tipNode.getElementsByTagName("ul")[0].appendChild(_338);
this.total++;
this._doTipTransition(lis[_336],lis[this.showingTip]);
this.setContent(data.message);
},_doTipTransition:function(_339,_33a){
dojo.lfx.chain(dojo.lfx.html.fadeHide(_339,200),dojo.lfx.html.fadeShow(_33a,200)).play();
},removeTip:function(data){
dojo.debug("remove",data);
},addInfo:function(){
this._handleMessage.apply(this,arguments);
},addInfoFromUrl:function(url){
var _33d=this;
dojo.io.bind({url:url,load:function(e,data){
_33d._handleMessage.apply(_33d,[{message:data,delay:60000}]);
}});
},onClose:function(e){
this.fadeAnim=dojo.lfx.html.fadeOut(this.containerNode,100,null,dojo.lang.hitch(this,function(evt){
this.hide();
})).play();
},_handleMessage:function(){
var msg=arguments[0];
if(dojo.html.isNode(msg)){
arguments[0]=tapestry.html.getElementAsString(msg);
}
amplafi.widget.TipManager.superclass._handleMessage.apply(this,arguments);
},setContent:function(){
var msg=arguments[0];
if(dojo.html.isNode(msg)){
arguments[0]=tapestry.html.getElementAsString(msg);
}
amplafi.widget.TipManager.superclass.setContent.apply(this,arguments);
},postCreate:function(){
amplafi.widget.TipManager.superclass.postCreate.call(this);
this.positionDirection="tr-down";
this.tipNode=dojo.byId(this.tipNode);
if(this.tipNode){
var _344=dojo.html.getElementsByClassName("prev",this.tipNode)[0];
var _345=dojo.html.getElementsByClassName("next",this.tipNode)[0];
dojo.event.connect(_344,"onclick",this,"previousTip");
dojo.event.connect(_345,"onclick",this,"nextTip");
dojo.event.topic.subscribe("tips-add",this,"addTip");
dojo.event.topic.subscribe("tips-remove",this,"removeTip");
this._setupTips();
}
dojo.event.topic.subscribe("info",this,"addInfo");
},_placeClip:function(){
var _346=dojo.html.getScroll();
var view=dojo.html.getViewport();
var rel=this.tipNode?this.tipNode.parentNode:this.domNode.parentNode;
var _349=dojo.html.getAbsolutePosition(rel);
var _34a=dojo.html.getPaddingBox(rel);
var _34b=_349.y+_34a.height-4;
var _34c=dojo.html.getContentBox(this.containerNode);
var _34d=(_349.x+_34a.width-_34c.width)-2;
var _34e=(_34b>0)?_346.top+_34b:_346.top;
if(!this.tipNode){
_34d-=16;
}
this.clipNode.style.width=_34c.width+"px";
this.clipNode.style.top=_34e+"px";
this.clipNode.style.left=_34d+"px";
this.clipNode.style.clip="rect(0px, "+_34c.width+"px, "+_34c.height+"px, 0px)";
if(dojo.render.html.ie){
if(!this.bgIframe){
this.bgIframe=new dojo.html.BackgroundIframe(this.containerNode);
this.bgIframe.setZIndex(this.containerNode);
}
this.bgIframe.onResized();
this.bgIframe.show();
}
var _34f=dojo.html.getAbsolutePosition(this.clipNode);
var offX=_34f.x-_34d;
var offY=_34f.y-_34e+_346.top;
this.clipNode.style.left=(_34d-offX)+"px";
this.clipNode.style.top=(_34e-offY+4)+"px";
}});
dojo.provide("amplafi.widget.MapField");
dojo.require("dojo.widget.HtmlWidget");
dojo.widget.defineWidget("amplafi.widget.MapField",dojo.widget.HtmlWidget,{isContainer:true,ymapUrl:"http://api.maps.yahoo.com/ajaxymap?v=3.7",apiKey:"fRhpGYrV34GK7jK4fUydUIo772jtpaCd118z7.Hmrr.0X1LwBluGv9Y4oLbOwST74PQ-",fullUrl:null,textControl:null,map:null,lastSearch:null,setupTextNode:function(self){
if(!self){
self=this;
}
if(window.YMap){
self.domNode.innerHTML="";
var _353=this.textControl.value;
var map=new YMap(self.domNode);
map.addTypeControl();
map.addZoomLong();
map.setMapType(YAHOO_MAP_HYB);
if(!_353||_353.length==0){
map.drawZoomAndCenter(new YGeoPoint(0,-30),17);
}else{
map.drawZoomAndCenter(_353,8);
}
self.map=map;
dojo.event.connect(self.textControl,"onblur",self,"doSearch");
YEvent.Capture(map,"onEndGeoCode",this.onSearchResult);
}else{
setTimeout(function(){
self.setupTextNode(self);
},500);
}
},doSearch:function(){
var text=this.textControl.value;
if(this.lastSearch!=text){
this.lastSearch=text;
this.map.drawZoomAndCenter(text);
}
},onSearchResult:function(obj){
if(!obj.success){
return;
}
if(obj.GeoPoint){
var _357=new YMarker(obj.GeoPoint);
YEvent.Capture(_357,EventsList.MouseClick,function(){
_357.openSmartWindow("<b>"+obj.Address+"</b><br/> <i>"+obj.GeoPoint.Lat+", "+obj.GeoPoint.Lon+"</i>");
});
obj.ThisMap.addOverlay(_357);
}
},postCreate:function(){
this.fullUrl=this.ymapUrl+"&appid="+this.apiKey;
this.textControl=dojo.byId(this.textControl);
this.loadYahooScripts();
this.setupTextNode();
},loadYahooScripts:function(){
if(window.YAHOO){
return;
}
var __dw=document.write;
document._yui_loaded=[];
document.write=function(s){
var fi=s.indexOf("\"");
var se=s.indexOf("\"",fi+1);
if(se>fi){
document._yui_loaded.push(s.substring(fi+1,se));
}
if(s.indexOf("ymapapi")>0){
document.write=__dw;
}
};
amplafi.html.addScript(this.fullUrl);
(function(_35c){
if(!document["_yui_loaded"]||document._yui_loaded.length<2){
setTimeout(arguments.callee,300);
}else{
for(var i=0;i<document._yui_loaded.length;i++){
amplafi.html.addScript(document._yui_loaded[i]);
}
}
})(this);
}});
dojo.provide("amplafi.widget.PopDown");
dojo.require("dojo.widget.PopupContainer");
dojo.widget.defineWidget("amplafi.widget.PopDown",dojo.widget.PopupContainer,{trigger:null,hover:false,className:null,position:null,url:null,clientId:null,remoteReads:0,postCreate:function(){
if(this.className){
dojo.html.setClass(this.domNode,this.className);
}
if(this.position&&this.position=="left"){
this.position={"BR":"TR"};
}else{
this.position={"BL":"TL"};
}
if(this.trigger){
this.trigger=dojo.byId(this.trigger);
dojo.event.connect(this.trigger,"onclick",this,"onPop");
if(this.hover){
dojo.event.connect(this.trigger,"onmousemove",this,"onPop");
}
}
},destroy:function(_35e){
this.destroyChildren();
this.uninitialize();
this.destroyRendering(_35e);
dojo.widget.manager.removeById(this.widgetId);
},onPop:function(e){
if(e){
dojo.event.browser.stopEvent(e);
}
if(this.isShowingNow){
}else{
this.open(this.trigger,this.trigger,[],this.position);
if(this.url&&this.remoteReads<1){
var _360=this.domNode;
var kids=_360.getElementsByTagName("div");
if(kids&&kids.length>0){
_360=kids[0];
}
var _362=amplafi.html.createNode("div",_360,{style:{width:"100px",height:"50px"}});
amplafi.util.attachIndicator(_362);
tapestry.linkOnClick(this.url,this.clientId);
this.remoteReads++;
}
}
},open:function(x,y,_365,_366,_367,_368){
if(this.isShowingNow){
return;
}
if(this.animationInProgress){
this.queueOnAnimationFinish.push(this.open,arguments);
return;
}
this.aboutToShow();
var _369=false,node,_36b;
if(typeof x=="object"){
node=x;
_36b=_366;
_366=_365;
_365=y;
_369=true;
}
this.parent=_365;
_366=_366||_365["domNode"]||[];
var _36c=null;
this.isTopLevel=true;
while(_365){
if(_365!==this&&(_365.setOpenedSubpopup!=undefined&&_365.applyPopupBasicStyle!=undefined)){
_36c=_365;
this.isTopLevel=false;
_36c.setOpenedSubpopup(this);
break;
}
_365=_365.parent;
}
this.parentPopup=_36c;
this.popupIndex=_36c?_36c.popupIndex+1:1;
if(this.isTopLevel){
var _36d=dojo.html.isNode(_366)?_366:null;
dojo.widget.PopupManager.opened(this,_36d);
}
if(this.isTopLevel&&!dojo.withGlobal(this.openedForWindow||dojo.global(),dojo.html.selection.isCollapsed)){
this._bookmark=dojo.withGlobal(this.openedForWindow||dojo.global(),dojo.html.selection.getBookmark);
}else{
this._bookmark=null;
}
if(_366 instanceof Array){
_366={left:_366[0],top:_366[1],width:0,height:0};
}
if(_369){
this.move(node,_368,_36b);
}else{
this.move(x,y,_368,_367);
}
this.explodeSrc=_366;
this.show();
this.isShowingNow=true;
}});
dojo.kwCompoundRequire({common:["amplafi.widget.TopicCloud","amplafi.widget.MessagePointCloud","amplafi.widget.BookmarkCloud","amplafi.widget.TipManager","amplafi.widget.MapField","amplafi.widget.PopDown"]});
dojo.provide("amplafi.widget.*");
