Error.summary=function summary(_1){
var _2=new Array();
try{
_2.push(_1.message);
if(_1.level==MapBuzz.Message.UNEXPECTED_ERROR){
if(_1.number){
_2.push(": ");
_2.push(_1.number);
}
if(_1.fileName){
_2.push("\n");
_2.push("at uri: ");
_2.push(_1.fileName);
_2.push(": ");
_2.push(_1.lineNumber);
}
}
}
catch(e){
}
return _2.join("");
};
Error.traceback=function traceback(_3){
return _3.stack||Function.callStack();
};
var InheritanceMixin={getSuper:function(_4){
var _5=this.getConstructor();
if(_4===_5){
return _5.superConstructor;
}
var _6=_5._superCache[_4];
if(_6){
return _6;
}
if(this instanceof _4){
_6=this.findConstructor(_5,_4);
}else{
_6=this.findMethod(_5,_4);
}
if(!_6){
throw new Error("Could not find super method for: "+_4.toString()+".");
}
this.getConstructor()._superCache[_4]=_6;
return _6;
},callSuper:function(){
if(arguments.length<1){
throw new Error("The method applySuper takes a minimum of two arguments");
}
var _7=arguments[0];
var _8=this.getSuper(_7);
var _9=arguments.length-1;
var _a=new Array(_9);
for(var i=0;i<_9;i++){
_a[i]=arguments[i+1];
}
return _8.apply(this,_a);
},applySuper:function(){
if(arguments.length!=1){
throw new Error("The method applySuper takes only one argument.");
}
var _c=arguments[0];
var _d=_c.callee;
var _e=this.getSuper(_d);
return _e.apply(this,_c);
},findConstructor:function currentConstructor(_f,_10){
while(_f){
if(_10===_f){
return _f.superConstructor;
}else{
_f=_f.superConstructor;
}
}
return null;
},findMethod:function(_11,_12){
while(_11){
var _13=_11.prototype;
for(var key in _13){
if(_13[key]===_12&&_13.hasOwnProperty(key)){
return _11.superConstructor.prototype[key];
}
}
_11=_11.superConstructor;
}
return null;
}};
if(typeof Function=="undefined"){
Function={};
}
Function.inherits=function inherits(_15,_16){
if(!_15){
throw new Error("Must specify constructor.  Called from "+arguments.callee.caller);
}
if(!_16){
throw new Error("Must specify super constructor.  Called from "+arguments.callee.caller);
}
var _17=function(){
};
_17.prototype=_16.prototype;
_15.prototype=new _17();
_15._superCache=new Object();
Object.extend(_15.prototype,InheritanceMixin);
_15.prototype.getConstructor=function(){
return _15;
};
_15.prototype.constructor=_15;
_15.superConstructor=_16;
};
if(Function.prototype){
Function.prototype.inherits=function inherits(_18){
Function.inherits(this,_18);
};
}
Object.mixin=function(_19,_1a){
for(var _1b in _1a){
if(_1b=="included"){
continue;
}
_19[_1b]=_1a[_1b];
}
if(_1a.included){
_1a.included.call(_19,_19);
}
return _19;
};
function MbNamespace(_1c,_1d){
this.parentNamespace=_1c;
this.name=_1d;
this.parentNamespace[this.name]=this;
}
Object.extend(MbNamespace,{findNamespace:function(_1e,_1f){
for(var i=0;i<_1f.length;i++){
var _21=_1f[i];
var _22=_1e[_21];
if(_22!=null){
_1e=_22;
}else{
var _23=new MbNamespace(_1e,_21);
_1e=_23;
}
}
return _1e;
}});
Object.extend(MbNamespace.prototype,{qualifiedName:function(){
if(this.parentNamespace.qualifiedName){
var _24=this.parentNamespace.qualifiedName();
return _24+"."+this.name;
}else{
return this.name;
}
},toString:function(){
return "[Namespace: "+this.qualifiedName()+"]";
}});
function namespace(_25){
var _26=_25.split(".");
return MbNamespace.findNamespace(window,_26);
}
namespace("MapBuzz.Namespace");
Object.extend(MapBuzz.Namespace,{NAMESPACES:new HashTable(),PREFIXES:new HashTable(),MAPBUZZ_NAMESPACE_PREFIX:"mb",MAPBUZZ_NAMESPACE_URI:"http://www.mapbuzz.com",XHTML_NAMESPACE_PREFIX:"xhtml",XHTML_NAMESPACE_URI:"http://www.w3.org/1999/xhtml",register:function(_27,uri){
MapBuzz.Namespace.PREFIXES[_27]=uri;
MapBuzz.Namespace.NAMESPACES[uri]=_27;
},initialize:function(_29){
if(!Browser.instance.isIE()){
return;
}
var _2a=MapBuzz.Namespace.PREFIXES.keys();
var _2b=[];
for(var i=0;i<_2a.length;i++){
var _2d=_2a[i];
var uri=MapBuzz.Namespace.PREFIXES[_2d];
var _2f="xmlns:"+_2d+"=\""+uri+"\"";
_2b.push(_2f);
}
_29.setProperty("SelectionNamespaces",_2b.join(" "));
}});
MapBuzz.Namespace.register(MapBuzz.Namespace.MAPBUZZ_NAMESPACE_PREFIX,MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI);
MapBuzz.Namespace.register(MapBuzz.Namespace.XHTML_NAMESPACE_PREFIX,MapBuzz.Namespace.XHTML_NAMESPACE_URI);
MapBuzz.Namespace.Resolver=function NamespacerResolver(_30){
this.node=_30;
this.defaultResolver=document.createNSResolver(_30);
};
Object.extend(MapBuzz.Namespace.Resolver.prototype,{lookupNamespaceURI:function(_31){
var _32=this.defaultResolver.lookupNamespaceURI(_31);
if(!_32&&_31&&_31!="xmlns"){
_32=MapBuzz.Namespace.PREFIXES[_31];
}
return _32;
}});
Function.prototype.bindWithArgs=Function.prototype.bind;
Function.prototype.bind=function bind(){
if(arguments.length>1){
return this.bindWithArgs.apply(this,arguments);
}else{
var _33=this;
var _34=arguments[0];
return function(){
return _33.apply(_34,arguments);
};
}
};
Function.prototype.bindAsEventListenerWithArgs=Function.prototype.bindAsEventListener;
Function.prototype.bindAsEventListener=function bindAsEventListener(_35){
if(arguments.length>1){
return this.bindAsEventListenerWithArgs.apply(this,arguments);
}else{
var _36=this;
var _37=arguments[0];
return function(_38){
return _36.call(_37,_38||window.event);
};
}
};
Math.degreesToRadians=function(_39){
return _39*(Math.PI/180);
};
Math.radiansToDegrees=function(_3a){
return _3a*(180/Math.PI);
};
Math.log10=function(x){
return Math.LOG10E*Math.log(x);
};
Math.log2=function(x){
return Math.LOG2E*Math.log(x);
};
Array.prototype.include=function include(_3d){
return (this.indexOf(_3d)!=-1);
};
Array.prototype.remove=function remove(_3e){
var _3f=null;
var _40=this.indexOf(_3e);
if(_40!=-1){
_3f=this[_40];
this.splice(_40,1);
}
return _3f;
};
Array.prototype.top=function top(){
if(this.length>0){
return this[this.length-1];
}else{
return null;
}
};
Array.prototype.subtract=function subtract(_41){
for(var i=0;i<_41.length;i++){
var _43=_41[i];
this.remove(_43);
}
return this;
};
function NotImplementedError(){
var _44="Method not implemented.";
if(NotImplementedError.caller){
var _45=NotImplementedError.caller.toString();
var _46=_45.match(/function\s*(\w*)\s*\(/);
if(_46){
_44="Method not implemented: "+_46[1]+".";
}
}
throw new Error(_44);
}
document.isXHTML=function(){
var _47=false;
if(document.doctype){
_47=(document.doctype.publicId.match(/xhtml/i)!=null);
}
return _47;
};
document.getHeadElement=function(){
return document.getElementsByTagName("head")[0];
};
document.getBodyElement=function(){
return document.body||document.getElementsByTagName("body")[0];
};
document.insertElement=function(_48,_49,_4a,_4b){
var _4c=Element.create(_49);
_4a=_4a||new Object();
for(var key in _4a){
_4c.setAttribute(key,_4a[key]);
}
if(_49.match(/script/i)){
_4b=" ";
}
if(_4b){
if((_4c.canHaveChildren!=null&&_4c.canHaveChildren==false)||(_49.match(/style/i)&&Browser.instance.isSafari())){
_4c.text=_4b;
}else{
_4c.innerHTML=_4b;
}
}
_48.appendChild(_4c);
return _4c;
};
if(!document.removeNode){
Document.prototype.removeNode=Element.prototype.removeNode=function removeNode(_4e){
if(!_4e){
while(this.hasChildNodes()){
this.parentNode.appendChild(this.firstChild);
}
}
this.parentNode.removeChild(this);
};
}
if(document.isXHTML()){
document.write=function(_4f){
var _50=_4f.match(/^<(\w*)(.*)>(.*)<\/\1>/);
var _51=_50[1];
var _52=document.splitAttributes(_50[2]);
var _53=_50[3];
var _54=null;
if(_51.match(/(script|style)/)){
_54=document.getHeadElement();
}else{
_54=document.getBodyElement();
}
document.insertElement(_54,_51,_52,_53);
};
document.splitAttributes=function(_55){
var _56=new Object();
var _57=_55.match(/\w+\s*=\s*(['"]).+?\1/g);
for(var i=0;i<_57.length;i++){
var _59=_57[i];
var _5a=_59.match(/(\w+)\s*=\s*(['"])(.+?)\2/);
var key=_5a[1].strip();
var _5c=_5a[3].strip();
_56[key]=_5c;
}
return _56;
};
}
Object.extend(Element,{create:function(_5d){
var _5e=null;
if(document.isXHTML()){
_5e=document.createElementNS(MapBuzz.Namespace.XHTML_NAMESPACE_URI,_5d);
}else{
_5e=document.createElement(_5d);
}
return _5e;
},text:function(_5f){
_5f=$(_5f);
if(_5f.textContent){
return _5f.textContent;
}else{
if(_5f.innerText){
return _5f.innerText;
}else{
return _5f.innerHTML;
}
}
},setText:function(_60,_61){
_60=$(_60);
if(_60.textContent){
return _60.textContent=_61;
}else{
if(_60.innerText){
return _60.innerText=_61;
}
}
}});
Object.extend(Form.Element,{reset:function(_62){
_62=$(_62);
_62.value="";
_62.className="";
}});
String.prototype.splitURI=function splitURI(){
var _63=new Object();
var _64=new RegExp("([a-zA-Z][0-9a-zA-Z+so\\-\\.]*:)?/{0,2}([0-9a-zA-Z\\._~]+)/([0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?");
var _65=this.match(_64);
_63.scheme=_65[1];
_63.server=_65[2];
_63.path=_65[3];
return _63;
};
String.prototype.camelize=function camelize(_66){
var _67="";
var _68=this.split(/[-_]/);
for(var i=0;i<_68.length;i++){
_67+=_68[i].charAt(0).toUpperCase()+_68[i].substring(1);
}
if(!_66&&!this.charAt(0).match(/[-_]/)){
_67=_67.charAt(0).toLowerCase()+_67.substring(1);
}
return _67;
};
String.prototype.underscore=function underscore(){
return this.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/[ -]/g,"_").toLowerCase();
};
String.prototype.escapeHTML=function escapeHTML(){
return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");
};
String.prototype.unescapeHTML=function unescapeHTML(){
return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,"\"");
};
String.prototype.humanize=function humanize(){
return this.replace(/_id$/g,"").replace(/_/g," ").capitalize();
};
function HashTable(_6a){
if(_6a){
for(var key in _6a){
this[key]=_6a[key];
}
}
}
HashTable.fromQueryString=function(_6c){
var _6d=new HashTable();
if(_6c.length>0&&(_6c[0]=="?"||_6c[0]=="#")){
_6c=_6c.substr(1);
}
if(_6c.length==0){
return _6d;
}
var _6e=_6c.split(/&/);
for(var i=0;i<_6e.length;i++){
var _70=_6e[i].split(/\s*=\s*/);
var key=decodeURIComponent(_70[0]);
var _72=decodeURIComponent(_70[1]);
_6d[key]=_72;
}
return _6d;
};
HashTable.prototype.includes=function includes(key){
if(key=="includes"||key=="keys"||key=="values"||key=="merge"||key=="copy"||key=="toQueryString"||key=="toString"||key=="toObject"||this.hasOwnProperty(key)==false){
return false;
}else{
return true;
}
};
HashTable.prototype.keys=function keys(){
var _74=[];
for(var key in this){
if(this.includes(key)){
_74.push(key);
}
}
return _74;
};
HashTable.prototype.values=function values(){
var _76=[];
for(var key in this){
if(this.includes(key)){
_76.push(this[key]);
}
}
return _76;
};
HashTable.prototype.copy=function copy(){
var _78=new HashTable();
for(var key in this){
if(this.includes(key)){
_78[key]=this[key];
}
}
return _78;
};
HashTable.prototype.merge=function merge(_7a){
if(!_7a){
throw new Error("Must specify other hash table");
}
var _7b=_7a.keys();
for(var i=0;i<_7b.length;i++){
var key=_7b[i];
this[key]=_7a[key];
}
return this;
};
HashTable.prototype.toQueryString=function toQueryString(){
var _7e=this.keys();
var _7f=[];
for(var i=0;i<_7e.length;i++){
var key=encodeURIComponent(_7e[i]);
var _82=encodeURIComponent(this[key]);
_7f.push(key+"="+_82);
}
return _7f.join("&");
};
HashTable.prototype.toObject=function toObject(){
var _83={};
var _84=this.keys();
for(var i=0;i<_84.length;i++){
var key=_84[i];
var _87=this[key];
_83[key]=_87;
}
return _83;
};
HashTable.prototype.toString=function toString(){
var _88=this.keys();
var _89=[];
for(var i=0;i<_88.length;i++){
var key=_88[i];
var _8c=this[key];
_89.push(key+"="+_8c);
}
return ("HashTable ["+_89.join(", ")+"]");
};
namespace("MapBuzz.Command");
MapBuzz.Command.Error=function CommandError(_8d){
this.name="Command Error";
this.message=_8d;
};
MapBuzz.Command.Error.prototype.toString=function toString(){
return this.message;
};
MapBuzz.Command.Canceled=function CommandCanceled(){
this.name="Command Canceled";
this.message="You canceled the command";
};
Object.extend(MapBuzz.Command.Canceled.prototype,window.ErrorMixin);
MapBuzz.Command.Canceled.prototype.toString=function toString(){
return this.message;
};
MapBuzz.Command.AbstractCommand=function AbstractCommand(_8e,_8f){
this.name=_8e;
this.nextCommand=null;
if(!_8f){
this.oldExecute=this.execute;
this.execute=this.wrap(this.execute,this.executeNext);
this.oldFail=this.fail;
this.fail=this.wrap(this.fail,this.failNext);
}
};
Object.extend(MapBuzz.Command.AbstractCommand.prototype,{copy:function(){
var _90=null;
if(this.nextCommand){
_90=this.nextCommand.copy();
}
var _91=new Object();
Object.extend(_91,this);
_91.nextCommand=_90;
return _91;
},next:function(_92){
if(this.nextCommand){
return this.nextCommand.next(_92);
}else{
this.nextCommand=_92;
return _92;
}
},unshift:function(_93){
_93.next(this);
return _93;
},remove:function(_94){
if(this.nextCommand===_94){
this.nextCommand=null;
}else{
if(this.nextCommand){
this.nextCommand.remove(_94);
}
}
},execute:function(){
},fail:function(){
},wrap:function(_95,_96){
return function(){
var _97=null;
try{
_97=_95.apply(this,arguments);
var _98=_97?[_97]:arguments;
return _96.apply(this,_98);
}
catch(e){
if(typeof e=="string"){
e=new Error(e);
}
if(_95!==this.oldFail){
return this.fail(e);
}else{
throw e;
}
}
};
},executeNext:function(){
if(this.nextCommand){
return this.nextCommand.execute.apply(this.nextCommand,arguments);
}else{
if(arguments.length==0){
return null;
}else{
if(arguments.length==1){
return arguments[0];
}else{
var _99=[];
for(var i=0;i<arguments.length;i++){
_99.push(arguments[0]);
}
return _99;
}
}
}
},failNext:function(){
var _9b=arguments[0];
if(this.nextCommand){
this.nextCommand.fail.apply(this.nextCommand,arguments);
}else{
if(_9b instanceof MapBuzz.Command.Canceled){
}else{
_9b.level=(_9b.level||MapBuzz.Message.UNEXPECTED_ERROR);
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:Error.summary(_9b),level:_9b.level,stack:Error.traceback(_9b)});
}
}
},endCommand:function(){
if(!this.nextCommand){
return this;
}else{
return this.nextCommand.endCommand();
}
},internalToString:function(){
var _9c=null;
if(this.nextCommand){
_9c=this.name+" -> "+this.nextCommand.internalToString();
}else{
_9c=this.name;
}
return _9c;
}});
MapBuzz.Command.AbstractCommand.prototype.toString=function toString(){
return "Command ["+this.internalToString()+"]";
};
MapBuzz.Command.Empty=function EmptyCommand(){
this.callSuper(MapBuzz.Command.Empty,"Empty");
};
Function.inherits(MapBuzz.Command.Empty,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.Empty.prototype,{execute:function(){
}});
MapBuzz.Command.Empty.prototype.toString=function toString(){
return "EmptyCommand ["+this.internalToString()+"]";
};
MapBuzz.Command.Functor=function CommandFunctor(_9d,_9e){
Object.extend(this,_9e);
this.callSuper(MapBuzz.Command.Functor,_9d);
};
Function.inherits(MapBuzz.Command.Functor,MapBuzz.Command.AbstractCommand);
MapBuzz.Command.Functor.prototype.toString=function toString(){
return "FunctorCommand ["+this.internalToString()+"]";
};
MapBuzz.Command.Bind=function BindFunctor(_9f,_a0){
Object.extend(this,{execute:_a0});
this.callSuper(MapBuzz.Command.Bind,_9f);
};
Function.inherits(MapBuzz.Command.Bind,MapBuzz.Command.AbstractCommand);
MapBuzz.Command.Bind.prototype.toString=function toString(){
return "BindCommand ["+this.internalToString()+"]";
};
MapBuzz.Command.MultiFunctor=function MultiCommandFunctor(_a1,_a2){
Object.extend(this,_a2);
this.callSuper(MapBuzz.Command.MultiFunctor,_a1);
};
Function.inherits(MapBuzz.Command.MultiFunctor,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.MultiFunctor.prototype,{wrap:function(_a3,_a4){
return function(){
var _a5=null;
try{
_a5=_a3.apply(this,arguments);
var _a6=_a5?_a5:arguments;
return _a4.apply(this,_a6);
}
catch(e){
if(_a3!==this.fail){
return this.fail(e);
}
}
};
}});
MapBuzz.Command.MultiFunctor.prototype.toString=function toString(){
return "MultiFunctor ["+this.internalToString()+"]";
};
MapBuzz.Command.Databus=function DatabusCommand(key,_a8){
this.callSuper(MapBuzz.Command.Databus,"Databus");
this.key=key;
this.data=_a8;
};
Function.inherits(MapBuzz.Command.Databus,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.Databus.prototype,{execute:function(){
MapBuzz.databus.send(this,this.key,this.data);
}});
MapBuzz.Command.Message=function MessageCommand(_a9,_aa){
this.callSuper(MapBuzz.Command.Message,"Message");
this.key=MapBuzz.Message.MESSAGE;
this.data={message:_a9,level:_aa};
};
Function.inherits(MapBuzz.Command.Message,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.Message.prototype,{execute:function(){
MapBuzz.databus.send(this,this.key,this.data);
}});
MapBuzz.Command.UpdateElement=function UpdateElementCommand(_ab){
this.element=_ab;
this.callSuper(MapBuzz.Command.UpdateElement,"Update Element");
};
Function.inherits(MapBuzz.Command.UpdateElement,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.UpdateElement.prototype,{execute:function(_ac){
var _ad=$(this.element);
Element.update(_ad,_ac);
return _ad;
},fail:function(_ae){
var _af=$(this.element);
Element.update(_af,_ae.message);
}});
MapBuzz.Command.ReplaceElement=function ReplaceElementCommand(_b0){
this.element=_b0;
this.callSuper(MapBuzz.Command.ReplaceElement,"Replace Element");
};
Function.inherits(MapBuzz.Command.ReplaceElement,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.ReplaceElement.prototype,{execute:function(_b1){
var _b2=$(this.element);
Element.replace(_b2,_b1);
return _b2;
},fail:function(_b3){
var _b4=$(this.element);
Element.replace(_b4,_b3.message);
}});
MapBuzz.Command.InsertElement=function InsertElementCommand(_b5,_b6){
this.element=_b5;
this.insertion=_b6;
this.callSuper(MapBuzz.Command.InsertElement,"Insert Element");
};
Function.inherits(MapBuzz.Command.InsertElement,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.InsertElement.prototype,{execute:function(_b7){
var _b8=$(this.element);
new this.insertion(_b8,_b7);
}});
MapBuzz.Command.Build=function CommandBuild(){
var _b9=arguments[0];
var _ba=arguments[0];
for(var i=1;i<arguments.length;i++){
_ba=_ba.next(arguments[i]);
}
return _b9;
};
MapBuzz.Command.Chain=function Chain(){
var _bc=[];
for(var i=0;i<arguments.length;i++){
_bc.push(arguments[i]);
}
var _be=_bc.shift();
this.setupCommands(_bc);
this.callSuper(MapBuzz.Command.Chain,_be);
};
Function.inherits(MapBuzz.Command.Chain,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Command.Chain.prototype,{setupCommands:function(_bf){
this.startCommand=this.endCommand=_bf[0];
for(var i=1;i<_bf.length;i++){
this.endCommand=this.endCommand.next(_bf[i]);
}
},execute:function(){
this.startCommand.execute.apply(this.startCommand,arguments);
},next:function(_c1){
this.endCommand=this.endCommand.next(_c1);
return this.endCommand;
},unshift:function(_c2){
_c2.next(this.startCommand);
this.startCommand=_c2;
},remove:function(_c3){
this.startCommand.remove(_c3);
},internalToString:function(){
return this.startCommand.internalToString();
}});
MapBuzz.Command.Chain.prototype.toString=function toString(){
return "ChainCommand ["+this.internalToString()+"]";
};
namespace("MapBuzz.Databus");
Object.extend(MapBuzz.Databus,{DESTINATION_TARGET:"dest_target",DESTINATION_PROXY:"dest_proxy",SOURCE_TARGET:"src_target",SOURCE_PROXY:"src_proxy",MESSAGE:"message"});
MapBuzz.Databus.Message=function Message(_c4,_c5,_c6){
if(!_c4){
throw new Error("Must specify message source");
}
if(!_c5){
throw new Error("Must specify message type");
}
this.source=_c4;
this.type=_c5;
this.data=_c6;
};
Object.extend(MapBuzz.Databus.Message,{fromJSON:function(_c7){
_c7="("+_c7+")";
_c7=eval(_c7);
return new MapBuzz.Databus.Message(null,_c7.type,_c7.data);
}});
Object.extend(MapBuzz.Databus.Message.prototype,{toJSON:function(){
var _c8={type:this.type,data:this.data};
return Object.toJSON(_c8);
}});
MapBuzz.Databus.Message.prototype.toString=function toString(){
var _c9="Message [source: "+this.source+" \n"+"type: "+this.type+" \n";
for(var key in this.data){
var _cb=this.data[key];
_c9+=key+": "+_cb+"\n";
}
_c9+="]";
return _c9;
};
MapBuzz.Databus.Bus=function Bus(){
this.forwarders=[];
this.listeners={};
};
Object.extend(MapBuzz.Databus.Bus.prototype,{getListeners:function(_cc){
var _cd=this.listeners[_cc];
if(!_cd){
_cd=this.listeners[_cc]=[];
}
return _cd;
},registerListener:function(_ce,_cf){
if(!_ce){
throw new Error("Must specify message type");
}
if(!_cf){
throw new Error("Must specify listener function");
}
var _d0=this.getListeners(_ce);
_d0.push(_cf);
return _cf;
},unregisterListener:function(_d1,_d2){
if(!_d1){
throw new Error("Must specify message type");
}
if(!_d2){
throw new Error("Must specify a listener function");
}
var _d3=this.getListeners(_d1);
var _d4=_d3.remove(_d2);
if(!_d4){
throw new Error("Could not find registered listener.  Type: "+_d1+".");
}
},sendMessage:function(_d5){
var _d6=[];
var _d7=this.getListeners(_d5.type);
_d7=_d7.concat(this.forwarders);
for(var i=0;i<_d7.length;i++){
try{
var _d9=_d7[i](_d5);
if(_d9&&_d9 instanceof Array){
_d6=_d6.concat(_d9);
}else{
_d6.push(_d9);
}
}
catch(error){
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:Error.summary(error),level:MapBuzz.Message.UNEXPECTED_ERROR,stack:Error.traceback(error)});
}
}
return _d6;
},send:function(_da,_db,_dc){
var _dd=new MapBuzz.Databus.Message(_da,_db,_dc);
return this.sendMessage(_dd);
},request:function(_de,_df,_e0){
var _e1=new MapBuzz.Databus.Message(_de,_df,_e0);
var _e2=this.sendMessage(_e1);
if(_e2.length==0){
return null;
}else{
if(_e2.length>1){
throw new Error("Too many results returned");
}else{
return _e2[0];
}
}
},requestAll:function(_e3,_e4,_e5){
var _e6=new MapBuzz.Databus.Message(_e3,_e4,_e5);
return this.sendMessage(_e6);
}});
MapBuzz.Databus.CrossFrameRouter=function CrossFrameRouter(_e7,_e8){
this.messageType=_e7;
this.deliverer=_e8;
this.initialize();
};
Object.extend(MapBuzz.Databus.CrossFrameRouter,{hasPostMessage:function(){
if(window.postMessage||document.postMessage){
return true;
}else{
return false;
}
}});
Object.extend(MapBuzz.Databus.CrossFrameRouter.prototype,{initialize:function(){
this.registerListeners();
},release:function(){
this.unregisterListeners();
},registerListeners:function(){
this.listener=MapBuzz.databus.registerListener(this.messageType,function(_e9){
this.deliverer.post(_e9);
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.SelectionManager.SELECT,this.listener);
}});
MapBuzz.Databus.Frame=function DatabusFrame(uri){
this.uri=uri;
this.createFrame();
};
Object.extend(MapBuzz.Databus.Frame.prototype,{createFrame:function(){
this.frame=document.createElement("iframe");
this.frame.style.display="none";
document.getBodyElement().appendChild(this.frame);
this.setSrc(this.uri);
},releaseFrame:function(){
if(this.frame){
this.frame.parentNode.removeChild(this.frame);
}
this.frame=null;
},setSrc:function(uri){
this.frame.src=uri;
}});
MapBuzz.Databus.FrameMessage=function DatabusFrameMessage(_ec){
this.frame=_ec;
};
Object.extend(MapBuzz.Databus.FrameMessage.prototype,{post:function(_ed){
_ed={_id:(new Date()).getTime(),type:_ed.type,data:_ed.data};
var _ee=encodeURIComponent("("+Object.toJSON(_ed)+")");
this.frame.setSrc(this.frame.uri+"#"+_ee);
}});
MapBuzz.Databus.PostMessage=function DatabusPostMessage(_ef){
if(window.postMessage){
this.receiver=_ef;
}else{
if(document.postMessage){
this.receiver=_ef.document;
}else{
throw new Error("Browser does not support postMessage");
}
}
};
Object.extend(MapBuzz.Databus.PostMessage.prototype,{post:function(_f0){
_f0={_id:(new Date()).getTime(),type:_f0.type,data:_f0.data};
var _f1="("+Object.toJSON(_f0)+")";
this.receiver.postMessage(_f1);
}});
MapBuzz.databus=new MapBuzz.Databus.Bus();
function Browser(){
this.figureBrowser();
this.figureVersion();
}
Object.extend(Browser,{Camino:"camino",ICab:"icab",Iceweasel:"Iceweasel",IE:"msie",Epiphany:"epiphany",Firefox:"firefox",GranParadiso:"GranParadiso",Gecko:"gecko",Konqueror:"konqueror",Mozilla:"mozilla",Netscape:"netscape",Opera:"opera",Safari:"safari",Seamonkey:"seamonkey",Webkit:"applewebkit",Unknown:"unknown"});
Object.extend(Browser.prototype,{figureBrowser:function(){
this.agentString=window.navigator.userAgent;
if(window.opera){
this.agent=Browser.Opera;
}else{
if(window.attachEvent){
this.agent=Browser.IE;
}else{
var _f2=[Browser.Safari,Browser.Epiphany,Browser.Firefox,Browser.Netscape,Browser.Camino,Browser.Konqueror,Browser.Seamonkey,Browser.ICab,Browser.Webkit,Browser.Iceweasel,Browser.Gecko,Browser.Mozilla,Browser.IE];
for(var i=0;i<_f2.length;i++){
var _f4=new RegExp(_f2[i],"i");
if(this.agentString.match(_f4)){
this.agent=_f2[i];
break;
}
}
}
}
if(!this.agent){
this.agent=Browser.Unknown;
}
},figureVersion:function(){
var _f5=new RegExp(this.agent+"[ /]?([0-9]+).?([0-9]+)?","i");
var _f6=this.agentString.match(_f5);
if(_f6){
this.majorVersion=Number(_f6[1]);
this.minorVersion=Number(_f6[2]);
}
},isICab:function(){
return this.agent==Browser.ICab;
},isCamino:function(){
return (this.agent==Browser.Camino);
},isIE:function(){
return this.agent==Browser.IE;
},isFirefox:function(){
return this.agent==Browser.Firefox;
},isGecko:function(){
return (this.agent==Browser.Gecko||this.agent==Browser.Camino||this.agent==Browser.Firefox||this.agent==Browser.Netscape||this.agent==Browser.Epiphany||this.agent==Browser.Seamonkey);
},isGranParadiso:function(){
return (this.agent==Browser.GranParadiso);
},isKonqueror:function(){
return this.agent==Browser.Konqueror;
},isMozilla:function(){
return this.agent==Browser.Mozilla;
},isNetscape:function(){
return this.agent==Browser.Netscape;
},isOpera:function(){
return this.agent==Browser.Opera;
},isSafari:function(){
return this.agent==Browser.Safari;
},isSeamonkey:function(){
return this.agent==Browser.Seamonkey;
},isWebkit:function(){
return (this.agent==Browser.Webkit||this.agent==Browser.Safari);
},isUnknown:function(){
return this.agent==Browser.Unknown;
}});
Browser.prototype.toString=function toString(){
return "Browser ["+"Agent: "+this.agent+"; "+"MajorVersion: "+this.majorVersion+"; "+"MinorVersion: "+this.minorVersion+"; "+"AgentString: "+this.agentString+"]";
};
Browser.instance=new Browser();
MapBuzz.Loader=function MapBuzzLoader(){
this.initialize();
};
Object.extend(MapBuzz.Loader,{CONTENT_LOADED:"CONTENT_LOADED",WINDOW_LOADED:"WINDOW_LOADED"});
Object.extend(MapBuzz.Loader.prototype,{initialize:function(){
this.contentLoaded=false;
this.windowLoaded=false;
this.loadHandler=this.onLoad.bindAsEventListener(this);
Event.observe(window,"load",this.loadHandler);
if(Browser.instance.isIE()){
this.initializeIE();
}else{
if(Browser.instance.isSafari()){
this.initializeSafari();
}else{
this.initializeDomContentLoaded();
}
}
},release:function(){
Event.stopObserving(window,"load",this.loadHandler);
this.loadHandler=null;
if(this.contenHandler){
Event.stopObserving(window,"DOMContentLoaded",this.contentHandler);
this.contenHandler=null;
}
},initializeDomContentLoaded:function(){
this.contentHandler=this.onContent.bindAsEventListener(this);
Event.observe(window,"DOMContentLoaded",this.contentHandler);
},initializeSafari:function(){
this.timer=window.setInterval(function(){
if(/loaded|complete/.test(document.readyState)){
window.clearInterval(this.timer);
this.onContent();
}
}.bind(this),100);
},initializeIE:function(){
var _f7=this;
document.write("<script id=__onDOMContentLoaded defer src=//:></script>");
$("__onDOMContentLoaded").onreadystatechange=function(){
if(this.readyState=="complete"){
$("__onDOMContentLoaded").onreadystatechange=null;
}
};
},onContent:function(_f8){
if(!this.contentLoaded){
MapBuzz.databus.send(this,MapBuzz.Loader.CONTENT_LOADED,{event:_f8});
}
this.contentLoaded=true;
},onLoad:function(_f9){
if(!this.contentLoaded){
this.onContent(_f9);
}
this.windowLoaded=true;
MapBuzz.databus.send(this,MapBuzz.Loader.WINDOW_LOADED,{event:_f9});
},registerListener:function(_fa,_fb){
var _fc=null;
if(_fa==MapBuzz.Loader.CONTENT_LOADED&&this.contentLoaded){
_fc=new MapBuzz.Databus.Message(this,_fa);
_fb(_fc);
}else{
if(_fa==MapBuzz.Loader.WINDOW_LOADED&&this.windowLoaded){
_fc=new MapBuzz.Databus.Message(this,_fa);
_fb(_fc);
}else{
MapBuzz.databus.registerListener(_fa,_fb);
}
}
}});
MapBuzz.Loader.instance=new MapBuzz.Loader();
Date.ext={};
Date.ext.util={};
Date.ext.util.xPad=function(x,pad,r){
if(typeof (r)=="undefined"){
r=10;
}
for(;parseInt(x,10)<r&&r>1;r/=10){
x=pad.toString()+x;
}
return x.toString();
};
Date.prototype.locale="en-GB";
if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){
Date.prototype.locale=document.getElementsByTagName("html")[0].lang;
}
Date.ext.locales={};
Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};
Date.ext.locales["en-US"]=Date.ext.locales.en;
Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";
Date.ext.locales["en-US"].x="%D";
Date.ext.locales["en-US"].X="%r";
Date.ext.locales["en-GB"]=Date.ext.locales.en;
Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];
Date.ext.formats={a:function(d){
return Date.ext.locales[d.locale].a[d.getDay()];
},A:function(d){
return Date.ext.locales[d.locale].A[d.getDay()];
},b:function(d){
return Date.ext.locales[d.locale].b[d.getMonth()];
},B:function(d){
return Date.ext.locales[d.locale].B[d.getMonth()];
},c:"toLocaleString",C:function(d){
return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0);
},d:["getDate","0"],e:["getDate"," "],g:function(d){
return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0);
},G:function(d){
var y=d.getFullYear();
var V=parseInt(Date.ext.formats.V(d),10);
var W=parseInt(Date.ext.formats.W(d),10);
if(W>V){
y++;
}else{
if(W===0&&V>=52){
y--;
}
}
return y;
},H:["getHours","0"],I:function(d){
var I=d.getHours()%12;
return Date.ext.util.xPad(I===0?12:I,0);
},j:function(d){
var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");
ms+=d.getTimezoneOffset()*60000;
var doy=parseInt(ms/60000/60/24,10)+1;
return Date.ext.util.xPad(doy,0,100);
},l:function(d){
var l=d.getHours()%12;
return Date.ext.util.xPad(l===0?12:l," ");
},m:function(d){
return Date.ext.util.xPad(d.getMonth()+1,0);
},M:["getMinutes","0"],p:function(d){
return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0];
},P:function(d){
return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0];
},S:["getSeconds","0"],u:function(d){
var dow=d.getDay();
return dow===0?7:dow;
},U:function(d){
var doy=parseInt(Date.ext.formats.j(d),10);
var rdow=6-d.getDay();
var woy=parseInt((doy+rdow)/7,10);
return Date.ext.util.xPad(woy,0);
},V:function(d){
var woy=parseInt(Date.ext.formats.W(d),10);
var _11c=(new Date(""+d.getFullYear()+"/1/1")).getDay();
var idow=woy+(_11c>4||_11c<=1?0:1);
if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){
idow=1;
}else{
if(idow===0){
idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"));
}
}
return Date.ext.util.xPad(idow,0);
},w:"getDay",W:function(d){
var doy=parseInt(Date.ext.formats.j(d),10);
var rdow=7-Date.ext.formats.u(d);
var woy=parseInt((doy+rdow)/7,10);
return Date.ext.util.xPad(woy,0,10);
},y:function(d){
return Date.ext.util.xPad(d.getFullYear()%100,0);
},Y:"getFullYear",z:function(d){
var o=d.getTimezoneOffset();
var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);
var M=Date.ext.util.xPad(o%60,0);
return (o>0?"-":"+")+H+":"+M;
},Z:function(d){
return d.toString().replace(/^.*\(([^)]+)\)$/,"$1");
},"%":function(d){
return "%";
}};
Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};
Date.ext.aggregates.z=Date.ext.formats.z(new Date());
Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());
Date.ext.unsupported={};
Date.prototype.strftime=function(fmt){
if(!(this.locale in Date.ext.locales)){
if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){
this.locale=this.locale.replace(/-[a-zA-Z]+$/,"");
}else{
this.locale="en-GB";
}
}
var d=this;
while(fmt.match(/%[cDhnrRtTxXzZ]/)){
fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){
var f=Date.ext.aggregates[m1];
return (f=="locale"?Date.ext.locales[d.locale][m1]:f);
});
}
var str=fmt.replace(/%([aAbBCdegGHIjlmMpPSuUVwWyY%])/g,function(m0,m1){
var f=Date.ext.formats[m1];
if(typeof (f)=="string"){
return d[f]();
}else{
if(typeof (f)=="function"){
return f.call(d,d);
}else{
if(typeof (f)=="object"&&typeof (f[0])=="string"){
return Date.ext.util.xPad(d[f[0]](),f[1]);
}else{
return m1;
}
}
}
});
d=null;
return str;
};
Date.MILLISECONDS_PER_HOUR=1000*60*60;
Date.MILLISECONDS_PER_DAY=24*Date.MILLISECONDS_PER_HOUR;
Date.prototype.isSameDay=function isSameDay(_132){
if(!_132){
return false;
}
return (this.getFullYear()==_132.getFullYear()&&this.getMonth()==_132.getMonth()&&this.getDate()==_132.getDate());
};
Date.prototype.isToday=function isToday(){
return this.isSameDay(new Date());
};
Date.prototype.isTomorrow=function isTomorrow(){
var now=new Date();
var _134=new Date(now.getTime()+Date.MILLISECONDS_PER_DAY);
return this.isSameDay(_134);
};
Date.prototype.isThisWeek=function isThisWeek(){
var now=new Date();
var _136=new Date(now.getTime()+(6*Date.MILLISECONDS_PER_DAY));
return (this.getTime()>now.getTime()&&this.getTime()<_136.getTime());
};
Date.prototype.isThisYear=function isThisYear(){
var now=new Date();
return (this.getYear()==now.getYear());
};
Date.parseXmlSchema=function(_138){
var _139=_138.match(/(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(Z|([+-]\d\d:\d\d))/);
var year=_139[1];
var _13b=_139[2]-1;
var day=_139[3];
var _13d=_139[4];
var _13e=_139[5];
var _13f=_139[6];
var _140=_139[7];
var _141=Date.UTC(year,_13b,day,_13d,_13e,_13f);
if(_140!="Z"){
_140=parseInt(_140,10);
_141+=(-1*_140*Date.MILLISECONDS_PER_HOUR);
}
return new Date(_141);
};
Date.prototype.toXmlSchema=function toXmlSchema(){
return this.strftime("%Y-%m-%dT%H:%M:%S%z");
};
namespace("MapBuzz.Ajax");
MapBuzz.Ajax.RequestPrototype=function MapBuzzAjaxRequestPrototype(_142){
this.command=_142;
};
Object.extend(MapBuzz.Ajax.RequestPrototype.prototype,{submit:function(){
var _143=this.command.options.copy();
_143.onSuccess=this.onSuccess.bind(this);
_143.onFailure=this.onFailure.bind(this);
new Ajax.Request(this.command.resource.uri,_143);
},onSuccess:function(_144){
var _145=new MapBuzz.Ajax.Response(_144);
var _146=_145.getMediaType();
var data=_145.getResponse(_146);
var _148=_145.getAllResponseHeaders();
this.command.onSuccess(data,_146,_148);
},onFailure:function(_149){
var _14a=new MapBuzz.Ajax.Response(_149);
var _14b=_14a.getError();
this.command.onFailure(_14b);
}});
MapBuzz.Ajax.Responder=function MapBuzzAjaxResponder(){
};
Object.extend(MapBuzz.Ajax.Responder.prototype,{onComplete:function(_14c,_14d,json){
if(_14c.success()){
this.onSuccess(_14d);
}else{
this.onFailure(_14d);
}
},onException:function(_14f,_150){
if(typeof _150=="string"||_150 instanceof String){
_150=new Error(_150);
}
if(_150.name=="NS_ERROR_NOT_AVAILABLE"){
return;
}
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:Error.summary(_150),level:MapBuzz.Message.UNEXPECTED_ERROR,stack:Error.traceback(_150)});
},onSuccess:function(_151){
MapBuzz.databus.send(this,MapBuzz.Message.CLEAR_MESSAGE,{level:MapBuzz.Message.PROCESSING});
var _152=new MapBuzz.Ajax.Response(_151);
if(_152.getMediaType().equals(MapBuzz.Mime.JSON)){
var data=_152.getResponse(MapBuzz.Mime.JSON);
if(data&&data.notice){
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:data.notice,level:MapBuzz.Message.STATUS});
}
}
},onFailure:function(_154){
MapBuzz.databus.send(this,MapBuzz.Message.CLEAR_MESSAGE,{level:MapBuzz.Message.PROCESSING});
var _155=new MapBuzz.Ajax.Response(_154);
if(_155.isValidationError()){
return;
}
var _156=_155.getError();
if(_155.isAuthenticationError()||_155.isAuthorizationError()){
return;
}
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:Error.summary(_156),level:MapBuzz.Message.UNEXPECTED_ERROR,stack:Error.traceback(_156)});
}});
if(typeof window!="undefined"){
Event.observe(window,"load",function(){
Ajax.Responders.register(new MapBuzz.Ajax.Responder());
});
}
MapBuzz.Ajax.Request=MapBuzz.Ajax.RequestPrototype;
namespace("MapBuzz.Template");
MapBuzz.Template.Template=function MbTemplate(_157){
this.value=_157;
this.compile();
};
Object.extend(MapBuzz.Template.Template.prototype,{compile:function(_158,_159){
var _15a=new MapBuzz.Template.Parser();
this.func=_15a.compile(this.value);
},run:function(_15b){
var _15c=new Object();
Object.extend(_15c,_15b);
_15c.__run=this.func;
return _15c.__run();
}});
MapBuzz.Template.Parser=function Parser(){
this.regex=/<%=?(.*?)%>/g;
};
Object.extend(MapBuzz.Template.Parser.prototype,{compile:function(_15d){
var _15e=0;
var _15f="_%_";
var body=_15d.replace(this.regex,function(_161,_162,_163,_164){
var _165=_15f+";\n";
if(_161.charAt(2)=="="){
_165+="  __out += "+_162+";\n";
}else{
_165+="  "+_162+"\n";
}
_165+="  __out += "+_15f;
return _165;
});
var _166="var __out = "+_15f+body+_15f+";\n"+"return __out;\n";
_166=_166.replace(/'/g,"\\'");
var _167=new RegExp(_15f,"g");
_166=_166.replace(_167,"'");
return new Function(_166);
}});
namespace("MapBuzz.Ajax");
MapBuzz.Ajax.Command=function MapBuzzAjaxCommand(_168,_169,_16a){
this.callSuper(MapBuzz.Ajax.Command,"Ajax Command",true);
this.resource=_168;
this.options=new HashTable(_169);
this.transport=null;
this.cancelPending=_16a||false;
};
Function.inherits(MapBuzz.Ajax.Command,MapBuzz.Command.AbstractCommand);
Object.extend(MapBuzz.Ajax.Command.prototype,{execute:function(_16b){
Object.extend(this.options,_16b);
var _16c=new MapBuzz.Ajax.Request(this);
_16c.submit();
},fail:function(_16d){
this.onFailure(_16d);
},onSuccess:function(data,_16f,_170){
if(this.options.onSuccess){
this.options.onSuccess(data,_16f,_170);
}else{
this.executeNext(data,_16f,_170);
}
},onFailure:function(_171){
if(this.options.onFailure){
this.options.onFailure(_171);
}else{
this.failNext(_171);
}
}});
MapBuzz.Ajax.Response=function MapBuzzAjaxResponse(_172){
this.transport=_172;
};
Object.extend(MapBuzz.Ajax.Response.prototype,{getAllResponseHeaders:function(){
return this.transport.getAllResponseHeaders();
},getMediaType:function(){
if(!this.mediaType){
var _173=this.transport.getResponseHeader("Content-type");
if(!_173){
throw new Error("Response did not include a content type.  Response: "+this.transport.responseText);
}
this.mediaType=MapBuzz.Mime.lookup(_173);
}
return this.mediaType;
},getResponse:function(_174){
var _175=null;
if(_174.equals(MapBuzz.Mime.JSON)){
_175=eval("("+this.transport.responseText+")");
}else{
if(_174.equals(MapBuzz.Mime.HTML)){
_175=this.transport.responseText;
}else{
if(_174.equals(MapBuzz.Mime.XHTML)){
_175=this.transport.responseText;
}else{
if(Browser.instance.isIE()&&_174.equals(MapBuzz.Mime.ATOM)){
_175=new ActiveXObject("Microsoft.XMLDOM");
_175.loadXML(this.transport.responseText);
}else{
if(_174.equals(MapBuzz.Mime.ATOM)){
_175=this.transport.responseXML;
}else{
if(_174.equals(MapBuzz.Mime.XML)){
_175=this.transport.responseXML;
}else{
_175=this.transport.responseText;
}
}
}
}
}
}
return _175;
},isValidationError:function(){
if(this.transport.status==418){
return true;
}else{
if(Browser.instance.isOpera()&&this.transport.status==200&&(this.transport.getResponseHeader("Status")||"").match(/Invalid/i)){
return true;
}else{
return false;
}
}
},isAuthenticationError:function(){
if(this.transport.status==401){
return true;
}else{
if(Browser.instance.isOpera()&&this.transport.status==200&&(this.transport.getResponseHeader("Status")||"").match(/Unauthorized/i)){
return true;
}else{
return false;
}
}
},isAuthorizationError:function(){
if(this.transport.status==403){
return true;
}else{
if(Browser.instance.isOpera()&&this.transport.status==200&&(this.transport.getResponseHeader("Status")||"").match(/Forbidden/i)){
return true;
}else{
return false;
}
}
},getError:function(){
var _176=null;
var _177=this.transport.responseText||"";
_177=_177.replace(/&nbsp;/g," ");
var _178="Status: "+this.transport.status+". "+_177;
var _179=this.getMediaType();
if(this.isValidationError()){
_176=MapBuzz.Validation.io.read(this.getResponse(_179),_179,this.getAllResponseHeaders());
_176.level=MapBuzz.Message.ERROR;
}else{
if(this.isAuthenticationError()||this.isAuthorizationError()){
_176=new Error(_177);
_176.level=MapBuzz.Message.ERROR;
}else{
if(_179.equals(MapBuzz.Mime.HTML)||_179.equals(MapBuzz.Mime.XHTML)){
_176=new Error(_177);
_176.level=MapBuzz.Message.UNEXPECTED_ERROR;
}else{
if(_179.equals(MapBuzz.Mime.JSON)){
var data=eval("("+this.transport.responseText+")");
if(data){
_176=new Error(data.error);
}else{
_176=new Error(data);
}
_176.level=MapBuzz.Message.UNEXPECTED_ERROR;
}else{
_176=new Error(_178.escapeHTML());
_176.level=MapBuzz.Message.UNEXPECTED_ERROR;
}
}
}
}
return _176;
}});
Function.callStack=function(){
var _17b=new Array();
return _17b.join("\n");
};
namespace("MapBuzz.Resource");
MapBuzz.Resource.resources=new HashTable();
MapBuzz.Resource.getResource=function(uri){
var _17d=MapBuzz.Resource.resources[uri];
if(!_17d){
_17d=MapBuzz.Resource.resources[uri]=new MapBuzz.Resource.Resource(uri);
}
return _17d;
};
MapBuzz.Resource.Permissions=function MbPermissions(_17e,_17f,_180){
this.insertable=_17e||false;
this.updatable=_17f||false;
this.removable=_180||false;
};
MapBuzz.Resource.Permissions.prototype.toString=function toString(){
var _181="Resource.Permissions [ "+"insertable: "+this.insertable+", "+"updatable: "+this.updatable+", "+"removable: "+this.removable+"]";
return _181;
};
MapBuzz.Resource.Remote=function MbRemote(uri,_183){
if(uri){
this.uri=uri.replace(/&amp;/g,"&");
}else{
this.uri=null;
}
this.permissions=_183||new MapBuzz.Resource.Permissions();
};
Object.extend(MapBuzz.Resource.Remote.prototype,{isReadOnly:function(){
return !(this.isInsertable()||this.isUpdatable());
},isInsertable:function(){
return this.permissions.insertable;
},isUpdatable:function(){
return this.permissions.updatable;
},isRemovable:function(){
return this.permissions.removable;
},getCommand:function(_184){
_184=Object.extend({method:"GET"},_184);
return new MapBuzz.Ajax.Command(this,_184,true);
},postCommand:function(_185){
if(!this.permissions.insertable){
throw new Error("You do not have rights to insert to this resource");
}
_185=Object.extend({method:"POST"},_185);
return new MapBuzz.Ajax.Command(this,_185,false);
},putCommand:function(_186){
if(!this.permissions.updatable){
var msg="You do not have rights to update this resource. "+this.toString()+".";
throw new Error(msg);
}
_186=Object.extend({method:"PUT"},_186);
return new MapBuzz.Ajax.Command(this,_186,false);
},deleteCommand:function(_188){
if(!this.permissions.removable){
throw new Error("You do not have rights to delete this resource");
}
_188=Object.extend({method:"DELETE"},_188);
return new MapBuzz.Ajax.Command(this,_188,false);
}});
MapBuzz.Resource.Remote.prototype.toString=function toString(){
return "Remote Resource ["+this.uri+"]";
};
MapBuzz.Resource.Local=function ResourceLocal(uri){
this.uri=uri;
this.permissions=MapBuzz.Resource.Local.PERMISSIONS;
};
Function.inherits(MapBuzz.Resource.Local,MapBuzz.Resource.Remote);
MapBuzz.Resource.Local.PERMISSIONS=new MapBuzz.Resource.Permissions();
Object.extend(MapBuzz.Resource.Local.prototype,{getContentCommand:function(){
return new MapBuzz.Command.Functor("Local Resource Content",{execute:function(){
return this.content;
}.bind(this)});
},getCommand:function(){
return this.getContentCommand();
},postCommand:function(){
return this.getContentCommand();
},putCommand:function(){
return this.getContentCommand();
},deleteCommand:function(){
return this.getContentCommand();
}});
MapBuzz.Resource.Local.prototype.toString=function toString(){
return "Local Resource ["+this.uri+"]";
};
MapBuzz.Resource.Local.instance=new MapBuzz.Resource.Local();
namespace("MapBuzz.Mime");
MapBuzz.Mime.registerMediaTypes=function registerMediaTypes(){
MapBuzz.Mime.REGISTRY=new HashTable();
for(var key in MapBuzz.Mime){
var _18b=MapBuzz.Mime[key];
if(!(_18b instanceof MapBuzz.Mime.MediaType)){
continue;
}
MapBuzz.Mime.REGISTRY[_18b.mediaType]=_18b;
for(var i=0;i<_18b.synonyms.length;i++){
MapBuzz.Mime.REGISTRY[_18b.synonyms[i]]=_18b;
}
}
};
MapBuzz.Mime.parseAccepts=function parseAccepts(_18d){
var _18e=[];
var _18f=_18d.split(",");
for(var i=0;i<_18f.length;i++){
_18e.push(this.lookup(_18f[i]));
}
return _18e;
};
MapBuzz.Mime.lookup=function lookup(_191){
var _192=_191.match(/^(.*)(; charset=.*)$/);
if(_192){
_191=_192[1];
}
return MapBuzz.Mime.REGISTRY[_191];
};
MapBuzz.Mime.MediaType=function MediaType(_193){
this.mediaType=_193;
this.synonyms=[];
};
Object.extend(MapBuzz.Mime.MediaType.prototype,{equals:function(_194){
var _195=(this.mediaType==_194.mediaType);
if(!_195){
for(var i=0;i<this.synonyms.length;i++){
if(this.synonyms[i]==_194){
_195=true;
break;
}
}
}
return _195;
}});
MapBuzz.Mime.MediaType.prototype.toString=function toString(){
var _197=this.mediaType;
return _197;
};
MapBuzz.Mime.ATOM=new MapBuzz.Mime.MediaType("application/atom+xml");
MapBuzz.Mime.ATOM.synonyms.push("application/atom+xml;type=entry");
MapBuzz.Mime.ATOM.synonyms.push("application/atom+xml;type=feed");
MapBuzz.Mime.ATOM.synonyms.push("application/atom+xml;type=mapbuzz");
MapBuzz.Mime.ATOM.synonyms.push("application/atom+xml;type=mapbuzz_compact");
MapBuzz.Mime.ATOM.FEED="application/atom+xml;type=feed";
MapBuzz.Mime.ATOM.ENTRY="application/atom+xml;type=entry";
MapBuzz.Mime.ATOM.MAPBUZZ="application/atom+xml;type=mapbuzz";
MapBuzz.Mime.HTML=new MapBuzz.Mime.MediaType("text/html");
MapBuzz.Mime.JAVASCRIPT=new MapBuzz.Mime.MediaType("application/javascript");
MapBuzz.Mime.JAVASCRIPT.synonyms.push("text/javascript");
MapBuzz.Mime.JSON=new MapBuzz.Mime.MediaType("application/json");
MapBuzz.Mime.SVG=new MapBuzz.Mime.MediaType("image/svg+xml");
MapBuzz.Mime.TEXT=new MapBuzz.Mime.MediaType("text/plain");
MapBuzz.Mime.VML=new MapBuzz.Mime.MediaType("urn:schemas-microsoft-com:vml");
MapBuzz.Mime.XHTML=new MapBuzz.Mime.MediaType("application/xhtml+xml");
MapBuzz.Mime.XML=new MapBuzz.Mime.MediaType("application/xml");
MapBuzz.Mime.XML.synonyms.push("text/xml");
MapBuzz.Mime.URL_ENCODED=new MapBuzz.Mime.MediaType("application/x-www-form-urlencoded");
MapBuzz.Mime.FBML=new MapBuzz.Mime.MediaType("application/fbml");
MapBuzz.Mime.GIF=new MapBuzz.Mime.MediaType("image/gif");
MapBuzz.Mime.PNG=new MapBuzz.Mime.MediaType("image/png");
MapBuzz.Mime.JPEG=new MapBuzz.Mime.MediaType("image/jpeg");
MapBuzz.Mime.registerMediaTypes();
namespace("MapBuzz.Message");
Object.extend(MapBuzz.Message,{MESSAGE_CLASS:"message",MESSAGE:"MAPBUZZ_MESSAGE",CLEAR_MESSAGE:"MAPBUZZ_CLEAR_MESSAGE",UNEXPECTED_ERROR:1,ERROR:2,STATUS:3,PROCESSING:4});
MapBuzz.Message.Box=function MessageBox(_198,_199){
this.elementId=_198;
if(_199){
this.levels=new HashTable(_199);
}else{
this.levels=new HashTable();
this.levels[MapBuzz.Message.UNEXPECTED_ERROR]=true;
this.levels[MapBuzz.Message.ERROR]=true;
this.levels[MapBuzz.Message.STATUS]=true;
this.levels[MapBuzz.Message.PROCESSING]=true;
}
this.level=this.getMaxLevel();
this.initialize();
};
MapBuzz.Message.Box.MESSAGE_CLASSES=new HashTable();
MapBuzz.Message.Box.MESSAGE_EFFECTS=new HashTable();
MapBuzz.Message.Box.MESSAGE_CLASSES[MapBuzz.Message.UNEXPECTED_ERROR]="error_message";
MapBuzz.Message.Box.MESSAGE_CLASSES[MapBuzz.Message.ERROR]="error_message";
MapBuzz.Message.Box.MESSAGE_CLASSES[MapBuzz.Message.STATUS]="status_message";
MapBuzz.Message.Box.MESSAGE_CLASSES[MapBuzz.Message.PROCESSING]="processing_message";
if(typeof Effect!="undefined"){
MapBuzz.Message.Box.MESSAGE_EFFECTS[MapBuzz.Message.STATUS]=Effect.Opacity;
MapBuzz.Message.Box.MESSAGE_EFFECTS[MapBuzz.Message.ERROR]=Effect.Opacity;
}
Object.extend(MapBuzz.Message.Box.prototype,{initialize:function(){
this.element=document.getElementById(this.elementId);
this.contentElement=Element.getElementBySelector(this.element,".content");
this.closeElement=Element.getElementBySelector(this.element,".close");
this.setupEvents();
},release:function(){
if(this.closeElement){
Event.stopObserving(this.closeElement,"click",this.closeHandler);
}
this.closeHandler=null;
},setupEvents:function(){
this.closeHandler=this.onClose.bind(this);
Event.observe(this.closeElement,"click",this.closeHandler);
this.initialized=true;
},getMaxLevel:function(){
return Math.max.apply(Math,this.levels.keys());
},show:function(_19a,_19b){
if(!this.levels[_19b]){
return;
}
if(this.level<_19b){
return;
}
if(!this.initialized){
this.initialize();
}
this.level=_19b;
var _19c=MapBuzz.Message.MESSAGE_CLASS+" "+MapBuzz.Message.Box.MESSAGE_CLASSES[this.level];
if(_19b==MapBuzz.Message.PROCESSING){
_19a+="...";
}
this.update(_19a,_19c);
if(MapBuzz.ENVIRONMENT=="selenium"&&Browser.instance.isIE()){
window.setTimeout(this.setEffect.bind(this,_19b),20);
}else{
this.setEffect(_19b);
}
},update:function(_19d,_19e){
try{
this.contentElement.innerHTML=_19d||" ";
this.element.className=_19e;
Element.show(this.closeElement);
Element.show(this.contentElement);
}
catch(e){
}
},setEffect:function(_19f){
var _1a0=MapBuzz.Message.Box.MESSAGE_EFFECTS[_19f];
if(!_1a0){
return;
}
new _1a0(this.element,{duration:10,transition:Effect.Transitions.linear,from:1,to:0,afterFinish:function(_1a1){
this.close();
}.bind(this)});
},onClose:function(_1a2){
this.close();
Event.stop(_1a2);
},close:function(_1a3){
if(!this.initialized){
return;
}
if(_1a3&&_1a3>this.level){
return;
}
this.level=this.getMaxLevel();
this.reset();
},reset:function(){
Element.hide(this.contentElement);
Element.hide(this.closeElement);
this.element.style.opacity="";
this.element.style.filter="";
this.contentElement.innerHTML="";
this.element.className=MapBuzz.Message.MESSAGE_CLASS;
}});
MapBuzz.Message.Handler=function MessageHandler(_1a4,_1a5){
this.messageBox=_1a4;
this.messageType=_1a5||MapBuzz.Message.MESSAGE;
this.initialize();
};
Object.extend(MapBuzz.Message.Handler.prototype,{initialize:function(){
this.registerListeners();
},release:function(){
this.unregisterListeners();
},clear:function(_1a6){
this.messageBox.close(_1a6);
},registerListeners:function(){
this.showMessageListener=MapBuzz.databus.registerListener(this.messageType,function(_1a7){
this.showMessage(_1a7.data.message,_1a7.data.level);
}.bind(this));
this.clearMessageListener=MapBuzz.databus.registerListener(MapBuzz.Message.CLEAR_MESSAGE,function(_1a8){
this.clear(_1a8.data.level);
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(this.messageType,this.showMessageListener);
this.showMessageListener=null;
MapBuzz.databus.unregisterListener(MapBuzz.Message.CLEAR_MESSAGE,this.clearMessageListener);
this.clearMessageListener=null;
},showMessage:function(_1a9,_1aa){
if(!_1a9){
throw new Error("Must specify message text.");
}
if(!_1aa){
throw new Error("Must specify message level.");
}
this.messageBox.show(_1a9,_1aa);
}});
function Key(){
}
Key.keyCode=function(_1ab){
var _1ac=null;
switch(_1ab.type){
case "keydown":
_1ac=_1ab.keyCode;
break;
case "keypress":
_1ac=(_1ab.charCode&&_1ab.charCode!=0)?_1ab.charCode:_1ab.keyCode;
break;
case "keyup":
_1ac=_1ab.keyCode;
break;
default:
_1ac=(_1ab.charCode&&_1ab.charCode!=0)?_1ab.charCode:_1ab.keyCode;
break;
}
return _1ac;
};
if(document.implementation.hasFeature("Events","2.0")){
Object.extend(Event,{createCustomEvent:function(_1ad,name){
var _1af=document.createEvent("Events");
_1af.initEvent(name,true,true);
return _1af;
},createMouseEvent:function(name,_1b1,_1b2){
var _1b3=document.createEvent("MouseEvents");
_1b3.initMouseEvent(name,true,true,_1b1.view,_1b1.detail,_1b1.screenX,_1b1.screenY,_1b1.clientX,_1b1.clientY,_1b1.ctrlKey,_1b1.altKey,_1b1.shiftKey,_1b1.metaKey,_1b1.button,_1b1.relatedTarget);
return _1b3;
},dispatchEvent:function(_1b4,name,_1b6){
_1b4.dispatchEvent(_1b6);
}});
}
Object.extend(Event,{relatedTarget:function(_1b7){
if(_1b7.relatedTarget){
return _1b7.relatedTarget;
}else{
if(_1b7.type=="mouseout"){
return _1b7.toElement;
}else{
if(_1b7.type=="mouseover"){
return _1b7.fromElement;
}else{
return (_1b7.toElement||_1b7.fromElement);
}
}
}
},fireCustomEvent:function(_1b8,name,_1ba){
var _1bb=this.createCustomEvent(_1b8,name);
_1bb.userData=_1ba;
this.dispatchEvent(_1b8,name,_1bb);
},fireMouseEvent:function(_1bc,name,_1be,_1bf){
var _1c0=this.createMouseEvent(name,_1be);
_1c0.userData=_1bf;
this.dispatchEvent(_1bc,name,_1c0);
},relayMouseEvent:function(type,_1c2,_1c3){
Event.observe(_1c2,type,function(_1c4){
Event.fireMouseEvent(_1c3,type,_1c4||window.event);
});
},relayEvents:function(_1c5,_1c6){
this.relayMouseEvent("mousemove",_1c5,_1c6);
this.relayMouseEvent("mousedown",_1c5,_1c6);
this.relayMouseEvent("mouseup",_1c5,_1c6);
this.relayMouseEvent("mouseover",_1c5,_1c6);
this.relayMouseEvent("mouseout",_1c5,_1c6);
this.relayMouseEvent("click",_1c5,_1c6);
this.relayMouseEvent("dblclick",_1c5,_1c6);
}});
if(!window.KeyEvent){
Object.extend(window,{KeyEvent:function(){
}});
Object.extend(window.KeyEvent,{DOM_VK_CANCEL:3,DOM_VK_HELP:6,DOM_VK_BACK_SPACE:8,DOM_VK_TAB:9,DOM_VK_CLEAR:12,DOM_VK_RETURN:13,DOM_VK_ENTER:14,DOM_VK_SHIFT:16,DOM_VK_CONTROL:17,DOM_VK_ALT:18,DOM_VK_PAUSE:19,DOM_VK_CAPS_LOCK:20,DOM_VK_ESCAPE:27,DOM_VK_SPACE:32,DOM_VK_PAGE_UP:33,DOM_VK_PAGE_DOWN:34,DOM_VK_END:35,DOM_VK_HOME:36,DOM_VK_LEFT:37,DOM_VK_UP:38,DOM_VK_RIGHT:39,DOM_VK_DOWN:40,DOM_VK_PRINTSCREEN:44,DOM_VK_INSERT:45,DOM_VK_DELETE:46,DOM_VK_0:48,DOM_VK_1:49,DOM_VK_2:50,DOM_VK_3:51,DOM_VK_4:52,DOM_VK_5:53,DOM_VK_6:54,DOM_VK_7:55,DOM_VK_8:56,DOM_VK_9:57,DOM_VK_SEMICOLON:59,DOM_VK_EQUALS:61,DOM_VK_A:65,DOM_VK_B:66,DOM_VK_C:67,DOM_VK_D:68,DOM_VK_E:69,DOM_VK_F:70,DOM_VK_G:71,DOM_VK_H:72,DOM_VK_I:73,DOM_VK_J:74,DOM_VK_K:75,DOM_VK_L:76,DOM_VK_M:77,DOM_VK_N:78,DOM_VK_O:79,DOM_VK_P:80,DOM_VK_Q:81,DOM_VK_R:82,DOM_VK_S:83,DOM_VK_T:84,DOM_VK_U:85,DOM_VK_V:86,DOM_VK_W:87,DOM_VK_X:88,DOM_VK_Y:89,DOM_VK_Z:90,DOM_VK_CONTEXT_MENU:93,DOM_VK_NUMPAD0:96,DOM_VK_NUMPAD1:97,DOM_VK_NUMPAD2:98,DOM_VK_NUMPAD3:99,DOM_VK_NUMPAD4:100,DOM_VK_NUMPAD5:101,DOM_VK_NUMPAD6:102,DOM_VK_NUMPAD7:103,DOM_VK_NUMPAD8:104,DOM_VK_NUMPAD9:105,DOM_VK_MULTIPLY:106,DOM_VK_ADD:107,DOM_VK_SEPARATOR:108,DOM_VK_SUBTRACT:109,DOM_VK_DECIMAL:110,DOM_VK_DIVIDE:111,DOM_VK_F1:112,DOM_VK_F2:113,DOM_VK_F3:114,DOM_VK_F4:115,DOM_VK_F5:116,DOM_VK_F6:117,DOM_VK_F7:118,DOM_VK_F8:119,DOM_VK_F9:120,DOM_VK_F10:121,DOM_VK_F11:122,DOM_VK_F12:123,DOM_VK_F13:124,DOM_VK_F14:125,DOM_VK_F15:126,DOM_VK_F16:127,DOM_VK_F17:128,DOM_VK_F18:129,DOM_VK_F19:130,DOM_VK_F20:131,DOM_VK_F21:132,DOM_VK_F22:133,DOM_VK_F23:134,DOM_VK_F24:135,DOM_VK_NUM_LOCK:144,DOM_VK_SCROLL_LOCK:145,DOM_VK_COMMA:188,DOM_VK_PERIOD:190,DOM_VK_SLASH:191,DOM_VK_BACK_QUOTE:192,DOM_VK_OPEN_BRACKET:219,DOM_VK_BACK_SLASH:220,DOM_VK_CLOSE_BRACKET:221,DOM_VK_QUOTE:222,DOM_VK_META:224});
}
Event.DragController=function DragController(_1c7){
if(!_1c7){
throw new Error("Must specify an event source");
}
this.element=_1c7;
this.initialize();
};
Object.extend(Event.DragController.prototype,{initialize:function(){
this.disableBrowserEvents();
this.dragging=false;
this.mouseDownHandler=this.dragStart.bindAsEventListener(this);
this.mouseMoveHandler=this.drag.bindAsEventListener(this);
this.mouseUpHandler=this.dragEnd.bindAsEventListener(this);
Event.observe(this.element,"mousedown",this.mouseDownHandler);
},release:function(){
this.dragging=false;
Event.stopObserving(this.element,"mousedown",this.mouseDownHandler);
this.stopObservingDrag();
this.element=null;
},disableBrowserEvents:function(){
Event.observe(this.element,"drag",function(_1c8){
Event.stop(_1c8);
return false;
});
Event.observe(this.element,"selectstart",function(_1c9){
var _1ca=Event.element(_1c9);
if(_1ca.nodeName.match(/img/i)||_1ca.nodeName.match(/image/i)){
Event.stop(_1c9);
return false;
}else{
return true;
}
});
Event.observe(this.element,"draggesture",function(_1cb){
Event.stop(_1cb);
}.bindAsEventListener(this),true);
this.element.onmousedown=function(){
return false;
};
Event.observe(this.element,"dragstart",function(_1cc){
Event.stop(_1cc);
}.bindAsEventListener(this),true);
},startObservingDrag:function(){
Event.observe(document,"mouseup",this.mouseUpHandler,true);
Event.observe(this.element,"mousemove",this.mouseMoveHandler);
},stopObservingDrag:function(){
if(this.mouseMoveHandler){
Event.stopObserving(this.element,"mousemove",this.mouseMoveHandler);
}
if(this.mouseUpHandler){
Event.stopObserving(document,"mouseup",this.mouseUpHandler,true);
}
},getElement:function(){
return this.element;
},triggerMouseEvent:function(_1cd,_1ce){
var _1cf=Event.createMouseEvent(this.element,_1cd,_1ce);
Event.dispatchMouseEvent(this.element,_1cd,_1cf);
},dragStart:function(_1d0){
if(!Event.isLeftClick(_1d0)){
return;
}
this.startObservingDrag();
},drag:function(_1d1){
if(!this.dragging){
if(Browser.instance.isIE()){
Event.fireMouseEvent(this.element,"dragstart_",_1d1);
}else{
Event.fireMouseEvent(_1d1.target,"dragstart_",_1d1);
}
this.dragging=true;
}
},dragEnd:function(_1d2){
this.stopObservingDrag();
if(this.dragging){
Event.fireMouseEvent(this.element,"dragend_",_1d2);
this.dragging=false;
}
}});
function ScriptLoader(){
this.finished=false;
this.finishAttempts=0;
this.loadingScripts=new Array();
this.loadedScripts=new Array();
this.callbacks=new HashTable();
this.callbacks[ScriptLoader.FINISHED]=new Array();
var _1d3=this.fireFinished.bindAsEventListener(this);
Event.observe(window,"load",function(_1d4){
window.setTimeout(_1d3,100);
});
}
ScriptLoader.FINISHED="SCRIPT_LOADER_FINISHED";
ScriptLoader.MAX_ATTEMPTS=20;
Object.extend(ScriptLoader.prototype,{getScripts:function(){
var _1d5=new Array();
var _1d6=document.getElementsByTagName("script");
for(var i=0;i<_1d6.length;i++){
_1d5.push(_1d6[i]);
}
return _1d5;
},getScript:function(src){
src.replace(/\//,"/");
src.replace(/\./,".");
var _1d9=new RegExp(src+"$");
var _1da=this.getScripts();
for(var i=0;i<_1da.length;i++){
var _1dc=_1da[i];
if(_1dc.src.match(_1d9)){
return _1dc;
}
}
return null;
},getScriptPath:function(){
var _1dd=this.getScripts();
var _1de=_1dd.first().src;
var _1df=_1de.match(/^(.*javascripts\/)/);
if(!_1df){
_1df=_1de.match(/^(.*\/)/);
}
return _1df[1];
},require:function(_1e0,_1e1){
if(this.isLoaded(_1e0)){
if(_1e1){
_1e1();
}
}else{
if(this.isLoading(_1e0)){
if(_1e1){
this.callbacks[_1e0].push(_1e1);
}
}else{
this.callbacks[_1e0]=new Array();
if(_1e1){
this.callbacks[_1e0].push(_1e1);
}
this.loadingScripts.push(_1e0);
var _1e2={src:_1e0,type:"text/javascript"};
document.insertElement(document.getHeadElement(),"script",_1e2);
}
}
},onFinish:function(_1e3){
this.callbacks[ScriptLoader.FINISHED].push(_1e3);
},isLoading:function(_1e4){
return this.loadingScripts.include(_1e4);
},isLoaded:function(_1e5){
return this.loadedScripts.include(_1e5);
},loaded:function(_1e6){
if(this.isLoaded(_1e6)){
throw new Error("Script has already been loaded: "+_1e6);
}
this.loadingScripts.remove(_1e6);
this.loadedScripts.push(_1e6);
this.fireOnLoad(_1e6);
},fireOnLoad:function(_1e7){
var _1e8=this.callbacks[_1e7];
if(!_1e8){
return;
}
for(var i=0;i<_1e8.length;i++){
var _1ea=_1e8[i];
_1ea();
}
this.callbacks[_1e7]=new Array();
},fireFinished:function(_1eb){
if(this.loadingScripts.length>0&&this.finishAttempts<ScriptLoader.MAX_ATTEMPTS){
this.finishAttempts+=1;
window.setTimeout(this.fireFinished.bind(this),500);
}else{
if(this.loadingScripts.length==0){
this.fireOnLoad(ScriptLoader.FINISHED);
this.finished=true;
}else{
var _1ec="Could not load all javascript files.  Not loaded: "+this.loadingScripts.join(" ");
throw new Error(_1ec);
}
}
}});
var Loader=new ScriptLoader();
namespace("MapBuzz.Storage");
function CookieStorage(){
}
Object.extend(CookieStorage.prototype,{read:function(name){
var _1ee=document.cookie.split(";");
for(var i=0;i<_1ee.length;i++){
var pair=_1ee[i].split("=");
if(name==pair[0].strip()){
return (pair[1]);
}
}
return null;
},write:function(name,_1f2,days){
var _1f4="";
if(days){
var date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
_1f4="; expires="+date.toGMTString();
}
document.cookie=name+"="+_1f2+_1f4+"; path=/";
},remove:function(name){
this.create(name,"",-1);
}});
if(Browser.instance.isIE()){
function IEStorage(key){
this.key=key;
MapBuzz.Loader.instance.registerListener(MapBuzz.Loader.CONTENT_LOADED,this.onLoad.bind(this));
}
Object.extend(IEStorage,{STORAGE_ELEMENT_TAG:"span",STORAGE_ELEMENT_ID:"ie_storage"});
Object.extend(IEStorage.prototype,{onLoad:function(){
this.createStorage();
},createStorage:function(){
var body=document.getElementsByTagName("body")[0];
this.storageElement=document.createElement(IEStorage.STORAGE_ELEMENT_TAG);
this.storageElement.id=IEStorage.STORAGE_ELEMENT_ID;
this.storageElement.style.display="none";
try{
this.storageElement.addBehavior("#default#userData");
body.appendChild(this.storageElement);
this.storageElement.load(this.key);
}
catch(e){
}
},save:function(){
try{
this.storageElement.save(this.key);
}
catch(e){
}
},read:function(name){
return this.storageElement.getAttribute(name);
},write:function(name,_1fb){
this.storageElement.setAttribute(name,_1fb);
this.save();
}});
}
if(!window.sessionStorage){
function Storage(){
if(Browser.instance.isIE()){
this.storageImpl=new IEStorage(Storage.STORAGE_KEY);
}else{
this.storageImpl=new CookieStorage();
}
this.loaded=false;
}
Storage.STORAGE_KEY="mb_storage";
Object.extend(Storage.prototype,{save:function(){
this.storageImpl.write(Storage.STORAGE_KEY,Object.toJSON(this.values));
},restore:function(){
if(!this.loaded){
var _1fc=this.storageImpl.read(Storage.STORAGE_KEY);
if(_1fc){
this.values=eval("("+_1fc+")");
}else{
this.values=new Object();
}
this.loaded=true;
}
},length:function(){
this.restore();
var _1fd=0;
for(var key in this.values){
_1fd++;
}
return _1fd;
},key:function(_1ff){
this.restore();
if(_1ff<0){
throw new RangeError("Index must be equal to or greater than zero");
}
var _200=0;
for(var key in this.value){
if(_200==_1ff){
return key;
}else{
_200++;
}
}
throw new RangeError("Index was greater then the number of keys.");
},getItem:function(key){
this.restore();
return this.values[key];
},setItem:function(key,_204){
this.restore();
this.values[key]=_204;
this.save();
},removeItem:function(key){
this.restore();
delete this.value[key];
}});
window.sessionStorage=new Storage();
}
MapBuzz.Storage.getItem=function(key){
var _207=null;
try{
var json=window.sessionStorage.getItem(key);
if(json&&window.StorageItem){
json=json.value;
}
if(json){
_207=json.evalJSON();
}
}
catch(e){
}
return _207;
};
MapBuzz.Storage.setItem=function(key,_20a){
try{
var json=Object.toJSON(_20a);
return window.sessionStorage.setItem(key,json);
}
catch(e){
}
return null;
};
if(document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath","3.0")&&window.XMLDocument&&!XMLDocument.prototype.selectNodes){
XMLDocument.prototype._selectNodes_=function(_20c,node,_20e){
var _20f=this.evaluate(_20c,node,_20e,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
var _210=new Array();
for(var i=0;i<_20f.snapshotLength;i++){
_210.push(_20f.snapshotItem(i));
}
return _210;
};
XMLDocument.prototype.selectNodes=function selectNodes(_212){
if(!this._resolver_){
this._resolver_=document.createNSResolver(this);
}
return this._selectNodes_(_212,this,this._resolver_);
};
Element.prototype.selectNodes=function selectNodes(_213){
if(!this._resolver_){
this._resolver_=document.createNSResolver(this);
}
return this.ownerDocument._selectNodes_(_213,this,this._resolver_);
};
XMLDocument.prototype._selectSingleNode_=function _selectSingleNode_(_214,node,_216){
var _217=this.evaluate(_214,node,_216,XPathResult.FIRST_ORDERED_NODE_TYPE,null);
return _217.singleNodeValue;
};
XMLDocument.prototype.selectSingleNode=function selectSingleNode(_218){
if(!this._resolver_){
this._resolver_=document.createNSResolver(this);
}
return this._selectSingleNode_(_218,this,this._resolver_);
};
Element.prototype.selectSingleNode=function selectSingleNode(_219){
if(!this._resolver_){
this._resolver_=document.createNSResolver(this);
}
return this.ownerDocument._selectSingleNode_(_219,this,this._resolver_);
};
if(!Document.prototype.selectNodes){
Document.prototype._selectNodes_=XMLDocument.prototype._selectNodes_;
Document.prototype.selectNodes=function selectNodes(_21a){
if(!this._resolver_){
this._resolver_=document.createNSResolver(this);
}
return this._selectNodes_(_21a,this,this._resolver_);
};
Document.prototype._selectSingleNode_=XMLDocument.prototype._selectSingleNode_;
Document.prototype.selectSingleNode=function selectSingleNode(_21b){
if(!this._resolver_){
this._resolver_=document.createNSResolver(this);
}
return this._selectSingleNode_(_21b,this,this._resolver_);
};
}
}
namespace("MapBuzz");
MapBuzz.Cursor=function MapBuzzCursor(_21c){
this.element=_21c;
this.cursors=new Array();
this.currentCursor=null;
};
Object.extend(MapBuzz.Cursor.prototype,{getCursor:function(){
return this.cursors[this.cursors.length-1];
},push:function(_21d){
this.cursors.push(_21d);
this.setCursor();
},pop:function(){
this.cursors.pop();
this.setCursor();
},replace:function(_21e){
if(this.cursors.length==0){
this.push(_21e);
}else{
this.cursors[this.cursors.length-1]=_21e;
this.setCursor();
}
}});
if(Browser.instance.isOpera()||Browser.instance.isSafari()){
MapBuzz.Cursor.prototype.setCursor=function setCursor(_21f){
};
}else{
MapBuzz.Cursor.prototype.setCursor=function setCursor(){
var _220="default";
if(this.cursors.length>0){
_220=this.cursors[this.cursors.length-1];
}
if(!this.currentCursor||this.currentCursor!=_220){
this.element.style.cursor=_220;
this.currentCursor=_220;
}
};
}
namespace("MapBuzz.Atom");
MapBuzz.Atom.Feed=function AtomFeed(){
this.id=null;
this.title=null;
this.updated=null;
this.entries=new Array();
this.links=new MapBuzz.Atom.Links();
this.categories=new Array();
};
MapBuzz.Atom.Feed.prototype.toString=function toString(){
var _221="Feed ["+"Id: "+this.id+"]";
return _221;
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Icon=function AtomIcon(id,_223){
this.id=id;
this.title=_223;
this.editResource=new MapBuzz.Resource.Remote(null);
this.instances=new HashTable();
};
Object.extend(MapBuzz.Atom.Icon,{PSEUDO_CLASS_NORMAL:"",PSEUDO_CLASS_HOVER:"hover",SIZE_LARGE:100,SIZE_MEDIUM:64,SIZE_SMALL:32});
Object.extend(MapBuzz.Atom.Icon.prototype,{addInstance:function(_224){
var key=_224.width+"_"+_224.pseudoClass;
this.instances[key]=_224;
},getInstance:function(size,_227){
var key=size+"_"+_227;
return this.instances[key];
}});
MapBuzz.Atom.Icon.prototype.toString=function toString(){
return "Icon ["+this.id+"]";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Address=function Address(){
this.address=null;
this.extendedAddress=null;
this.locality=null;
this.region=null;
this.country=null;
this.postalCode=null;
this.country=null;
};
MapBuzz.Atom.Address.prototype.toString=function toString(){
return "Address ["+this.address+"]";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Links=function AtomLinks(){
this.links=new Array();
};
Object.extend(MapBuzz.Atom.Links,{SELF:"self",ALTERNATE:"alternate",VENUE:"mb:venue",SHARE:"mb:share"});
Object.extend(MapBuzz.Atom.Links.prototype,{add:function(link){
this.links.push(link);
},findFirstByRel:function(rel){
var _22b=null;
var _22c=this.findByRel(rel);
if(_22c){
_22b=_22c[0];
}
return _22b;
},findByRel:function(rel){
var _22e=new Array();
for(var i=0;i<this.links.length;i++){
var link=this.links[i];
if(link.rel==rel){
_22e.push(link);
}
}
return _22e;
},findByRelAndTitle:function(rel,_232){
var _233=new Array();
for(var i=0;i<this.links.length;i++){
var link=this.links[i];
if(link.rel==rel&&link.title==_232){
_233.push(link);
}
}
return _233;
},self:function(){
return this.findByRel(MapBuzz.Atom.Links.SELF)[0];
},alternates:function(){
return this.findByRel(MapBuzz.Atom.Links.ALTERNATE);
},alternate:function(_236){
var _237=this.alternates();
for(var i=0;i<_237.length;i++){
if(_237[i].mediaType==_236){
return _237[i];
}
}
return null;
}});
MapBuzz.Atom.Links.prototype.toString=function toString(){
return "Links ["+this.links.toString()+"]";
};
MapBuzz.Atom.Link=function AtomLink(uri,rel,_23b,_23c){
this.uri=uri;
this.rel=rel||MapBuzz.Atom.Links.ALTERNATE;
this.mediaType=_23b||MapBuzz.Mime.HTML;
this.title=_23c||"Title";
};
Object.extend(MapBuzz.Atom.Link,{createFromElement:function(_23d){
var uri=_23d.getAttribute("href");
var rel=_23d.getAttribute("rel");
var _240=_23d.getAttribute("title");
var _241=MapBuzz.Mime.REGISTRY[_23d.getAttribute("type")]||MapBuzz.Mime.ATOM;
return new MapBuzz.Atom.Link(uri,rel,_241,_240);
}});
Object.extend(MapBuzz.Atom.Link.prototype,{uri:function(){
return "<link rel=\""+this.rel+"\" "+"type=\""+this.type+"\" "+"href=\""+this.href+"\" "+"title=\""+this.title+"\"/>";
}});
MapBuzz.Atom.Link.prototype.toString=function toString(){
return "Link ["+this.uri+" (rel="+this.rel+")]";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Product=function Product(name,_243,_244){
this.name=name;
this.available=_243;
this.customer=_244;
};
Object.extend(MapBuzz.Atom.Product.prototype,{isAvailable:function(){
return (this.available>0);
}});
MapBuzz.Atom.Product.prototype.toString=function toString(){
return "Product ["+this.name+"]";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Person=function Person(name,uri,_247){
this.name=name;
this.uri=uri;
this.authenticated=_247;
};
Object.extend(MapBuzz.Atom.Person.prototype,{isAuthenticated:function(){
return this.authenticated;
},equals:function(_248){
return (this.uri==_248.uri);
}});
MapBuzz.Atom.Person.prototype.toString=function toString(){
return "Person ["+this.name+"]";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Category=function Category(_249,term,_24b,_24c){
if(!_249){
throw new Error("Must specify a scheme for a category");
}
this.scheme=_249;
this.domain=_24c||_249;
if(!term){
throw new Error("Must specify a label for a category");
}
this.term=term;
this.label=_24b||term;
};
Object.extend(MapBuzz.Atom.Category,{createFromElement:function(_24d){
var _24e=_24d.getAttribute("scheme");
var _24f=null;
if(_24d.getAttributeNS){
_24f=_24d.getAttributeNS(MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI,"domain");
}else{
var _250=MapBuzz.Namespace.MAPBUZZ_NAMESPACE_PREFIX+":"+"domain";
_24f=_24d.getAttribute(_250);
}
var _251=_24d.getAttribute("label");
var term=_24d.getAttribute("term");
return new MapBuzz.Atom.Category(_24e,term,_251,_24f);
}});
Object.extend(MapBuzz.Atom.Category.prototype,{id:function(){
var _253=this.scheme;
if(_253.charAt(_253.length)!="/"){
_253+="/";
}
_253+=this.term;
return _253;
},uri:function(){
var _254=this.domain;
if(_254.charAt(_254.length)!="/"){
_254+="/";
}
_254+=this.term;
return _254;
}});
MapBuzz.Atom.Category.prototype.toString=function toString(){
return "Category [Scheme: "+this.scheme+", "+"Term: "+this.term+", "+"Label: "+this.label+"]";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.VCard=function VCard(){
this.address=new MapBuzz.Atom.Address();
this.workPhone=null;
this.organization=null;
this.location=new Geometry.Point(null,null,Geometry.CrsFactory.instance.latLongCrs());
};
MapBuzz.Atom.VCard.prototype.toString=function toString(){
return "VCard";
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Entry=function AtomEntry(){
this.id=null;
this.resource=MapBuzz.Resource.Local.instance;
this.content=null;
this.author=new MapBuzz.Atom.Person("","",false);
this.links=new MapBuzz.Atom.Links();
this.categories=new Array();
this.ranks=new MapBuzz.Atom.Ranks();
this.replies=new MapBuzz.Atom.Replies();
this.images=new HashTable();
this.figures=new MapBuzz.Figure.Manager(this);
this.initialize();
};
Object.extend(MapBuzz.Atom.Entry.prototype,{initialize:function(){
},release:function(){
this.figures.release();
},releaseCommand:function(_255){
return new MapBuzz.Command.Functor("Release Feature",{execute:this.release.bind(this)});
},copy:function(_256){
if(!(_256 instanceof this.constructor)){
throw new Error("Cannot copy an object of a different type.  Object: "+_256.toString());
}
this.figures.release();
Object.extend(this,_256);
this.figures.feature=this;
this.figures.display();
return this;
},copyCommand:function(){
return new MapBuzz.Command.Functor("Copy Feature",{execute:this.copy.bind(this)});
}});
MapBuzz.Atom.Entry.prototype.toString=function toString(){
var _257="Entry ["+"Title: "+this.title+", "+"Id: "+this.id+", "+"]";
return _257;
};
namespace("MapBuzz.Atom");
MapBuzz.Atom.Replies=function Replies(){
this.links=new HashTable();
};
Object.extend(MapBuzz.Atom.Replies.prototype,{addLink:function(link){
this.links[link.mediaType]=link;
},getLink:function(_259){
_259=_259||MapBuzz.Mime.XHTML;
return this.links[_259];
}});
MapBuzz.Atom.Replies.prototype.toString=function toString(){
return "Replies";
};
namespace("MapBuzz.IO");
MapBuzz.IO.Manager=function IOManager(){
this.readers=new HashTable();
this.writers=new HashTable();
};
Object.extend(MapBuzz.IO.Manager.prototype,{read:function(data,_25b,_25c){
var _25d=this.readers[_25b];
if(!_25d){
throw new Error("Do not know how to read data.  Mime type: "+_25b);
}
return _25d.read(data,_25c);
},write:function(data,_25f){
var _260=this.writers[_25f];
if(!_260){
throw new Error("Do not know how to write data.  Mime type: "+_25f);
}
return _260.write(data);
},readCommand:function(){
return new MapBuzz.Command.Functor("Read",{execute:this.read.bind(this)});
},writeCommand:function(){
return new MapBuzz.Command.Functor("Write",{execute:this.write.bind(this)});
}});
namespace("MapBuzz.IO");
MapBuzz.IO.AbstractReader=function AbstractReader(_261){
this.factory=_261;
this.initialize();
};
Object.extend(MapBuzz.IO.AbstractReader.prototype,{initialize:function(){
},read:function(data,_263){
NotImplementedError();
}});
Object.extend(MapBuzz.Namespace,{GEO_NAMESPACE_PREFIX:"geo",GEO_NAMESPACE_URI:"http://www.w3.org/2003/01/geo/wgs84_pos#"});
MapBuzz.Namespace.register(MapBuzz.Namespace.GEO_NAMESPACE_PREFIX,MapBuzz.Namespace.GEO_NAMESPACE_URI);
MapBuzz.IO.GeoReaderMixin={getGeoGeom:function(_264){
if(_264.figures.values.length==0){
_264.figures.create(new Geometry.Point(null,null,Geometry.CrsFactory.instance.latLongCrs()));
}
return _264.figures.values[0].geom;
},handle_geo_lat:function handle_geo_lat(_265,_266){
var _267=parseFloat(this.readText(_266));
var geom=this.getGeoGeom(_265);
geom.y=_267;
},handle_geo_long:function handle_geo_long(_269,_26a){
var _26b=parseFloat(this.readText(_26a));
var geom=this.getGeoGeom(_269);
geom.x=_26b;
}};
Object.extend(MapBuzz.Namespace,{THREADING_NAMESPACE_PREFIX:"thr",THREADING_NAMESPACE_URI:"http://purl.org/syndication/thread/1.0"});
MapBuzz.Namespace.register(MapBuzz.Namespace.THREADING_NAMESPACE_PREFIX,MapBuzz.Namespace.THREADING_NAMESPACE_URI);
MapBuzz.IO.ThrReaderMixin={handle_replies_link:function handle_replies_link(_26d,_26e,link){
var _270=null;
if(_26e.getAttributeNS){
_270=_26e.getAttributeNS(MapBuzz.Namespace.THREADING_NAMESPACE_URI,"count");
}else{
_270=Element.getAttributeNS(_26e,MapBuzz.Namespace.THREADING_NAMESPACE_URI,"count");
}
link.count=parseInt(_270,10);
_26d.replies.addLink(link);
}};
Object.extend(MapBuzz.Namespace,{GD_NAMESPACE_PREFIX:"gd",GD_NAMESPACE_URI:"http://schemas.google.com/g/2005"});
MapBuzz.Namespace.register(MapBuzz.Namespace.GD_NAMESPACE_PREFIX,MapBuzz.Namespace.GD_NAMESPACE_URI);
MapBuzz.IO.GdReaderMixin={handle_gd_when:function handle_gd_when(_271,_272){
var _273=_272.getAttribute("startTime");
if(_273.empty()){
_271.start=null;
}else{
_271.start=Date.parseXmlSchema(_273);
}
var end=_272.getAttribute("endTime");
if(!end||end.empty()){
_271.end=null;
}else{
_271.end=Date.parseXmlSchema(end);
}
}};
MapBuzz.IO.MapBuzzReaderMixin={handle_mb_geometry:function handle_mb_geometry(_275,_276){
var _277=this.readWkb(_276);
if(!_277){
return;
}
var _278=_275.figures.create(_277);
var _279=_276.selectNodes("atom:link[@rel=\"edit-media\"]");
for(var i=0;i<_279.length;i++){
this.handle_atom_link(_278,_279[i]);
}
this.readMapbuzzStyle(_278,_276);
},readWkb:function(_27b){
var _27c=_27b.selectSingleNode("mb:wkb");
var wkb=this.readText(_27c);
return Geometry.io.read(wkb,MapBuzz.Mime.WKB);
},readMapbuzzStyle:function(_27e,_27f){
var _280=_27f.selectNodes("mb:style");
for(var i=0;i<_280.length;i++){
var _282=_280[i];
var _283=_282.getAttribute("pseudo_class");
var _284=_27e.styles.styles[_283];
var _285=this.readText(_282);
var _286=_285.split(";");
for(var j=0;j<_286.length;j++){
var _288=_286[j].match(/([^:]*):([^:]*)/);
if(!_288){
continue;
}
var _289=_288[1].strip();
var _28a=_288[2].strip();
_284[_289]=_28a;
}
}
},handle_mb_image:function handle_mb_image(_28b,_28c){
var _28d=new Image(_28c.getAttribute("width"),_28c.getAttribute("height"));
_28d.src=_28c.getAttribute("href");
var _28e=_28c.getAttribute("pseudo_class");
_28b.images[_28e]=_28d;
},handle_mb_booth:function handle_mb_product(_28f,_290){
_28f.booth=this.readText(_290);
},handle_mb_product:function handle_mb_product(_291,_292){
var _293=new MapBuzz.Atom.Product();
var _294=_292.firstChild;
while(_294){
var _295=_294.localName||_294.baseName;
switch(_295){
case "title":
_293.name=this.readText(_294);
break;
case "available":
_293.available=parseInt(this.readText(_294));
break;
case "author":
this.handle_atom_author(_293,_294);
_293.exhibitor=_293.author;
delete _293.author;
break;
case "line_item_value":
_293.line_item_value=this.readText(_294);
break;
}
_294=_294.nextSibling;
}
_291.product=_293;
}};
Object.extend(MapBuzz.Namespace,{GEORSS_NAMESPACE_PREFIX:"georss",GEORSS_NAMESPACE_URI:"http://www.georss.org/georss"});
MapBuzz.Namespace.register(MapBuzz.Namespace.GEORSS_NAMESPACE_PREFIX,MapBuzz.Namespace.GEORSS_NAMESPACE_URI);
MapBuzz.IO.GeorssReaderMixin={handle_georss_point:function handle_georss_point(_296,_297){
if(_297.lookupNamespaceURI&&_297.lookupNamespaceURI("mb")&&_297.selectSingleNode("../mb:geometry")){
return;
}else{
if(!_297.lookupNamespaceURI&&_297.selectSingleNode("../mb:geometry")){
return;
}
}
var _298=this.readText(_297);
var _299=_298.split(/ /);
var y=parseFloat(_299[0]);
var x=parseFloat(_299[1]);
var geom=new Geometry.Point(x,y,Geometry.CrsFactory.instance.latLongCrs());
_296.figures.create(geom);
}};
Object.extend(MapBuzz.Namespace,{XCAL_NAMESPACE_PREFIX:"xCal",XCAL_NAMESPACE_URI:"urn:ietf:params:xml:ns:xcal"});
MapBuzz.Namespace.register(MapBuzz.Namespace.XCAL_NAMESPACE_PREFIX,MapBuzz.Namespace.XCAL_NAMESPACE_URI);
MapBuzz.IO.XCalReaderMixin={included:function(){
var _29d=this.constructor.getHandlers();
_29d[MapBuzz.Namespace.XCAL_NAMESPACE_URI+":x-calconnect-venue"]=this.handle_xcal_x_calconnect_venue;
_29d[MapBuzz.Namespace.XCAL_NAMESPACE_URI+":x-calconnect-venue-name"]=this.handle_xcal_x_calconnect_venue_name;
},getVenue:function(_29e){
if(!_29e.venue){
_29e.venue=new MapBuzz.Feature.MapBuzz(_29e.dataSource);
}
return _29e.venue;
},handle_xcal_dtstart:function handle_xcal_dtstart(_29f,_2a0){
var _2a1=this.readText(_2a0);
if(_2a1.empty()){
_29f.start=null;
}else{
_29f.start=Date.parseXmlSchema(_2a1);
}
},handle_xcal_dtend:function handle_xcal_dtend(_2a2,_2a3){
var _2a4=this.readText(_2a3);
if(_2a4&&!_2a4.empty()){
_2a2.end=Date.parseXmlSchema(_2a4);
}else{
_2a2.end=null;
}
},handle_xcal_x_calconnect_venue:function handle_xcal_x_calconnect_venue(_2a5,_2a6){
this.readChildElements(_2a5,_2a6);
},handle_xcal_adr:function handle_xcal_adr(_2a7,_2a8){
this.readChildElements(_2a7,_2a8);
},handle_xcal_x_calconnect_venue_name:function handle_xcal_x_calconnect_venue_name(_2a9,_2aa){
var _2ab=this.getVenue(_2a9);
_2ab.title=this.readText(_2aa);
},handle_xcal_location:function handle_xcal_location(_2ac,_2ad){
var uri=this.readText(_2ad);
var rel=MapBuzz.Atom.Links.VENUE;
var _2b0=_2ac.title;
var _2b1=MapBuzz.Mime.HTML;
var link=new MapBuzz.Atom.Link(uri,rel,_2b1,_2b0);
var _2b3=this.getVenue(_2ac);
_2b3.links.add(link);
}};
Object.extend(MapBuzz.Namespace,{MEDIA_RSS_NAMESPACE_PREFIX:"media",MEDIA_RSS_NAMESPACE_URI:"http://search.yahoo.com/mrss/"});
MapBuzz.Namespace.register(MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_PREFIX,MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_URI);
MapBuzz.IO.MediaReaderMixinGroup=function MediaReaderMixinGroup(){
this.group=null;
this.category=null;
};
Object.extend(MapBuzz.IO.MediaReaderMixinGroup.prototype,{add:function(_2b4){
this.group=_2b4;
},addCategory:function(_2b5){
this.category=_2b5;
}});
MapBuzz.IO.MediaReaderMixin={included:function(){
var _2b6=this.constructor.getHandlers();
_2b6[MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI+":album"]=this.handle_mb_album;
_2b6[MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI+":default_icon"]=this.handle_mb_default_icon;
},handle_mb_default_icon:function handle_mb_default_icon(_2b7,_2b8){
var _2b9=new MapBuzz.IO.MediaReaderMixinGroup();
this.readChildElements(_2b9,_2b8);
var _2ba=this.factory.dataSource;
_2ba.defaultIcons[_2b9.category]=_2b9.group;
},handle_mb_album:function handle_mb_album(_2bb,_2bc){
var uri=_2bc.getAttribute("href");
var _2be=new MapBuzz.Resource.Permissions(true,true,true);
var _2bf=new MapBuzz.Resource.Remote(uri,_2be);
var type=_2bc.getAttribute("type");
var _2c1=null;
var _2c2=_2bc.selectSingleNode("atom:link[@rel=\"mb:browser\"]");
if(_2c2){
_2c1=new MapBuzz.Resource.Remote(_2c2.getAttribute("href"));
}
_2bb.iconAlbum.resource=_2bf;
_2bb.iconAlbum.browserResource=_2c1;
_2bb.iconAlbum.type=type;
this.readChildElements(_2bb.iconAlbum,_2bc);
},handle_media_group:function handle_media_group(_2c3,_2c4){
var _2c5=_2c4.selectSingleNode("atom:link[@rel=\"alternate\" and @title=\"icon_uri\"]");
var _2c6=new MapBuzz.Resource.Remote(_2c5.getAttribute("href"));
var _2c7=_2c4.selectSingleNode("media:title");
var _2c8=this.readText(_2c7);
var _2c9=new MapBuzz.Media.Group(_2c8,_2c6);
_2c3.add(_2c9);
var _2ca=_2c4.selectNodes("media:content");
for(var i=0;i<_2ca.length;i++){
this.readElement(_2c9,_2ca[i]);
}
},handle_media_content:function handle_media_content(_2cc,_2cd){
var type=_2cd.getAttribute("type");
var _2cf=parseInt(_2cd.getAttribute("width"),10);
var _2d0=parseInt(_2cd.getAttribute("height"),10);
var _2d1=null;
var _2d2="atom:category[@scheme=\""+MapBuzz.Media.PSEUDO_CLASS_SCHEME+"\"]";
var _2d3=_2cd.selectSingleNode(_2d2);
if(_2d3){
_2d1=_2d3.getAttribute("term");
}
var _2d4=new MapBuzz.Media.ImageType(_2cf,_2d1);
var _2d5=_2cd.getAttribute("medium");
_2d5=_2d5.substr(0,1).toUpperCase()+_2d5.substr(1).toLowerCase();
var uri=_2cd.getAttribute("url");
var _2d7=MapBuzz.Media[_2d5];
var _2d8=new _2d7(uri,_2d4);
var _2d9=_2cd.selectSingleNode("mb:hotspot");
if(_2d9){
var x=parseInt(_2d9.getAttribute("x"),10);
var y=parseInt(_2d9.getAttribute("y"),10);
_2d8.hotSpot=new MapBuzz.Media.HotSpot(x,y);
}
_2cc.add(_2d8);
},handle_mb_images_link:function handle_mb_images_link(_2dc,_2dd,link){
var _2df=new MapBuzz.Resource.Remote(link.uri);
_2dc.images=new MapBuzz.Media.Album(_2df,MapBuzz.Resource.Local.instance,MapBuzz.Media.Album.IMAGE_TYPE);
}};
namespace("MapBuzz.Atom");
Object.extend(MapBuzz.Namespace,{ATOM_NAMESPACE_PREFIX:"atom",ATOM_NAMESPACE_URI:"http://www.w3.org/2005/Atom"});
MapBuzz.Namespace.register(MapBuzz.Namespace.ATOM_NAMESPACE_PREFIX,MapBuzz.Namespace.ATOM_NAMESPACE_URI);
MapBuzz.IO.AtomReaderMixin={handle_atom_id:function handle_atom_id(_2e0,_2e1){
_2e0.id=this.readText(_2e1);
var link=new MapBuzz.Atom.Link(_2e0.id,MapBuzz.Atom.Links.SELF,MapBuzz.Mime.HTML,"self");
_2e0.links.add(link);
this.handle_self_link(_2e0,null,link);
},handle_atom_title:function handle_atom_title(_2e3,_2e4){
_2e3.title=this.readText(_2e4);
},handle_atom_author:function handle_atom_author(_2e5,_2e6){
var _2e7=null;
var _2e8=null;
var _2e9=_2e6.firstChild;
while(_2e9&&(!_2e7||!_2e8)){
if(_2e9.namespaceURI==MapBuzz.Namespace.ATOM_NAMESPACE_URI){
var _2ea=_2e9.nodeName;
if(_2ea=="name"){
_2e7=this.readText(_2e9);
}
if(_2ea=="uri"){
_2e8=this.readText(_2e9);
}
}
_2e9=_2e9.nextSibling;
}
_2e5.author=new MapBuzz.Atom.Person(_2e7,_2e8);
},handle_atom_content:function handle_atom_content(_2eb,_2ec){
var _2ed=_2ec.getAttribute("type")||"text";
switch(_2ed){
case "text":
case "text/plain":
_2eb.content=this.readText(_2ec);
break;
case "xhtml":
var div=_2ec.selectSingleNode("xhtml:div");
_2eb.content=this.readInnerXml(div);
break;
case "html":
case "text/html":
_2eb.content=this.readText(_2ec);
break;
default:
throw new Error("Unknown atom text type: "+_2ed);
}
},handle_atom_icon:function handle_atom_icon(_2ef,_2f0){
var uri=this.readText(_2f0);
_2ef.icon=new MapBuzz.Atom.Icon(uri);
},handle_atom_category:function handle_atom_category(_2f2,_2f3){
var _2f4=MapBuzz.Atom.Category.createFromElement(_2f3);
_2f2.addCategory(_2f4);
},handle_atom_entry:function handle_atom_entry(_2f5,_2f6){
var _2f7=this.createEntry(_2f6);
this.readChildElements(_2f7,_2f6);
this.readSource(_2f7,_2f6);
_2f5.entries.push(_2f7);
},handle_atom_link:function handle_atom_link(_2f8,_2f9){
var link=MapBuzz.Atom.Link.createFromElement(_2f9);
if(_2f8.links){
_2f8.links.add(link);
}
var _2fb=this.getLinkHandler(link);
if(_2fb){
_2fb.call(this,_2f8,_2f9,link);
}
},handle_self_link:function handleSelfLink(_2fc,_2fd,link){
var _2ff=new MapBuzz.Resource.Permissions(false,false,false);
_2fc.resource=new MapBuzz.Resource.Remote(link.uri,_2ff);
},handle_alternate_link:function handleAlternateLink(_300,_301,link){
var _303=new MapBuzz.Resource.Permissions(false,false,false);
_300.alternateResource=new MapBuzz.Resource.Remote(link.uri,_303);
}};
Object.extend(MapBuzz.Namespace,{RANK_NAMESPACE_PREFIX:"rank",RANK_NAMESPACE_URI:"http://purl.org/atompub/rank/1.0"});
MapBuzz.Namespace.register(MapBuzz.Namespace.RANK_NAMESPACE_PREFIX,MapBuzz.Namespace.RANK_NAMESPACE_URI);
MapBuzz.IO.RankReaderMixin={handle_rank_rank:function handle_rank_rank(_304,_305){
if(!_304.ranks){
return;
}
var _306=_305.getAttribute("scheme");
var _307=_305.getAttribute("domain");
var _308=_305.getAttribute("label");
var _309=this.readText(_305);
if(_309){
_309=parseFloat(_309);
}else{
_309=null;
}
var _30a=null;
if(_306==MapBuzz.Rank.MapBuzz.RANK_USER_SCHEME&&MapBuzz.user.isAuthenticated()){
_30a=new MapBuzz.Resource.Permissions(true,true,true);
}else{
_30a=new MapBuzz.Resource.Permissions(false,false,false);
}
var _30b=new MapBuzz.Resource.Remote(_307,_30a);
_304.ranks.add(new MapBuzz.Rank.Rank(_306,_309,_308,_30b));
}};
Object.extend(MapBuzz.Namespace,{APP_NAMESPACE_PREFIX:"app",APP_NAMESPACE_URI:"http://www.w3.org/2007/app"});
MapBuzz.Namespace.register(MapBuzz.Namespace.APP_NAMESPACE_PREFIX,MapBuzz.Namespace.APP_NAMESPACE_URI);
MapBuzz.IO.AppReaderMixin={handle_app_collection:function handle_app_collection(_30c,_30d){
var _30e=this.getAccepts(_30d);
var _30f=null;
if(_30e.length>0){
_30f=new MapBuzz.Resource.Permissions(true,false,false);
}else{
_30f=new MapBuzz.Resource.Permissions(false,false,false);
}
var uri=_30d.getAttribute("href");
_30c.collection=new MapBuzz.Resource.Remote(uri,_30f);
},getAccepts:function(_311){
var _312=new Array();
var _313=_311.selectSingleNode("app:accepts");
if(_313){
var text=MapBuzz.Atom.TextReader(_313);
_312=MapBuzz.Mime.parseAccept(text);
}
return _312;
},handle_edit_link:function handle_edit_link(_315,_316,link){
var _318=new MapBuzz.Resource.Permissions(false,true,true);
_315.resource=new MapBuzz.Resource.Remote(link.uri,_318);
},handle_edit_media_link:function handle_edit_media_link(_319,_31a,link){
return this.handle_edit_link(_319,_31a,link);
}};
namespace("MapBuzz.IO");
MapBuzz.IO.XmlReader=function XmlReader(_31c){
this.applySuper(arguments);
this.handlers=this.constructor.getHandlers();
};
MapBuzz.IO.XmlReader.inherits(MapBuzz.IO.AbstractReader);
Object.extend(MapBuzz.IO.XmlReader,{getHandlers:function(){
if(!this.HANDLERS){
this.HANDLERS=new HashTable();
}
return this.HANDLERS;
},mixin:function registerHandlers(uri,_31e){
var _31f=this.getHandlers();
var _320=MapBuzz.Namespace.NAMESPACES[uri].toLowerCase();
var _321=new RegExp("handle_"+_320+"_(.+)$");
for(var _322 in _31e){
if(_322=="included"){
continue;
}
var _323=_322.match(_321);
if(!_323){
continue;
}
var _324=_323[1];
var _325=uri+":"+_324;
_31f[_325]=_31e[_322];
}
Object.mixin(this.prototype,_31e);
}});
Object.extend(MapBuzz.IO.XmlReader.prototype,{getHandler:function(_326){
var _327=_326.localName||_326.baseName;
if(!_327){
return null;
}
var _328=_326.namespaceURI+":"+_327;
return this.handlers[_328];
},getRootElement:function(_329){
var _32a=null;
if(!_329){
return _32a;
}
if(_329.nodeName=="#document"){
_32a=_329.documentElement;
}else{
_32a=_329;
}
if(_32a){
MapBuzz.Namespace.initialize(_329);
}
return _32a;
},read:function(data,_32c){
NotImplementedError();
},readElement:function(_32d,_32e){
var _32f=this.getHandler(_32e);
if(_32f){
_32f.call(this,_32d,_32e);
}
return _32d;
},readChildElements:function(_330,_331){
var _332=_331.firstChild;
while(_332){
var _333=this.getHandler(_332);
if(_333){
_333.call(this,_330,_332);
}
_332=_332.nextSibling;
}
return _330;
},readText:function(_334){
if(_334.textContent){
return _334.textContent;
}else{
return _334.text;
}
},readInnerXml:function(_335){
var _336="";
var _337=null;
if(XMLSerializer){
_337=new XMLSerializer();
}
_335=_335.firstChild;
while(_335){
if(_337){
_336+=_337.serializeToString(_335);
}else{
_336+=_335.xml;
}
_335=_335.nextSibling;
}
return (_336.length==0?null:_336);
}});
namespace("MapBuzz.Atom");
Object.extend(MapBuzz.Namespace,{ATOM_NAMESPACE_PREFIX:"atom",ATOM_NAMESPACE_URI:"http://www.w3.org/2005/Atom"});
MapBuzz.Namespace.register(MapBuzz.Namespace.ATOM_NAMESPACE_PREFIX,MapBuzz.Namespace.ATOM_NAMESPACE_URI);
MapBuzz.IO.AtomReader=function AtomReader(_338){
this.applySuper(arguments);
};
MapBuzz.IO.AtomReader.inherits(MapBuzz.IO.XmlReader);
MapBuzz.IO.AtomReader.LINK_HANDLERS=new HashTable();
Object.extend(MapBuzz.IO.AtomReader.prototype,{read:function(_339,_33a){
var root=this.getRootElement(_339);
if(!root){
return null;
}
var feed=null;
if(root.tagName=="feed"){
feed=this.readFeed(root);
return feed.entries;
}else{
feed=new MapBuzz.Atom.Feed();
var _33d=this.getHandler(root);
_33d.call(this,feed,root);
return feed.entries[0];
}
},readFeed:function(_33e){
var _33f=new MapBuzz.Atom.Feed();
this.readChildElements(_33f,_33e);
return _33f;
},createEntry:function(_340){
return this.factory.create();
},readSource:function(_341,_342){
var _343=_342.selectSingleNode("atom:source");
if(!_343){
return;
}
_341.source=this.readFeed(_343);
},getLinkHandler:function(link){
var rel=link.rel.replace(/:|-/,"_");
var _346="handle_"+rel.toLowerCase()+"_link";
return this[_346];
}});
MapBuzz.IO.MapBuzzReader=function MapBuzzReader(_347){
this.applySuper(arguments);
};
MapBuzz.IO.MapBuzzReader.inherits(MapBuzz.IO.AtomReader);
MapBuzz.IO.MapBuzzReader.getHandlers=MapBuzz.IO.XmlReader.getHandlers;
MapBuzz.IO.MapBuzzReader.mixin=MapBuzz.IO.XmlReader.mixin;
Object.extend(MapBuzz.IO.MapBuzzReader.prototype,{createEntry:function(_348){
var _349=this.getTypeUri(_348);
return this.factory.create(_349);
},getTypeUri:function(_34a){
var _34b="atom:category[@scheme=\""+MapBuzz.Feature.MapBuzz.TYPE_SCHEME+"\"]";
var _34c=_34a.selectSingleNode(_34b);
if(_34c){
return (MapBuzz.Feature.MapBuzz.TYPE_SCHEME+"/"+_34c.getAttribute("term"));
}else{
return null;
}
}});
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.ATOM_NAMESPACE_URI,MapBuzz.IO.AtomReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.APP_NAMESPACE_URI,MapBuzz.IO.AppReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.GD_NAMESPACE_URI,MapBuzz.IO.GdReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.GEORSS_NAMESPACE_URI,MapBuzz.IO.GeorssReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI,MapBuzz.IO.MapBuzzReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_URI,MapBuzz.IO.MediaReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.RANK_NAMESPACE_URI,MapBuzz.IO.RankReaderMixin);
MapBuzz.IO.MapBuzzReader.mixin(MapBuzz.Namespace.THREADING_NAMESPACE_URI,MapBuzz.IO.ThrReaderMixin);
namespace("MapBuzz.Atom");
Object.extend(MapBuzz.Namespace,{YAHOO_LOCAL_NAMESPACE_PREFIX:"yahoo",YAHOO_LOCAL_NAMESPACE_URI:"urn:yahoo:lcl"});
MapBuzz.Namespace.register(MapBuzz.Namespace.YAHOO_NAMESPACE_PREFIX,MapBuzz.Namespace.YAHOO_NAMESPACE_URI);
MapBuzz.IO.YelpReader=function YahooReader(_34d){
this.applySuper(arguments);
};
MapBuzz.IO.YelpReader.inherits(MapBuzz.IO.AbstractReader);
Object.extend(MapBuzz.IO.YelpReader,{RANK_AVERAGE_SCHEME:"urn:yahoo:lcl:average",RANK_RATINGS_SCHEME:"urn:yahoo:lcl:ratings",RANK_REVIEWS_SCHEME:"urn:yahoo:lcl:reviews"});
Object.extend(MapBuzz.IO.YelpReader.prototype,{read:function(json,_34f){
json="("+json+")";
var data=eval(json);
var _351=new Array();
for(var i=0;i<data.businesses.length;i++){
this.handleResult(_351,data.businesses[i]);
}
return _351;
},handleResult:function(_353,data){
var _355=this.factory.create();
for(var key in data){
var _357="handle"+key[0].toUpperCase()+key.slice(1);
var _358=this[_357];
if(!_358){
continue;
}
_358.call(this,_355,data);
}
_353.push(_355);
},handleLatitude:function(_359,data){
var _35b=_359.figures.values[0];
_35b.geom.y=data.latitude;
},handleLongitude:function(_35c,data){
var _35e=_35c.figures.values[0];
_35e.geom.x=data.longitude;
},handleName:function(_35f,data){
_35f.title=data.name;
}});
MapBuzz.IO.ZventsReader=function ZventsReader(_361){
this.applySuper(arguments);
};
MapBuzz.IO.ZventsReader.inherits(MapBuzz.IO.MapBuzzReader);
MapBuzz.IO.ZventsReader.getHandlers=MapBuzz.IO.XmlReader.getHandlers;
MapBuzz.IO.ZventsReader.mixin=MapBuzz.IO.XmlReader.mixin;
Object.extend(MapBuzz.IO.ZventsReader.prototype,{getTypeUri:function(_362){
return MapBuzz.Feature.Event.TYPE_CATEGORY.id();
}});
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.ATOM_NAMESPACE_URI,MapBuzz.IO.AtomReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.APP_NAMESPACE_URI,MapBuzz.IO.AppReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.GD_NAMESPACE_URI,MapBuzz.IO.GdReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.GEORSS_NAMESPACE_URI,MapBuzz.IO.GeorssReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI,MapBuzz.IO.MapBuzzReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_URI,MapBuzz.IO.MediaReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.RANK_NAMESPACE_URI,MapBuzz.IO.RankReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.THREADING_NAMESPACE_URI,MapBuzz.IO.ThrReaderMixin);
MapBuzz.IO.ZventsReader.mixin(MapBuzz.Namespace.XCAL_NAMESPACE_URI,MapBuzz.IO.XCalReaderMixin);
namespace("Geometry.Json");
Geometry.Json.Reader=function GeometryJsonReader(){
this.applySuper(arguments);
};
Geometry.Json.Reader.inherits(MapBuzz.IO.AbstractReader);
Object.extend(Geometry.Json.Reader.prototype,{readArray:function(json){
var _364=new Array();
for(var i=0;i<json.length;i++){
var geom=this.read(json[i]);
_364.push(geom);
}
return _364;
},read:function(json){
var _368=Geometry.io.read(json.geom,MapBuzz.Mime.WKB);
return _368;
}});
namespace("Geometry.Wkb");
MapBuzz.Mime.WKB="vnd.ogc.wkb";
Object.extend(Geometry.Wkb,{WKB_XDR:0,WKB_NDR:1,swapEndian:function(hex){
var _36a=new Array();
for(var i=hex.length;i>0;i-=2){
_36a.push(hex.slice(i-2,i));
}
return _36a.join("");
}});
Geometry.Wkb.InputStream=function WkbInputStream(hex){
this.hex=hex;
this.pos=0;
};
Geometry.Wkb.InputStream.FRACTION_MSB=Math.pow(2,52);
Object.extend(Geometry.Wkb.InputStream.prototype,{setByteOrder:function(_36d){
this.byteOrder=_36d;
},readByte:function(){
var _36e=this.hex.slice(this.pos,this.pos+2);
this.pos+=2;
return parseInt(_36e,16);
},readInt:function(){
var _36f=this.hex.slice(this.pos,this.pos+8);
this.pos+=8;
if(this.byteOrder==Geometry.Wkb.WKB_NDR){
_36f=Geometry.Wkb.swapEndian(_36f);
}
return parseInt(_36f,16);
},readDouble:function(){
var _370=null;
var _371=this.hex.slice(this.pos,this.pos+16);
this.pos+=16;
if(this.byteOrder==Geometry.Wkb.WKB_NDR){
_371=Geometry.Wkb.swapEndian(_371);
}
var _372=_371.slice(0,3);
var _373=parseInt(_372,16);
var sign=_373&2048;
var _375=_373&2047;
var _376=_371.slice(3,16);
var _377=parseInt(_376,16);
if(_375>0&&_375<2047){
_377+=Geometry.Wkb.InputStream.FRACTION_MSB;
_370=_377*Math.pow(2,_375-1023-52);
if(sign){
_370=-_370;
}
}else{
if(_375==0){
if(_377!=0){
_370=_377*Math.pow(2,-1022-52);
if(sign){
_370=-_370;
}
}else{
if(sign==0){
_370=0;
}else{
if(sign==1){
_370=0;
}
}
}
}else{
if(_375==2047){
if(_377!=0){
_370=Number.NaN;
}else{
if(sign==1){
_370=Number.NEGATIVE_INFINITY;
}else{
if(sign==0){
_370=Number.POSITIVE_INFINITY;
}
}
}
}else{
throw new Error("Could not parse floating point number");
}
}
}
return _370;
}});
Geometry.Wkb.Reader=function WkbReader(){
this.applySuper(arguments);
this.crses=new Array();
this.dimensions=new Array();
this.readFunctions=new HashTable();
this.readFunctions[Geometry.GeometryTypes.Point]=this.readPoint;
this.readFunctions[Geometry.GeometryTypes.LineString]=this.readLineString;
this.readFunctions[Geometry.GeometryTypes.Polygon]=this.readPolygon;
this.readFunctions[Geometry.GeometryTypes.Collection]=this.readCollection;
this.readFunctions[Geometry.GeometryTypes.MultiPoint]=this.readMultiPoint;
this.readFunctions[Geometry.GeometryTypes.MultiLineString]=this.readMultiLineString;
this.readFunctions[Geometry.GeometryTypes.MultiPolygon]=this.readMultiPolygon;
};
Geometry.Wkb.Reader.inherits(MapBuzz.IO.AbstractReader);
Object.extend(Geometry.Wkb.Reader.prototype,{read:function(hex){
var _379=hex.match(/(SRID=(\d*);)?(.*)/);
hex=_379[3];
if(_379[2]){
this.processCrs(_379[2]);
}
this.stream=new Geometry.Wkb.InputStream(hex);
var _37a=this.readGeometry();
return _37a;
},readGeometry:function(){
this.stream.setByteOrder(this.stream.readByte());
var _37b=this.stream.readInt();
var _37c=_37b&255;
var hasZ=((_37b&2147483648)!=0);
if(hasZ){
this.dimensions.push(3);
}else{
this.dimensions.push(2);
}
var srid=null;
var _37f=((_37b&536870912)!=0);
if(_37f){
srid=this.stream.readInt();
}else{
srid=-1;
}
this.processCrs(srid);
var _380=this.readFunctions[_37c];
if(!_380){
throw new Error("Unsupported geometry type: "+_37c);
}
var geom=_380.call(this);
this.dimensions.pop();
this.crses.pop();
return geom;
},processCrs:function(srid){
var crs=null;
if(!srid){
crs=this.crses.last();
}else{
var _384=Number(srid);
crs=Geometry.CrsFactory.instance.create(_384);
}
this.crses.push(crs);
},readCoords:function(_385){
var _386=this.dimensions.last();
var _387=new Array(_385*_386);
for(var i=0;i<_385;i++){
for(var j=0;j<_386;j++){
var _38a=(i*_386)+j;
_387[_38a]=this.stream.readDouble();
}
}
return _387;
},readPoint:function(){
var _38b=this.readCoords(1);
return new Geometry.Point(_38b[0],_38b[1],this.crses.last());
},readLineString:function(){
var _38c=this.stream.readInt();
var _38d=this.readCoords(_38c);
var _38e=new Geometry.CoordinateArray(_38d);
return new Geometry.LineString(_38e,this.crses.last());
},readPolygon:function(){
var _38f=this.dimensions.last();
var _390=this.stream.readInt();
var _391=this.stream.readInt();
var _392=this.readCoords(_391);
var _393=_392.length/_38f;
var _394=(_393-1)*_38f;
_392.splice(_394,_38f);
if(_392.length/_38f==4){
var _395=_392.slice(0*_38f,0*_38f+_38f);
var _396=_392.slice(1*_38f,1*_38f+_38f);
var _397=_392.slice(2*_38f,2*_38f+_38f);
var _398=_392.slice(3*_38f,3*_38f+_38f);
if(_395[0]==_396[0]&&_396[1]==_397[1]&&_397[0]==_398[0]&&_398[1]==_395[1]){
var xMin=Math.min(_395[0],_397[0]);
var xMax=Math.max(_395[0],_397[0]);
var yMin=Math.min(_395[1],_397[1]);
var yMax=Math.max(_395[1],_397[1]);
return new Geometry.Envelope(xMin,yMin,xMax,yMax,this.crses.last());
}
}
var _39d=new Array(_390-1);
for(var i=0;i<_390-1;i++){
_39d[i]=this.readLineString();
}
var _39f=new Geometry.CoordinateArray(_392);
return new Geometry.Polygon(_39f,_39d,this.crses.last());
},readCollectionGeometries:function(crs){
var _3a1=new Array();
var _3a2=this.stream.readInt();
for(var i=0;i<_3a2;i++){
var _3a4=this.readGeometry();
_3a4.crs=crs;
_3a1.push(_3a4);
}
return _3a1;
},readCollection:function(_3a5){
var crs=this.crses.last();
var _3a7=new Geometry.Collection(crs);
var _3a8=this.readCollectionGeometries(crs);
if(_3a8.length==0){
return;
}
for(var i=0;i<_3a8.length;i++){
_3a7.add(_3a8[i]);
}
},readMultiPoint:function(){
var crs=this.crses.last();
var _3ab=new Geometry.MultiPoint(crs);
var _3ac=this.readCollectionGeometries(crs);
for(var i=0;i<_3ac.length;i++){
_3ab.add(_3ac[i]);
}
return _3ab;
},readMultiLineString:function(){
var crs=this.crses.last();
var _3af=new Geometry.MultiLineString(crs);
var _3b0=this.readCollectionGeometries(crs);
for(var i=0;i<_3b0.length;i++){
_3af.add(_3b0[i]);
}
return _3af;
},readMultiPolygon:function(){
var crs=this.crses.last();
var _3b3=new Geometry.MultiPolygon(crs);
var _3b4=this.readCollectionGeometries(crs);
for(var i=0;i<_3b4.length;i++){
_3b3.add(_3b4[i]);
}
return _3b3;
}});
Geometry.Wkb.OutputStream=function WkbOutputStream(){
this.hex="";
this.setByteOrder(Geometry.Wkb.WKB_NDR);
};
Object.extend(Geometry.Wkb.OutputStream.prototype,{setByteOrder:function(_3b6){
this.byteOrder=_3b6;
},padLeft:function(_3b7,_3b8){
var _3b9="";
for(;_3b8>_3b7.length;_3b8--){
_3b9+=0;
}
_3b9+=_3b7;
return _3b9;
},padRight:function(_3ba,_3bb){
var _3bc=_3ba;
for(;_3bb>_3ba.length;_3bb--){
_3bc+=0;
}
return _3bc;
},writeByte:function(_3bd){
_3bd=_3bd.toString(16).toUpperCase();
this.hex+=this.padLeft(_3bd,2);
},writeInt:function(_3be){
_3be=_3be.toString(16).toUpperCase();
_3be=this.padLeft(_3be,8);
if(this.byteOrder==Geometry.Wkb.WKB_NDR){
_3be=Geometry.Wkb.swapEndian(_3be);
}
this.hex+=_3be;
},writeDouble:function(_3bf){
var _3c0=Math.abs(_3bf);
var _3c1=Math.floor(_3c0);
var _3c2=_3c0-_3c1;
var _3c3=_3c1.toString(2);
var _3c4=this.fractionToHex(_3c2);
var _3c5=null;
var _3c6=null;
if(_3c1>=1){
_3c5=1023+_3c3.length-1;
_3c6=_3c3.slice(1)+_3c4;
}else{
var _3c7=_3c4.search(/1/);
if(_3c7==-1){
_3c5=0;
_3c6="0";
}else{
_3c5=1023-_3c7-1;
_3c6=_3c4.slice(_3c7+1);
}
}
var bin=null;
if(_3bf<0){
bin="1";
}else{
bin="0";
}
bin+=this.padLeft(_3c5.toString(2),11);
bin+=this.padRight(_3c6,52);
var _3c9="";
for(var i=0;i<8;i++){
var temp=parseInt(bin.slice(i*8,i*8+8),2);
var _3cc=temp.toString(16).toUpperCase();
_3c9+=this.padLeft(_3cc.toString(16),2);
}
if(this.byteOrder==Geometry.Wkb.WKB_NDR){
_3c9=Geometry.Wkb.swapEndian(_3c9);
}
this.hex+=_3c9;
},fractionToHex:function(_3cd){
return _3cd.toString(2).slice(2);
}});
namespace("MapBuzz.Atom");
Object.extend(MapBuzz.Namespace,{YAHOO_LOCAL_NAMESPACE_PREFIX:"yahoo",YAHOO_LOCAL_NAMESPACE_URI:"urn:yahoo:lcl"});
MapBuzz.Namespace.register(MapBuzz.Namespace.YAHOO_NAMESPACE_PREFIX,MapBuzz.Namespace.YAHOO_NAMESPACE_URI);
MapBuzz.IO.YahooLocalReader=function YahooReader(_3ce){
this.applySuper(arguments);
};
MapBuzz.IO.YahooLocalReader.inherits(MapBuzz.IO.XmlReader);
Object.extend(MapBuzz.IO.YahooLocalReader,{ELEMENT_HANDLERS:new HashTable()});
Object.extend(MapBuzz.IO.YahooLocalReader.prototype,{read:function(_3cf,_3d0){
var root=this.getRootElement(_3cf);
if(!root){
return null;
}
var _3d2=new Array();
return this.readChildElements(_3d2,root);
},handleResult:function(_3d3,_3d4){
var _3d5=this.factory.create();
this.readChildElements(_3d5,_3d4);
_3d3.push(_3d5);
},handleTitle:function(_3d6,_3d7){
_3d6.title=this.readText(_3d7);
},handleAddress:function(_3d8,_3d9){
_3d8.address.address=this.readText(_3d9);
},handleCity:function(_3da,_3db){
_3da.address.locality=this.readText(_3db);
},handleState:function(_3dc,_3dd){
_3dc.address.region=this.readText(_3dd);
},handlePhone:function(_3de,_3df){
_3de.workPhone=this.readText(_3df);
},handleLatitude:function(_3e0,_3e1){
var _3e2=_3e0.figures.values[0];
_3e2.geom.y=parseFloat(this.readText(_3e1));
},handleLongitude:function(_3e3,_3e4){
var _3e5=_3e3.figures.values[0];
_3e5.geom.x=parseFloat(this.readText(_3e4));
},handleRatings:function(_3e6,_3e7){
return this.readChildElements(_3e6,_3e7);
},handleAverageRating:function(_3e8,_3e9){
var _3ea=parseFloat(this.readText(_3e9));
if(isNaN(_3ea)){
_3ea=0;
}
var rank=new MapBuzz.Rank.Rank(MapBuzz.Rank.Yahoo.RANK_AVERAGE_SCHEME,_3ea,"Average Rating");
_3e8.ranks.add(rank);
},handleTotalRatings:function(_3ec,_3ed){
var _3ee=parseFloat(this.readText(_3ed));
if(isNaN(_3ee)){
_3ee=0;
}
var rank=new MapBuzz.Rank.Rank(MapBuzz.Rank.Yahoo.RANK_RATINGS_SCHEME,_3ee,"Ratings");
_3ec.ranks.add(rank);
},handleTotalReviews:function(_3f0,_3f1){
var _3f2=parseFloat(this.readText(_3f1));
if(isNaN(_3f2)){
_3f2=0;
}
_3f0.replies.count=_3f2;
},handleUpdatedOn:function(_3f3,_3f4){
},handleUrl:function(_3f5,_3f6){
var _3f7=new MapBuzz.Resource.Permissions(false,false,false);
var uri=this.readText(_3f6);
var link=new MapBuzz.Atom.Link(uri,"alternate","text/html","Alternate");
_3f5.links.add(link);
_3f5.resource=new MapBuzz.Resource.Remote(uri,_3f7);
_3f5.replies.link.uri=link.uri;
},handleBusinessUrl:function(_3fa,_3fb){
}});
MapBuzz.IO.MediaJsonReader=function MediaJsonReader(){
};
Object.extend(MapBuzz.IO.MediaJsonReader.prototype,{read:function(json){
if(json.album){
return this.readAlbum(json.album);
}else{
if(json.group){
return this.readGroup(json.group);
}else{
throw new Error("Cannot parse icon json response.");
}
}
},readAlbum:function(json){
var _3fe=new MapBuzz.Resource.Permissions(true,true,true);
var _3ff=new MapBuzz.Resource.Remote(json.href,_3fe);
var _400=new MapBuzz.Resource.Remote(json.browser);
var _401=new MapBuzz.Media.Album(_3ff,_400,json.type);
for(var i=0;i<json.groups.length;i++){
var _403=this.readGroup(json.groups[i]);
_401.add(_403);
}
return _401;
},readGroup:function(json){
var _405=new MapBuzz.Resource.Remote(json.icon_uri);
var _406=new MapBuzz.Media.Group(json.title,_405);
for(var i=0;i<json.representations.length;i++){
this.readRepresentations(_406,json.representations[i]);
}
return _406;
},readRepresentations:function(_408,json){
var _40a=new MapBuzz.Media.ImageType(json.width,json.pseudo_class);
var _40b=json.medium;
_40b=_40b.substr(0,1).toUpperCase()+_40b.substr(1).toLowerCase();
var _40c=MapBuzz.Media[_40b];
var _40d=new _40c(json.uri,_40a);
if(json.hotSpot){
_40d.hotSpot=new MapBuzz.Media.HotSpot(json.hotSpot.x,json.hotSpot.y);
}
_408.add(_40d);
}});
namespace("MapBuzz.IO");
MapBuzz.IO.AbstractWriter=function AbstractWriter(_40e){
this.accessors=new HashTable(_40e);
};
Object.extend(MapBuzz.IO.AbstractWriter.prototype,{write:function(_40f){
this.writeAccessors();
},writeAccessors:function(_410){
var _411="";
var _412=this.accessors.keys();
for(var i=0;i<_412.length;i++){
var _414=_412[i];
var _415=_410[_414];
if(typeof _415=="undefined"||_415==null){
continue;
}
var _416=this.accessors[_414];
var _417=this[_416];
_411+=_417.call(this,_410,_415);
}
return _411;
}});
MapBuzz.IO.GdWriterMixin={included:function(){
this.register(MapBuzz.Namespace.GD_NAMESPACE_PREFIX,MapBuzz.Namespace.GD_NAMESPACE_URI);
},handleWhen:function(_418,time){
var _41a=time;
var end=_418.end;
return "<gd:when startTime=\""+_41a.toXmlSchema()+"\" "+"endTime=\""+end.toXmlSchema()+"\"/>";
}};
MapBuzz.IO.MapBuzzWriterMixin={included:function(){
this.register(MapBuzz.Namespace.MAPBUZZ_NAMESPACE_PREFIX,MapBuzz.Namespace.MAPBUZZ_NAMESPACE_URI);
},handleFigures:function(_41c,_41d){
var _41e="";
var _41f=_41d.values;
for(var i=0;i<_41f.length;i++){
_41e+=this.writeFigure(_41f[i]);
}
return _41e;
},writeFigure:function(_421){
var _422="<mb:geometry>";
_422+=this.writeWKB(_421);
_422+=this.writeStyles(_421);
_422+=this.writeLinks(_421);
_422+="</mb:geometry>";
return _422;
},writeWKB:function(_423){
return "<mb:wkb>"+Geometry.io.write(_423.geom,MapBuzz.Mime.WKB)+"</mb:wkb>";
},writeStyles:function(_424){
var _425="";
var _426=_424.styles.styles;
var _427=_426.keys();
for(var i=0;i<_427.length;i++){
var _429=_427[i];
var _42a=_426[_429];
_425+="<mb:style "+"pseudo_class=\""+_429+"\">"+_42a.cssText()+"</mb:style>";
}
return _425;
},writeLinks:function(_42b){
var _42c="";
var _42d=_42b.links.links;
for(var i=0;i<_42d.length;i++){
var link=_42d[i];
_42c+=" <link rel=\""+link.rel+"\" "+"type=\""+link.mediaType+"\" "+"href=\""+link.uri+"\" "+"title=\""+link.title+"\"/>";
}
return _42c;
}};
namespace("MapBuzz.Media");
MapBuzz.IO.MediaWriterMixin={included:function(){
this.register(MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_PREFIX,MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_URI);
},handleAlbum:function(_430,_431){
var _432="<mb:album type=\""+_431.type+"\" "+"href=\""+(_431.resource.uri?_431.resource.uri:"")+"\">";
if(_431.type==MapBuzz.Media.Album.ICON_TYPE){
_432+=this.handleIconAlbum(_430,_431);
}else{
_432+=this.handleImageAlbum(_430,_431);
}
_432+="</mb:album>";
return _432;
},handleIconAlbum:function handleAlbum(_433,_434){
var _435=_434.defaultGroup();
if(!_435){
_435=_433.dataSource.defaultIcons[_433.constructor.TYPE_CATEGORY];
}
if(_435){
return this.writeGroup(_435);
}
},handleImageAlbum:function handleAlbum(_436,_437){
var _438="";
var _439=_437.groups.keys();
for(var i=0;i<_439.length;i++){
var _43b=_439[i];
var _43c=_437.groups[_43b];
_438+=this.writeGroup(_43c);
}
return _438;
},writeGroup:function(_43d){
return "<media:group xmlns:media=\""+MapBuzz.Namespace.MEDIA_RSS_NAMESPACE_URI+"\">"+"<media:title type=\"html\">"+_43d.title.escapeHTML()+"</media:title>"+this.writeMediaContent(_43d)+"</media:group>";
},writeMediaContent:function(_43e){
var _43f="";
var keys=_43e.representations.keys();
for(var i=0;i<keys.length;i++){
var key=keys[i];
var _443=_43e.representations[key];
_43f+="<media:content url=\""+_443.resource.uri+"\" "+"type=\"image/png\" "+"medium=\"image\" "+"width=\""+_443.imageType.size+"\" "+"height=\""+_443.imageType.size+"\"/>";
}
return _43f;
}};
MapBuzz.IO.RankWriterMixin={included:function(){
this.register(MapBuzz.Namespace.RANK_NAMESPACE_PREFIX,MapBuzz.Namespace.RANK_NAMESPACE_URI);
},handleRanks:function(_444,_445){
var _446="";
var _447=(_445?_445.values():new Array());
for(var i=0;i<_447.length;i++){
_446+=this.writeRank(_447[i]);
}
return _446;
},writeRank:function(rank){
return "<rank:rank domain=\""+(rank.domain?rank.domain:"")+"\" "+"scheme=\""+rank.scheme+"\" "+"label=\""+rank.label+"\">"+(rank.value?rank.value:"")+"</rank:rank>";
}};
MapBuzz.IO.AppWriterMixin={included:function(){
this.register(MapBuzz.Namespace.APP_NAMESPACE_PREFIX,MapBuzz.Namespace.APP_NAMESPACE_URI);
},handleCollection:function(_44a,_44b){
},handleEditLink:function(_44c,_44d,link){
}};
namespace("MapBuzz.IO");
MapBuzz.IO.XmlWriter=function XmlWriter(_44f){
this.applySuper(arguments);
};
MapBuzz.IO.XmlWriter.inherits(MapBuzz.IO.AbstractWriter);
Object.extend(MapBuzz.IO.XmlWriter.prototype,{register:function(_450,uri){
if(!this.hasOwnProperty("namespaces")){
this.namespaces=new HashTable(this.namespaces);
}
this.namespaces[_450]=uri;
},write:function(_452){
var _453=this.writePIs(_452);
_453+=this.writeAccessors(_452);
return _453;
},writePIs:function(_454){
return "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
}});
namespace("MapBuzz.IO");
MapBuzz.IO.AtomWriter=function AtomWriter(_455){
this.applySuper(arguments);
};
MapBuzz.IO.AtomWriter.inherits(MapBuzz.IO.XmlWriter);
MapBuzz.IO.AtomWriter.prototype.register(MapBuzz.Namespace.XHTML_NAMESPACE_PREFIX,MapBuzz.Namespace.XHTML_NAMESPACE_URI);
Object.extend(MapBuzz.IO.AtomWriter.prototype,{write:function(_456){
var _457=this.writePIs(_456);
_457+=this.writeEntry(_456);
return _457;
},writeEntry:function(_458){
var _459="<entry xmlns=\""+MapBuzz.Namespace.ATOM_NAMESPACE_URI+"\"";
var _45a=this.namespaces.keys();
for(var i=0;i<_45a.length;i++){
var _45c=_45a[i];
var uri=this.namespaces[_45c];
_459+=" xmlns:"+_45c+"=\""+uri+"\"";
}
_459+=">";
_459+=this.writeAccessors(_458);
_459+="</entry>";
return _459;
},handleId:function(_45e){
return "<id>"+(_45e.id?_45e.id:"")+"</id>";
},handleTitle:function(_45f){
return "<title>"+_45f.title.escapeHTML()+"</title>";
},handleAuthor:function(_460){
return "<author>"+"<name>"+_460.author.name.escapeHTML()+"</name>"+"<uri>"+_460.author.uri+"</uri>"+"</author>";
},handleContent:function(_461){
return "<content type=\"xhtml\" xml:lang=\"en-US\">"+"<"+MapBuzz.Namespace.XHTML_NAMESPACE_PREFIX+":div>"+_461.content+"</"+MapBuzz.Namespace.XHTML_NAMESPACE_PREFIX+":div>"+"</content>";
},handleCategories:function(_462){
var _463="";
for(var i=0;i<_462.categories.values().length;i++){
var _465=_462.categories.values()[i];
for(var j=0;j<_465.length;j++){
var _467=_465[j];
var _468=_467.scheme?_467.scheme.escapeHTML():"";
var term=_467.term?_467.term.escapeHTML():"";
_463+="<category label=\""+_467.label.escapeHTML()+"\" "+"scheme=\""+_468+"\" "+"term=\""+term+"\"/>";
}
}
return _463;
}});
MapBuzz.IO.AtomWriter.prototype.toString=function toString(){
return "AtomWriter";
};
namespace("MapBuzz.Figure.Json");
MapBuzz.Figure.Json.Writer=function GeometryJsonWriter(){
this.applySuper(arguments);
};
MapBuzz.Figure.Json.Writer.inherits(MapBuzz.IO.AbstractWriter);
Object.extend(MapBuzz.Figure.Json.Writer.prototype,{write:function(_46a){
var _46b=new Object();
_46b.geom=Geometry.io.write(_46a.geom,MapBuzz.Mime.WKB);
_46b.styles=this.writeStyles(_46a.styles);
return Object.toJSON(_46b);
},writeStyles:function(_46c){
var _46d=new Object();
var keys=_46c.styles.keys();
for(var i=0;i<keys.length;i++){
var _470=keys[i];
var _471=_46c.styles[_470];
_46d[_470]=_471.cssText();
}
return _46d;
}});
namespace("Geometry.Json");
Geometry.Json.Writer=function GeometryJsonWriter(){
this.applySuper(arguments);
};
Geometry.Json.Writer.inherits(MapBuzz.IO.AbstractWriter);
Object.extend(Geometry.Json.Writer.prototype,{write:function(geom){
var _473=this.buildGeometry(geom);
return Object.toJSON(_473);
},writeArray:function(_474){
var _475=this.buildArray(_474);
return _475.toJSON();
},buildArray:function(_476){
var _477=new Array();
for(var i=0;i<_476.length;i++){
var geom=_476[i];
_477.push(this.buildGeometry(geom));
}
return _477;
},buildGeometry:function(geom){
var _47b=new Object();
_47b.geom=Geometry.io.write(geom,MapBuzz.Mime.WKB);
return _47b;
}});
namespace("MapBuzz.IO");
MapBuzz.IO.MapBuzzWriter=function MapBuzzWriter(){
var _47c={id:"handleId",title:"handleTitle",content:"handleContent",ranks:"handleRanks",categories:"handleCategories",figures:"handleFigures",iconAlbum:"handleAlbum",start:"handleWhen"};
this.callSuper(arguments.callee,_47c);
};
MapBuzz.IO.MapBuzzWriter.inherits(MapBuzz.IO.AtomWriter);
Object.mixin(MapBuzz.IO.MapBuzzWriter.prototype,MapBuzz.IO.AppWriterMixin);
Object.mixin(MapBuzz.IO.MapBuzzWriter.prototype,MapBuzz.IO.GdWriterMixin);
Object.mixin(MapBuzz.IO.MapBuzzWriter.prototype,MapBuzz.IO.MapBuzzWriterMixin);
Object.mixin(MapBuzz.IO.MapBuzzWriter.prototype,MapBuzz.IO.MediaWriterMixin);
Object.mixin(MapBuzz.IO.MapBuzzWriter.prototype,MapBuzz.IO.RankWriterMixin);
MapBuzz.IO.MapBuzzWriter.prototype.toString=function toString(){
return "MapBuzzWriter";
};
namespace("Geometry.Wkb");
Geometry.Wkb.OutputStream=function WkbOutputStream(){
this.hex="";
this.setByteOrder(Geometry.Wkb.WKB_NDR);
};
Object.extend(Geometry.Wkb.OutputStream.prototype,{setByteOrder:function(_47d){
this.byteOrder=_47d;
},padLeft:function(_47e,_47f){
var _480="";
for(;_47f>_47e.length;_47f--){
_480+=0;
}
_480+=_47e;
return _480;
},padRight:function(_481,_482){
var _483=_481;
for(;_482>_481.length;_482--){
_483+=0;
}
return _483;
},writeByte:function(_484){
_484=_484.toString(16).toUpperCase();
this.hex+=this.padLeft(_484,2);
},writeInt:function(_485){
_485=_485.toString(16).toUpperCase();
_485=this.padLeft(_485,8);
if(this.byteOrder==Geometry.Wkb.WKB_NDR){
_485=Geometry.Wkb.swapEndian(_485);
}
this.hex+=_485;
},writeDouble:function(_486){
var _487=Math.abs(_486);
var _488=Math.floor(_487);
var _489=_487-_488;
var _48a=_488.toString(2);
var _48b=this.fractionToHex(_489);
var _48c=null;
var _48d=null;
if(_488>=1){
_48c=1023+_48a.length-1;
_48d=_48a.slice(1)+_48b;
}else{
var _48e=_48b.search(/1/);
if(_48e==-1){
_48c=0;
_48d="0";
}else{
_48c=1023-_48e-1;
_48d=_48b.slice(_48e+1);
}
}
var bin=null;
if(_486<0){
bin="1";
}else{
bin="0";
}
bin+=this.padLeft(_48c.toString(2),11);
bin+=this.padRight(_48d,52);
var _490="";
for(var i=0;i<8;i++){
var temp=parseInt(bin.slice(i*8,i*8+8),2);
var _493=temp.toString(16).toUpperCase();
_490+=this.padLeft(_493.toString(16),2);
}
if(this.byteOrder==Geometry.Wkb.WKB_NDR){
_490=Geometry.Wkb.swapEndian(_490);
}
this.hex+=_490;
},fractionToHex:function(_494){
return _494.toString(2).slice(2);
}});
Geometry.Wkb.Writer=function WkbWriter(){
this.applySuper(arguments);
this.dimensions=2;
this.writeFunctions=new HashTable();
this.writeFunctions[Geometry.GeometryTypes.Point]=this.writePoint;
this.writeFunctions[Geometry.GeometryTypes.LineString]=this.writeLineString;
this.writeFunctions[Geometry.GeometryTypes.Envelope]=this.writeEnvelope;
this.writeFunctions[Geometry.GeometryTypes.Polygon]=this.writePolygon;
this.writeFunctions[Geometry.GeometryTypes.Collection]=this.writeCollection;
this.writeFunctions[Geometry.GeometryTypes.MultiPoint]=this.writeCollection;
this.writeFunctions[Geometry.GeometryTypes.MultiLineString]=this.writeCollection;
this.writeFunctions[Geometry.GeometryTypes.MultiPolygon]=this.writeCollection;
};
Geometry.Wkb.Writer.inherits(MapBuzz.IO.AbstractWriter);
Object.extend(Geometry.Wkb.Writer.prototype,{write:function(geom,_496){
this.stream=new Geometry.Wkb.OutputStream();
if(_496!=null){
this.stream.setByteOrder(_496);
}
return this.writeGeometry(geom);
},writeGeometry:function(geom){
this.stream.writeByte(this.stream.byteOrder);
var _498=0;
if(geom.crs&&geom.crs.constructor.EPSG>0){
_498+=Math.pow(2,29);
}
_498+=geom.getOpenGisGeomTypeId();
this.stream.writeInt(_498);
if(geom.crs&&geom.crs.constructor.EPSG>0){
this.stream.writeInt(geom.crs.constructor.EPSG);
}
var _499=this.writeFunctions[geom.getGeomTypeId()];
if(!_499){
throw new Error("Unsupported geometry type: "+geom.getGeomType());
}
_499.call(this,geom);
return this.stream.hex;
},writeCoord:function(x,y){
this.stream.writeDouble(x);
this.stream.writeDouble(y);
},writeCoords:function(_49c){
for(var i=0;i<_49c.getNumberOfCoords();++i){
this.writeCoord(_49c.getX(i),_49c.getY(i));
}
},writePoint:function(geom){
this.writeCoord(geom.x,geom.y);
},writeLineString:function(geom){
var _4a0=geom.coords.getNumberOfCoords();
this.stream.writeInt(_4a0);
this.writeCoords(geom.coords);
},writeEnvelope:function(geom){
this.stream.writeInt(1);
this.stream.writeInt(5);
this.stream.writeDouble(geom.xMin);
this.stream.writeDouble(geom.yMin);
this.stream.writeDouble(geom.xMin);
this.stream.writeDouble(geom.yMax);
this.stream.writeDouble(geom.xMax);
this.stream.writeDouble(geom.yMax);
this.stream.writeDouble(geom.xMax);
this.stream.writeDouble(geom.yMin);
this.stream.writeDouble(geom.xMin);
this.stream.writeDouble(geom.yMin);
},writePolygon:function(geom){
var _4a3=geom.innerRings.length;
this.stream.writeInt(_4a3+1);
var _4a4=geom.coords.getNumberOfCoords();
_4a4+=1;
this.stream.writeInt(_4a4);
this.writeCoords(geom.coords);
this.writeCoord(geom.coords.getX(0),geom.coords.getY(0));
for(var i=0;i<_4a3;i++){
var _4a6=geom.innerRings[i];
this.writeLineString(_4a6);
}
},writeCollection:function(_4a7){
var _4a8=_4a7.geoms;
this.stream.writeInt(_4a8.length);
for(var i=0;i<_4a8.length;i++){
this.writeGeometry(_4a8[i]);
}
}});
if(Browser.instance.isOpera()){
Geometry.Wkb.OutputStream.prototype.fractionToHex=function fractionToHex(_4aa){
var _4ab="";
for(var i=1;i<64;i++){
var _4ad=_4aa%Math.pow(2,-i);
if(_4ad==0){
_4ab+="1";
return _4ab;
}else{
if(_4ad==_4aa){
_4ab+="0";
}else{
_4ab+="1";
_4aa=_4ad;
}
}
}
return _4ab;
};
}
namespace("MapBuzz.Media");
Object.extend(MapBuzz.Media,{PSEUDO_CLASS_NORMAL:"",PSEUDO_CLASS_HOVER:"hover",IMAGE_SIZE_PHOTO:640,IMAGE_SIZE_LOGO:200,IMAGE_SIZE_EXTRA_LARGE:150,IMAGE_SIZE_LARGE:100,IMAGE_SIZE_MEDIUM:64,IMAGE_SIZE_SMALL:32,MEDIA_SCHEME:"http://www.mapbuzz.com/media",PSEUDO_CLASS_SCHEME:"http://www.mapbuzz.com/pseudo_class"});
MapBuzz.Media.Group=function MediaGroup(_4ae,_4af){
this.title=_4ae;
this.resource=_4af;
this.representations=new HashTable();
};
Object.extend(MapBuzz.Media.Group,{createFromJson:function(data){
var _4b1=new MapBuzz.IO.MediaJsonReader();
return _4b1.read(data);
}});
Object.extend(MapBuzz.Media.Group.prototype,{getId:function(){
return this.resource.uri;
},add:function(_4b2){
this.representations[_4b2.imageType.getKey()]=_4b2;
},get:function(_4b3){
return this.representations[_4b3.getKey()];
},createImages:function(_4b4){
this.representation=new HashTable();
var _4b5=MapBuzz.Media.ImageType.IMAGE_TYPES;
for(var i=0;i<_4b5.length;i++){
var _4b7=_4b5[i];
var _4b8="icon_"+_4b4+"_"+_4b7.size;
if(_4b7.pseudoClass){
_4b8+="_"+_4b7.pseudoClass;
}
_4b8+=".png";
var uri="/icons_user/"+_4b8;
var _4ba=new MapBuzz.Media.Image(uri,_4b7);
this.add(_4ba);
}
var icon=this.get(MapBuzz.Media.ImageType.SMALL);
icon.hotSpot=new MapBuzz.Media.HotSpot(MapBuzz.Media.IMAGE_SIZE_SMALL/2,MapBuzz.Media.IMAGE_SIZE_SMALL);
icon=this.get(MapBuzz.Media.ImageType.SMALL_HOVER);
icon.hotSpot=new MapBuzz.Media.HotSpot(MapBuzz.Media.IMAGE_SIZE_SMALL/2,MapBuzz.Media.IMAGE_SIZE_SMALL);
}});
MapBuzz.Media.Group.prototype.toString=function toString(){
return "Media Group ["+this.title+"]";
};
namespace("MapBuzz.Media");
MapBuzz.Media.ImageType=function MediaImageType(size,_4bd){
this.size=size;
this.pseudoClass=_4bd;
};
Object.extend(MapBuzz.Media.ImageType.prototype,{copy:function(){
return new MapBuzz.Media.ImageType(this.size,this.pseudoClass);
},getKey:function(){
var _4be=(this.size+"-"+this.size);
if(this.pseudoClass){
_4be+=("-"+this.pseudoClass);
}
return _4be;
},isPhoto:function(){
return (this.size==MapBuzz.Media.IMAGE_SIZE_PHOTO);
}});
MapBuzz.Media.ImageType.prototype.toString=function toString(){
return "ImageType [size: "+this.size+", pseudoClass: "+this.pseudoClass+"]";
};
MapBuzz.Media.ImageType.SMALL=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_SMALL,MapBuzz.Media.PSEUDO_CLASS_NORMAL);
MapBuzz.Media.ImageType.SMALL_HOVER=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_SMALL,MapBuzz.Media.PSEUDO_CLASS_HOVER);
MapBuzz.Media.ImageType.MEDIUM=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_MEDIUM,MapBuzz.Media.PSEUDO_CLASS_NORMAL);
MapBuzz.Media.ImageType.LARGE=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_LARGE,MapBuzz.Media.PSEUDO_CLASS_NORMAL);
MapBuzz.Media.ImageType.EXTRA_LARGE=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_EXTRA_LARGE,MapBuzz.Media.PSEUDO_CLASS_NORMAL);
MapBuzz.Media.ImageType.LOGO=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_LOGO,MapBuzz.Media.PSEUDO_CLASS_NORMAL);
MapBuzz.Media.ImageType.PHOTO=new MapBuzz.Media.ImageType(MapBuzz.Media.IMAGE_SIZE_PHOTO,MapBuzz.Media.PSEUDO_CLASS_NORMAL);
MapBuzz.Media.ImageType.IMAGE_TYPES=[MapBuzz.Media.ImageType.SMALL,MapBuzz.Media.ImageType.SMALL_HOVER,MapBuzz.Media.ImageType.MEDIUM,MapBuzz.Media.ImageType.LARGE,MapBuzz.Media.ImageType.EXTRA_LARGE,MapBuzz.Media.ImageType.LOGO,MapBuzz.Media.ImageType.PHOTO];
namespace("MapBuzz.Media");
MapBuzz.Media.HotSpot=function MediaHotSpot(x,y){
this.x=x;
this.y=y;
};
MapBuzz.Media.HotSpot.prototype.toString=function toString(){
return "HotSpot [x: "+this.x+", y: "+this.y+"]";
};
namespace("MapBuzz.Media");
MapBuzz.Media.Album=function MediaAlbum(_4c1,_4c2,type){
this.resource=_4c1;
this.browserResource=_4c2;
this.type=type;
this.io=this.constructor.IO_MANAGER;
this.io.readers[MapBuzz.Mime.JSON]=new MapBuzz.IO.MediaJsonReader();
this.groups=new HashTable();
};
Object.extend(MapBuzz.Media.Album,{ICON_TYPE:"icon",IMAGE_TYPE:"image",createFromJson:function(data){
var _4c5=new MapBuzz.IO.MediaJsonReader();
return _4c5.read(data);
},createAlbum:function(_4c6,_4c7,type){
var _4c9=null;
if(_4c6){
var _4ca=new MapBuzz.Resource.Permissions(true,true,true);
_4c9=new MapBuzz.Resource.Remote(_4c6,_4ca);
}else{
_4c9=MapBuzz.Resource.Local.instance;
}
var _4cb=new MapBuzz.Resource.Remote(_4c7);
return new MapBuzz.Media.Album(_4c9,_4cb,type);
},IO_MANAGER:new MapBuzz.IO.Manager()});
MapBuzz.Media.Album.IO_MANAGER.readers[MapBuzz.Mime.JSON]=new MapBuzz.IO.MediaJsonReader();
Object.extend(MapBuzz.Media.Album.prototype,{defaultGroup:function(){
var _4cc=this.groups.values();
return _4cc[0];
},add:function(_4cd){
this.groups[_4cd.getId()]=_4cd;
},get:function(id){
return this.groups[id];
},clear:function(){
this.groups=new HashTable();
},readCommand:function(){
var _4cf=new MapBuzz.Command.Functor("Read Album",{execute:function(){
return {accept:MapBuzz.Mime.JSON};
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Loading",MapBuzz.Message.PROCESSING),_4cf,this.resource.getCommand(),this.io.readCommand());
},insertCommand:function(){
var _4d0=new MapBuzz.Command.Functor("Insert Album",{execute:function(icon){
return {accept:MapBuzz.Mime.JSON,parameters:"icon_id="+icon.getId()};
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Saving",MapBuzz.Message.PROCESSING),_4d0,this.resource.postCommand(),this.io.readCommand());
},removeCommand:function(icon){
var _4d3=new MapBuzz.Command.Functor("Remove Album",{execute:function(){
var _4d4=new HashTable({resource:"member",icon_id:icon.getId()});
return {accept:MapBuzz.Mime.JSON,parameters:_4d4.toQueryString()};
}.bind(this)});
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Removing",MapBuzz.Message.PROCESSING),_4d3,this.resource.deleteCommand(),this.io.readCommand());
}});
MapBuzz.Media.Album.prototype.toString=function toString(){
return "Media Album ["+this.title+"]";
};
namespace("MapBuzz.Media");
MapBuzz.Media.Image=function MediaImage(uri,_4d6){
this.imageType=_4d6;
this.resource=new MapBuzz.Resource.Remote(uri);
};
Object.extend(MapBuzz.Media.Image,{uriRegExp:/icon_(\d*)_(\d*)(?:_(\w*))?.png/,createFromUri:function(uri){
var _4d8=uri.match(MapBuzz.Media.Image.uriRegExp);
var id=_4d8[1];
var _4da=_4d8[2];
var _4db=_4d8[2];
var _4dc=_4d8[3];
var _4dd=new MapBuzz.Media.ImageType(_4da,_4dc);
return new MapBuzz.Media.Image(uri,_4dd);
}});
Object.extend(MapBuzz.Media.Image.prototype,{getId:function(){
var _4de=this.resource.uri.match(MapBuzz.Media.Image.uriRegExp);
return _4de[1];
}});
MapBuzz.Media.Image.prototype.toString=function toString(){
return "Media Content ["+this.resource.uri+"]";
};
namespace("Geometry");
Geometry.Coordinate=function Coordinate(x,y){
if(isNaN(x)){
throw new Error("x value cannot be NaN.");
}
if(isNaN(y)){
throw new Error("y value cannot be NaN.");
}
this.x=x;
this.y=y;
};
Object.extend(Geometry.Coordinate.prototype,{copy:function(){
return new this.constructor(this.x,this.y);
},equals:function(_4e1){
return (this.x==_4e1.x&&this.y==_4e1.y);
},getDistance:function(){
return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2));
},getDistanceTo:function(_4e2){
return Math.sqrt(Math.pow(this.x-_4e2.x,2)+Math.pow(this.y-_4e2.y,2));
},transform:function(_4e3){
var _4e4=[this.x,this.y];
_4e3.convert(_4e4);
this.x=_4e4[0];
this.y=_4e4[1];
return this;
},transformToCrs:function(_4e5,_4e6){
return this.transform(_4e5);
},toQueryParam:function(){
return this.x+","+this.y;
}});
Geometry.Coordinate.prototype.toString=function toString(){
var _4e7="Coordinate [ "+"x: "+this.x+", "+"y: "+this.y+"]";
return _4e7;
};
Geometry.CoordinateArray=function CoordinateArray(_4e8){
this.coords=_4e8||new Array();
this.bounds=null;
};
Object.extend(Geometry.CoordinateArray.prototype,{copy:function(){
var _4e9=this.coords.slice(0,this.coords.length);
return new this.constructor(_4e9);
},getCoord:function(_4ea){
var base=_4ea*2;
return new Geometry.Coordinate(this.coords[base],this.coords[base+1]);
},getX:function(_4ec){
return this.coords[_4ec*2];
},getY:function(_4ed){
return this.coords[(_4ed*2)+1];
},getLength:function(){
return this.coords.length/2;
},getNumberOfCoords:function(){
return this.coords.length/2;
},pop:function(){
var y=this.coords.pop();
var x=this.coords.pop();
this.bounds=null;
return new Geometry.Coordinate(x,y);
},push:function(_4f0){
this.coords.push(_4f0.x);
this.coords.push(_4f0.y);
this.bounds=null;
},top:function(){
return this.getCoord(this.getNumberOfCoords()-1);
},update:function(_4f1,_4f2){
var base=_4f1*2;
this.coords[base]=_4f2.x;
this.coords[base+1]=_4f2.y;
this.bounds=null;
},remove:function(_4f4){
var base=_4f4*2;
this.coords.splice(base,2);
this.bounds=null;
},getBounds:function(crs){
if(!this.bounds){
var xMin=this.coords[0];
var yMin=this.coords[1];
var xMax=this.coords[0];
var yMax=this.coords[1];
for(var i=2;i<this.coords.length;i+=2){
var x=this.coords[i];
var y=this.coords[i+1];
xMin=Math.min(xMin,x);
yMin=Math.min(yMin,y);
xMax=Math.max(xMax,x);
yMax=Math.max(yMax,y);
}
this.bounds=new Geometry.Envelope(xMin,yMin,xMax,yMax,crs);
}
return this.bounds;
},transform:function(_4fe){
_4fe.convert(this.coords);
this.bounds=null;
return this;
},coordsAsString:function(_4ff,_500,_501,end,_503){
_4ff=_4ff||", ";
_500=_500||" ";
_501=(_501*2)||0;
end=(end*2)||this.coords.length;
_503=_503||false;
var _504=new Array();
for(var i=_501;i<end;i+=2){
var x=this.coords[i];
var y=this.coords[i+1];
if(_503){
x=Math.round(x);
y=Math.round(y);
}
_504.push(x+_500+y);
}
return _504.join(_4ff);
}});
Geometry.CoordinateArray.prototype.toString=function toString(){
return ("CoordinateArray ["+this.coordsAsString()+"]");
};
Geometry.GeometryTypes=new Object();
Object.extend(Geometry.GeometryTypes,{Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6,Collection:7,Envelope:100,Ellipse:101});
Geometry.ID=-1;
Geometry.AbstractGeometry=function AbstractGeometry(crs){
this.crs=crs;
this.initialize();
};
Object.extend(Geometry.AbstractGeometry.prototype,{initialize:function(){
this.id=Geometry.ID;
Geometry.ID-=1;
this.collection=null;
this.bounds=null;
},getRoot:function(){
if(!this.collection){
return this;
}else{
return this.collection.getRoot();
}
},getOpenGisGeomType:function(){
return this.getGeomType();
},getGeomTypeId:function(){
return Geometry.GeometryTypes[this.getGeomType()];
},getOpenGisGeomTypeId:function(){
return Geometry.GeometryTypes[this.getOpenGisGeomType()];
},getDimension:function(){
NotImplementedError();
},convertToCrs:function(_509){
if(this.crs.equals(_509)){
return this;
}
var _50a=this.crs.getTransformTo(_509);
if(!_50a){
throw new Error("Could not find transform to convert between coordinate systems. "+"to: "+this.crs.constructor.NAME+" from: "+_509.constructor.NAME);
}
this.transformToCrs(_50a,_509);
this.bounds=null;
return this;
},transformToCrs:function(_50b,_50c){
this.transform(_50b);
this.crs=_50c;
return this;
},transform:function(_50d){
NotImplementedError();
},getGeomType:function(){
NotImplementedError();
},copy:function(){
NotImplementedError();
},equals:function(_50e){
NotImplementedError();
},getBounds:function(crs){
NotImplementedError();
}});
Geometry.AbstractGeometry.prototype.toString=function toString(){
var _510=this.getGeomType()+" [ID: "+this.id+" Crs: "+(this.crs?this.crs.toString():"null")+"]";
return _510;
};
Geometry.Point=function Point(x,y,crs){
this.x=x;
this.y=y;
this.crs=crs;
this.initialize();
};
Geometry.Point.inherits(Geometry.AbstractGeometry);
Object.extend(Geometry.Point,{fromJson:function(data,crs){
return new Geometry.Point(data.x,data.y,crs);
}});
Object.extend(Geometry.Point.prototype,{getGeomType:function(){
return "Point";
},getDimension:function(){
return 0;
},copy:function(){
return new Geometry.Point(this.x,this.y,this.crs);
},equals:function(_516){
return (this.x==_516.x&&this.y==_516.y&&this.crs.equals(_516.crs));
},transform:function(_517){
var _518=[this.x,this.y];
_517.convert(_518);
this.x=_518[0];
this.y=_518[1];
return this;
},toQueryParam:function(){
return this.x+","+this.y;
},getCenter:function(){
return this;
},getBounds:function(crs){
return new Geometry.Envelope(this.x,this.y,this.x,this.y,this.crs);
}});
Geometry.Point.prototype.toString=function toString(){
var _51a=this.getGeomType()+" [ID: "+this.id+" Coord: "+this.x+", "+this.y+" "+" Crs: "+(this.crs?this.crs.toString():"null")+"]";
return _51a;
};
Geometry.LineString=function LineString(_51b,crs){
if(!(_51b instanceof Geometry.CoordinateArray)){
throw new Error("Coords must be a CoordinateArray.  "+_51b.toString());
}
this.coords=_51b;
this.callSuper(arguments.callee,crs);
};
Geometry.LineString.inherits(Geometry.AbstractGeometry);
Object.extend(Geometry.LineString.prototype,{getGeomType:function(){
return "LineString";
},getDimension:function(){
return 1;
},copy:function(){
return new Geometry.LineString(this.coords.copy(),this.crs);
},getBounds:function(){
return this.coords.getBounds(this.crs);
},equals:function(_51d){
return (this.coords.equals(_51d.coords)&&this.crs.equals(_51d.crs));
},transform:function(_51e){
this.coords.transform(_51e);
return this;
},getCenter:function(){
var _51f;
var _520;
var _521=this.coords.getLength();
for(var i=0;i<_521;i++){
var x=this.coords.getX(i);
if(_51f){
_51f+=x;
}else{
_51f=x;
}
var y=this.coords.getY(i);
if(_520){
_520+=y;
}else{
_520=y;
}
}
return new Geometry.Coordinate(_51f/_521,_520/_521);
}});
Geometry.LineString.prototype.toString=function toString(){
var _525=this.getGeomType()+" [ID: "+this.id+" Coords: "+this.coords.toString()+" "+" Crs: "+(this.crs?this.crs.toString():"null")+"]";
return _525;
};
Geometry.Envelope=function Envelope(xMin,yMin,xMax,yMax,crs){
this.callSuper(arguments.callee,crs);
this.setBounds(xMin,yMin,xMax,yMax);
};
Geometry.Envelope.inherits(Geometry.AbstractGeometry);
Object.extend(Geometry.Envelope,{fromJson:function(data,crs){
if(!crs&&data.srid){
crs=Geometry.CrsFactory.instance.create(data.srid);
}
return new Geometry.Envelope(data.xmin,data.ymin,data.xmax,data.ymax,crs);
}});
Object.extend(Geometry.Envelope.prototype,{getGeomType:function(){
return "Envelope";
},getOpenGisGeomType:function(){
return "Polygon";
},getDimension:function(){
return 2;
},getBounds:function(){
return this;
},cacheValues:function(){
this.width=this.xMax-this.xMin;
this.height=this.yMax-this.yMin;
this.xCenter=this.xMin+(this.width/2);
this.yCenter=this.yMin+(this.height/2);
if(this.crs&&!this.crs.isXMirrored()){
this.left=this.xMin;
this.right=this.xMax;
}else{
this.left=this.xMax;
this.right=this.xMin;
}
if(this.crs&&!this.crs.isYMirrored()){
this.top=this.yMax;
this.bottom=this.yMin;
}else{
this.top=this.yMin;
this.bottom=this.yMax;
}
},setBounds:function(xMin,yMin,xMax,yMax){
if(typeof xMin!="number"||typeof yMin!="number"||typeof xMax!="number"||typeof yMax!="number"){
throw new Error("Invalid number");
}
if(xMin>xMax||yMin>yMax){
throw new Error("Invalid envelope coordinates: "+xMin+", "+yMin+" "+xMax+", "+yMax);
}
this.xMin=xMin;
this.yMin=yMin;
this.xMax=xMax;
this.yMax=yMax;
this.cacheValues();
},intersects:function(_531){
var _532=_531.copy().convertToCrs(this.crs);
if(this.xMin>_531.xMax||this.xMax<_531.xMin||this.yMin>_531.yMax||this.yMax<_531.yMin){
return false;
}else{
return true;
}
},contains:function(_533){
var _534=_533.copy().convertToCrs(this.crs);
return this.containsXY(_534.x,_534.y);
},containsXY:function(x,y){
if(x>this.xMin&&x<this.xMax&&y>this.yMin&&y<this.yMax){
return true;
}else{
return false;
}
},coversXY:function(x,y){
if(x>=this.xMin&&x<=this.xMax&&y>=this.yMin&&y<=this.yMax){
return true;
}else{
return false;
}
},union:function(_539){
_539=_539.copy().convertToCrs(this.crs);
var xMin=this.xMin;
var xMax=this.xMax;
var yMin=this.yMin;
var yMax=this.yMax;
if(_539.xMin<xMin){
xMin=_539.xMin;
}
if(_539.xMax>xMax){
xMax=_539.xMax;
}
if(_539.yMin<yMin){
yMin=_539.yMin;
}
if(_539.yMax>yMax){
yMax=_539.yMax;
}
return new Geometry.Envelope(xMin,yMin,xMax,yMax,this.crs);
},copy:function(){
return new Geometry.Envelope(this.xMin,this.yMin,this.xMax,this.yMax,this.crs);
},equals:function(_53e){
return (this.xMin==_53e.xMin&&this.yMin==_53e.yMin&&this.xMax==_53e.xMax&&this.yMax==_53e.yMax&&this.crs.equals(_53e.crs));
},getCenter:function(){
return new Geometry.Point(this.xCenter,this.yCenter,this.crs);
},transformToCrs:function(_53f,_540){
this.transform(_53f);
var _541=false;
if(this.crs.isXMirrored()^_540.isXMirrored()){
_541=true;
var xMin=this.xMin;
this.xMin=this.xMax;
this.xMax=xMin;
}
if(this.crs.isYMirrored()^_540.isYMirrored()){
_541=true;
var yMin=this.yMin;
this.yMin=this.yMax;
this.yMax=yMin;
}
this.crs=_540;
if(_541){
this.cacheValues();
}
return this;
},transform:function(_544){
var _545=[this.xMin,this.yMin,this.xMax,this.yMax];
_544.convert(_545);
this.xMin=_545[0];
this.yMin=_545[1];
this.xMax=_545[2];
this.yMax=_545[3];
this.cacheValues();
return this;
},toQueryParam:function(){
return this.xMin+","+this.yMin+","+this.xMax+","+this.yMax;
}});
Geometry.Envelope.prototype.toString=function toString(){
var _546=this.getGeomType()+" [ID: "+this.id+" Coords: "+this.xMin+", "+this.yMin+" "+this.xMax+", "+this.yMax+" "+" Crs: "+(this.crs?this.crs.toString():"null")+"]";
return _546;
};
Geometry.Point.prototype.toString=function toString(){
var _547=this.getGeomType()+" [ID: "+this.id+" Coord: "+this.x+", "+this.y+" "+" Crs: "+(this.crs?this.crs.toString():"null")+"]";
return _547;
};
Geometry.Polygon=function Polygon(_548,_549,crs){
if(!(_548 instanceof Geometry.CoordinateArray)){
throw new Error("Coords must be a CoordinateArray.  "+_548.toString());
}
this.callSuper(arguments.callee,crs);
this.coords=_548;
this.innerRings=_549||new Array();
};
Geometry.Polygon.inherits(Geometry.AbstractGeometry);
Object.extend(Geometry.Polygon.prototype,{getGeomType:function(){
return "Polygon";
},getDimension:function(){
return 2;
},copy:function(){
var _54b=this.coords.copy();
var _54c=new Array();
for(var i=0;i<this.innerRings.length;i++){
_54c.push(this.innerRings[i].copy());
}
return new this.constructor(_54b,_54c,this.crs);
},getBounds:function(){
return this.coords.getBounds(this.crs);
},equals:function(_54e){
var _54f=(this.crs.equals(_54e.crs)&&this.coords.equals(_54e.coords)&&this.innerRings.length==_54e.innerRings.length);
if(_54f){
for(var i=0;i<this.innerRings.length;i++){
_54f=_54f&&(this.innerRings[i].equals(_54e.innerRings[i]));
}
}
return _54f;
},transform:function(_551){
this.coords.transform(_551);
for(var i=0;i<this.innerRings.length;i++){
this.innerRings[i].transform(_551);
}
return this;
},getCenter:function(){
var _553;
var _554;
var _555=this.coords.getLength();
for(var i=0;i<_555;i++){
var x=this.coords.getX(i);
if(_553){
_553+=x;
}else{
_553=x;
}
var y=this.coords.getY(i);
if(_554){
_554+=y;
}else{
_554=y;
}
}
return new Geometry.Coordinate(_553/_555,_554/_555);
}});
Geometry.Polygon.prototype.toString=function toString(){
var _559=this.getGeomType()+"[ID: "+this.id+" Crs: "+(this.crs?this.crs.toString():"null")+" Coords: ("+this.coords.coordsAsString()+") ";
for(var i=0;i<this.innerRings;i++){
var ring=this.innerRings[i];
_559+="("+ring.coordsAsString()+") ";
}
_559+="]";
return _559;
};
Geometry.Collection=function Collection(crs){
this.applySuper(arguments);
this.geoms=new Array();
};
Geometry.Collection.inherits(Geometry.AbstractGeometry);
Object.extend(Geometry.Collection.prototype,{add:function(geom){
if(this.crs){
if(!this.crs.equals(geom.crs)){
throw new Error("Geometries added to a geometry collection must have "+"the same coordinate reference system as the collection.");
}
}
geom.collection=this;
this.geoms.push(geom);
},remove:function(geom){
var _55f=this.geoms.remove(geom);
if(_55f){
_55f.collection=null;
}
return _55f;
},getGeomType:function(){
return "Collection";
},getDimension:function(){
var _560=null;
for(var i=0;i<this.geoms.length;i++){
var geom=this.geoms[i];
_560=Math.max(_560,geom.getDimension());
}
},getNumGeoms:function(){
return this.geoms.length;
},getGeom:function(_563){
return this.geoms[_563];
},getBounds:function(){
var _564=null;
for(var i=0;i<this.geoms.length;i++){
var geom=this.geoms[i];
var _567=geom.getBounds();
if(!_564){
_564=_567;
}else{
_564=_564.union(_567);
}
}
return _564;
},transform:function(_568){
for(var i=0;i<this.geoms.length;i++){
this.geoms[i].transform(_568);
}
return this;
}});
Geometry.MultiPoint=function MultiPoint(crs){
this.applySuper(arguments);
};
Geometry.MultiPoint.inherits(Geometry.Collection);
Object.extend(Geometry.MultiPoint.prototype,{getGeomType:function(){
return "MultiPoint";
}});
Geometry.MultiLineString=function MultiLineString(crs){
this.applySuper(arguments);
};
Geometry.MultiLineString.inherits(Geometry.Collection);
Object.extend(Geometry.MultiLineString.prototype,{getGeomType:function(){
return "MultiLineString";
}});
Geometry.MultiPolygon=function MultiPolygon(crs){
this.applySuper(arguments);
};
Geometry.MultiPolygon.inherits(Geometry.Collection);
Object.extend(Geometry.MultiPolygon.prototype,{getGeomType:function(){
return "MultiPolygon";
}});
namespace("Geometry");
Geometry.World=function World(name,_56e,_56f,_570){
this.name=name;
this.bounds=_56e;
this.minZoom=_56f;
this.maxZoom=_570;
this.crs=this.bounds.crs;
};
Object.extend(Geometry.World,{fromJson:function(data){
var crs=Geometry.CrsFactory.instance.create(data.bounds.srid,{unitSize:data.unit_size,falseNorthing:data.false_northing,falseEasting:data.false_easting});
var _573=Geometry.Envelope.fromJson(data.bounds,crs);
crs.bounds=_573;
return new Geometry.World(data.name,_573,data.min_zoom,data.max_zoom);
}});
Object.extend(Geometry.World.prototype,{getWidth:function(_574){
this.crs.getWidth(_574,this);
}});
Geometry.World.prototype.toString=function toString(){
var _575="World [ "+this.name+", "+"minZoom: "+this.minZoom+", "+"maxZoom: "+this.maxZoom+", ";
"bounds: "+this.bounds+"]";
return _575;
};
Geometry.CrsFactory=function CrsFactory(){
this.constructors=new HashTable();
this.cache=new HashTable();
};
Object.extend(Geometry.CrsFactory.prototype,{getCrsConstructor:function(_576){
return this.constructors[_576];
},register:function(_577){
this.constructors[_577.EPSG]=_577;
},create:function(_578){
var _579=this.cache[_578];
if(!_579){
var _57a=this.getCrsConstructor(_578);
if(!_57a){
throw new Error("Unknown coordinate system.  SRID: "+_578);
}
var args=$A(arguments);
args.splice(0,1);
switch(args.length){
case 0:
_579=new _57a();
break;
case 1:
_579=new _57a(args[0]);
break;
case 2:
_579=new _57a(args[0],args[1]);
break;
default:
throw new Error("Unsupported number of arguments for creating a coordinate system");
}
this.cache[_578]=_579;
}
return _579;
},latLongCrs:function(){
return this.create(Geometry.LatLongCrs.EPSG);
},documentCrs:function(){
if(!this.docCrs){
this.docCrs=new Geometry.DocumentCrs(document);
}
return this.docCrs;
}});
Geometry.CrsFactory.instance=new Geometry.CrsFactory();
Geometry.Projections=function Projections(){
this.projections=new HashTable();
};
Object.extend(Geometry.Projections.prototype,{register:function(_57c,from,to){
var key=from.NAME+"-"+to.NAME;
this.projections[key]=_57c;
},getTransform:function(from,to){
var _582=this.lookupTransform(from,to);
if(!_582){
_582=this.lookupTransform(to,from);
if(_582){
_582=_582.getInverse();
}
}
return _582;
},lookupTransform:function(from,to){
var key=from.constructor.NAME+"-"+to.constructor.NAME;
var _586=this.projections[key];
if(_586){
return new _586(from,to).getTransform();
}
}});
Geometry.Projections.instance=new Geometry.Projections();
Geometry.AbstractTransform=function AbstractTransform(_587){
this.options=_587||new HashTable();
};
Object.extend(Geometry.AbstractTransform.prototype,{copy:function(){
NotImplementedError();
},convert:function(arr){
NotImplementedError();
},getInverse:function(){
NotImplementedError();
}});
Geometry.IdentityTransform=function IdentityTransform(){
};
Geometry.IdentityTransform.inherits(Geometry.AbstractTransform);
Object.extend(Geometry.IdentityTransform.prototype,{copy:function(){
return new Geometry.IdentityTransform();
},convert:function(arr){
return arr;
},getInverse:function(){
return this;
}});
Geometry.IdentityTransform.prototype.toString=function toString(){
return "Identity Transform \n";
};
Geometry.Transform=function Transform(){
this.transforms=new Array();
};
Geometry.Transform.inherits(Geometry.AbstractTransform);
Object.extend(Geometry.Transform.prototype,{copy:function(){
var _58a=new this.constructor();
for(var i=0;i<this.transforms.length;i++){
var _58c=this.transforms[i].copy();
_58a.transforms.push(_58c);
}
return _58a;
},convert:function(arr){
var _58e=arr;
for(var i=0;i<this.transforms.length;i++){
var _590=this.transforms[i];
_58e=_590.convert(_58e);
}
return _58e;
},lastTransformIsAffine:function(){
return ((this.transforms.length>0)&&(this.transforms.last() instanceof Geometry.AffineTransform));
},getInverse:function(){
if(!this.inverse){
this.inverse=new Geometry.Transform();
for(var i=this.transforms.length-1;i>=0;i--){
var _592=this.transforms[i];
this.inverse.transforms.push(_592.getInverse());
}
}
return this.inverse;
},add:function(_593){
this.inverse=null;
if(_593 instanceof Geometry.IdentityTransform){
}else{
if(_593 instanceof Geometry.Transform){
for(var i=0;i<_593.transforms.length;i++){
this.add(_593.transforms[i]);
}
}else{
this.transforms.push(_593);
}
}
return this;
},translate:function(x,y){
this.add(new Geometry.AffineTransform().translate(x,y));
return this;
},rotate:function(_597){
this.add(new Geometry.AffineTransform().rotate(_597));
return this;
},scale:function(x,y){
this.add(new Geometry.AffineTransform().scale(x,y));
return this;
}});
Geometry.Transform.prototype.toString=function toString(){
var _59a="Composite Transform [\n";
this.transforms.each(function(_59b){
_59a+="  "+_59b.toString();
});
_59a+="]\n";
return _59a;
};
Geometry.AffineTransform=function AffineTransform(){
this.a=1;
this.b=0;
this.c=0;
this.d=1;
this.e=0;
this.f=0;
};
Geometry.AffineTransform.inherits(Geometry.AbstractTransform);
Geometry.AffineTransform.CreateFromMatrix=function(a,b,c,d,e,f){
var M=new Geometry.AffineTransform();
M.a=a;
M.b=b;
M.c=c;
M.d=d;
M.e=e;
M.f=f;
return M;
};
Object.extend(Geometry.AffineTransform.prototype,{reset:function(){
this.a=1;
this.b=0;
this.c=0;
this.d=1;
this.e=0;
this.f=0;
},convert:function(arr){
for(var i=0;i<arr.length;i+=2){
var x=arr[i];
var y=arr[i+1];
var _5a7=(x*this.a+y*this.c)+this.e;
var _5a8=(x*this.b+y*this.d)+this.f;
arr[i]=_5a7;
arr[i+1]=_5a8;
}
return arr;
},copy:function(){
return Geometry.AffineTransform.CreateFromMatrix(this.a,this.b,this.c,this.d,this.e,this.f);
},multiply:function(_5a9){
if(!(_5a9 instanceof Geometry.AffineTransform)){
throw new Error("Can only multiply affine transforms together");
}
this.inverse=null;
var a=this.a*_5a9.a+this.b*_5a9.c;
var b=this.a*_5a9.b+this.b*_5a9.d;
var c=this.c*_5a9.a+this.d*_5a9.c;
var d=this.c*_5a9.b+this.d*_5a9.d;
var e=this.e*_5a9.a+this.f*_5a9.c+_5a9.e;
var f=this.e*_5a9.b+this.f*_5a9.d+_5a9.f;
this.a=a;
this.b=b;
this.c=c;
this.d=d;
this.e=e;
this.f=f;
return this;
},translate:function(e,f){
this.inverse=null;
this.e+=e;
this.f+=f;
return this;
},scale:function(sx,sy){
this.inverse=null;
this.a*=sx;
this.b*=sy;
this.c*=sx;
this.d*=sy;
this.e*=sx;
this.f*=sy;
return this;
},rotate:function(_5b4){
this.inverse=null;
var _5b5=Math.degreesToRadians(_5b4);
var s=Math.sin(_5b5);
var c=Math.cos(_5b5);
var M=Geometry.AffineTransform.CreateFromMatrix(c,s,-s,c,0,0);
return this.multiply(M);
},getDeterminant:function(){
return ((this.a*this.d)-(this.b*this.c));
},getAdjoint:function(){
return Geometry.AffineTransform.CreateFromMatrix(this.d,-this.b,-this.c,this.a,this.c*this.f-this.d*this.e,this.b*this.e-this.a*this.f);
},getInverse:function(){
var det=this.getDeterminant();
if(det==0){
throw new Error("Invalid AffineTransform");
}
this.inverse=this.getAdjoint();
var _5ba=1/det;
this.inverse.scale(_5ba,_5ba);
return this.inverse;
}});
Geometry.AffineTransform.prototype.toString=function toString(){
var _5bb="Affine Transform [\n"+"a: "+this.a+" b: "+this.b+"\n"+"c: "+this.c+" d: "+this.d+"\n"+"e: "+this.e+" f: "+this.f+"]\n";
return _5bb;
};
Geometry.MercatorTransform=function MercatorTransform(_5bc){
this.callSuper(arguments.callee,_5bc);
this.radius=this.options.radius;
};
Geometry.MercatorTransform.inherits(Geometry.AbstractTransform);
Object.extend(Geometry.MercatorTransform.prototype,{copy:function(){
return new Geometry.MercatorTransform(this.options);
},getInverse:function(){
if(!this.inverse){
this.inverse=new Geometry.MercatorInverseTransform({radius:this.radius});
}
return this.inverse;
},convert:function(arr){
for(var i=0;i<arr.length;i+=2){
arr[i]=this.longToX(arr[i]);
arr[i+1]=this.latToY(arr[i+1]);
}
return arr;
},longToX:function(_5bf){
var _5c0=Math.degreesToRadians(_5bf);
return (this.radius*_5c0);
},latToY:function(_5c1){
var _5c2=Math.degreesToRadians(_5c1);
var y=this.radius/2*Math.log((1+Math.sin(_5c2))/(1-Math.sin(_5c2)));
return y;
}});
Geometry.MercatorTransform.prototype.toString=function toString(){
var _5c4="Mercator Transform ["+" radius: "+this.radius+"]";
return _5c4;
};
Geometry.MercatorInverseTransform=function MercatorInverseTransform(_5c5){
this.callSuper(arguments.callee,_5c5);
this.radius=this.options.radius;
};
Geometry.MercatorInverseTransform.inherits(Geometry.AbstractTransform);
Object.extend(Geometry.MercatorInverseTransform.prototype,{copy:function(){
return new Geometry.MercatorInverseTransform(this.options);
},getInverse:function(){
if(!this.inverse){
this.inverse=new Geometry.MercatorTransform({radius:this.radius});
}
return this.inverse;
},convert:function(arr){
for(var i=0;i<arr.length;i+=2){
arr[i]=this.xToLong(arr[i]);
arr[i+1]=this.yToLat(arr[i+1]);
}
return arr;
},xToLong:function(x){
var _5c9=x/this.radius;
var _5ca=Math.radiansToDegrees(_5c9);
var _5cb=Math.floor((_5ca+180)/360);
var _5cc=_5ca-(_5cb*360);
return _5cc;
},yToLat:function(y){
var _5ce=(Math.PI/2)-(2*Math.atan(Math.exp(-1*y/this.radius)));
return Math.radiansToDegrees(_5ce);
}});
Geometry.MercatorInverseTransform.prototype.toString=function toString(){
var _5cf="Mercator Inverse Transform ["+" radius: "+this.radius+"]";
return _5cf;
};
Geometry.AbstractCrs=function AbstractCrs(_5d0){
this.options=_5d0||new HashTable();
this.xScale=this.options["xScale"]||1;
this.yScale=this.options["yScale"]||1;
this.falseEasting=this.options["falseEasting"]||0;
this.falseNorthing=this.options["falseNorthing"]||0;
};
Object.extend(Geometry.AbstractCrs.prototype,{getTransformTo:function(_5d1){
return Geometry.Projections.instance.getTransform(this,_5d1);
},equals:function(_5d2){
return (this===_5d2||this.constructor===_5d2.constructor);
},getParams:function(){
return {};
},getWidth:function(_5d3){
NotImplementedError();
},getUnitSize:function(_5d4){
NotImplementedError();
},distance:function(_5d5,_5d6){
var _5d7=Math.pow(_5d6.x-_5d5.x,2);
var _5d8=Math.pow(_5d6.y-_5d5.y,2);
var _5d9=Math.sqrt(_5d7+_5d8);
return _5d9*this.getUnitSize();
},isXMirrored:function(){
return this.xScale<0;
},isYMirrored:function(){
return this.yScale<0;
}});
Geometry.AbstractCrs.prototype.toString=function toString(){
var _5da=this.constructor.NAME+" [";
var _5db=$H(this.getParams());
_5db.each(function(pair){
var key=pair.key.toString();
var _5de=pair.value;
if(_5de){
_5de=_5de.toString();
}
_5da+=(key+": "+_5de+"\n");
});
_5da+="]";
return _5da;
};
Geometry.CartesianCrs=function CartesianCrs(_5df){
this.callSuper(arguments.callee,_5df);
this.unitSize=this.options.unitSize||1;
this.bounds=this.options.bounds;
};
Geometry.CartesianCrs.inherits(Geometry.AbstractCrs);
Object.extend(Geometry.CartesianCrs,{NAME:"Cartesian",EPSG:-1});
Object.extend(Geometry.CartesianCrs.prototype,{equals:function(_5e0){
return (this===_5e0||(this.constructor===_5e0.constructor&&this.options.width==_5e0.options.width));
},getWidth:function(_5e1){
return this.bounds.width*this.getUnitSize(_5e1);
},getUnitSize:function(_5e2){
return this.unitSize;
}});
Geometry.CrsFactory.instance.register(Geometry.CartesianCrs);
Geometry.AbstractScreenCrs=function AbstractScreenCrs(_5e3,_5e4){
this.document=_5e3;
_5e4=_5e4||new HashTable();
_5e4["yScale"]=_5e4["yScale"]||-1;
this.callSuper(arguments.callee,_5e4);
};
Geometry.AbstractScreenCrs.inherits(Geometry.AbstractCrs);
Object.extend(Geometry.AbstractScreenCrs.prototype,{release:function(){
this.document=null;
}});
Geometry.DocumentCrs=function DocumentCrs(_5e5,_5e6){
this.callSuper(arguments.callee,_5e5,_5e6);
};
Geometry.DocumentCrs.inherits(Geometry.AbstractScreenCrs);
Object.extend(Geometry.DocumentCrs,{NAME:"Document Crs",PIXELS_PER_INCH:72});
Geometry.DocumentCrs.PIXELS_PER_CM=Geometry.DocumentCrs.PIXELS_PER_INCH/2.54;
Object.extend(Geometry.DocumentCrs.prototype,{equals:function(_5e7){
return this===_5e7||(this.constructor===_5e7.constructor&&this.document===_5e7.document);
},getParams:function(){
return {document:this.document};
},getWidth:function(_5e8){
NotImplementedError();
},getUnitSize:function(_5e9){
return (1/Geometry.DocumentCrs.PIXELS_PER_CM);
}});
Geometry.ElementCrs=function ElementCrs(_5ea,_5eb){
this.element=_5ea;
this.callSuper(arguments.callee,_5ea.ownerDocument,_5eb);
};
Geometry.ElementCrs.inherits(Geometry.AbstractScreenCrs);
Geometry.ElementCrs.NAME="Element Crs";
Object.extend(Geometry.ElementCrs.prototype,{release:function(){
this.element=null;
this.callSuper(arguments.callee);
},getWidth:function(_5ec){
return this.element.offsetWidth*this.getUnitSize(_5ec);
},getUnitSize:function(_5ed){
return 1/Geometry.DocumentCrs.PIXELS_PER_CM;
},equals:function(_5ee){
return (this.constructor===_5ee.constructor&&this.element===_5ee.element);
},getParams:function(){
return {element:this.element};
}});
Geometry.AbstractGeodeticCrs=function AbstractGeodeticCrs(_5ef){
this.callSuper(arguments.callee,_5ef);
this.falseEasting=this.options["falseEasting"]||0;
this.falseNorthing=this.options["falseNorthing"]||0;
};
Geometry.AbstractGeodeticCrs.inherits(Geometry.AbstractCrs);
Object.extend(Geometry.AbstractGeodeticCrs.prototype,{getParams:function(){
return {epsg:this.constructor.EPSG,falseEasting:this.falseEasting,falseNorthing:this.falseNorthing,xScale:this.xScale,yScale:this.yScale};
}});
Geometry.LatLongCrs=function LatLongCrs(_5f0){
this.callSuper(arguments.callee,_5f0);
};
Geometry.LatLongCrs.inherits(Geometry.AbstractGeodeticCrs);
Object.extend(Geometry.LatLongCrs,{NAME:"WGS84",EPSG:4326,EARTH_RADIUS:637813700,getCircumferenceAtLat:function(lat){
var _5f2=Math.degreesToRadians(lat);
var _5f3=2*Math.PI*(Math.cos(_5f2)*Geometry.LatLongCrs.EARTH_RADIUS);
return _5f3;
}});
Geometry.CrsFactory.instance.register(Geometry.LatLongCrs);
Object.extend(Geometry.LatLongCrs.prototype,{figureTransform:function(){
return Geometry.IDENTITY_TRANSFORM;
},getWidth:function(_5f4){
var _5f5=_5f4.copy().convertToCrs(Geometry.CrsFactory.instance.latLongCrs());
return Geometry.LatLongCrs.getCircumferenceAtLat(_5f5.y);
},getUnitSize:function(_5f6){
var _5f7=_5f6.copy().convertToCrs(Geometry.CrsFactory.instance.latLongCrs());
var _5f8=Geometry.LatLongCrs.getCircumferenceAtLat(_5f7.y);
return _5f8/360;
},distance:function(_5f9,_5fa){
var _5fb=Math.degreesToRadians(_5f9.x);
var _5fc=Math.degreesToRadians(_5fa.x);
var lat1=Math.degreesToRadians(_5f9.y);
var lat2=Math.degreesToRadians(_5fa.y);
var _5ff=_5fc-_5fb;
var _600=lat2-lat1;
var _601=2*Math.asin(Math.sqrt(Math.pow(Math.sin(_600/2),2)+Math.cos(lat1)*Math.cos(lat2)*Math.pow(Math.sin(_5ff/2),2)));
var _602=_601*Geometry.LatLongCrs.EARTH_RADIUS;
return _602;
}});
Geometry.MercatorCrs=function MercatorCrs(_603){
this.callSuper(arguments.callee,_603);
this.radius=this.options.radius;
};
Geometry.MercatorCrs.inherits(Geometry.AbstractGeodeticCrs);
Geometry.MercatorCrs.NAME="Mercator";
Geometry.MercatorCrs.EPSG=9804;
Geometry.CrsFactory.instance.register(Geometry.MercatorCrs);
Object.extend(Geometry.MercatorCrs.prototype,{getWidth:function(_604){
return 2*Math.PI*this.radius*this.getUnitSize(_604);
},getUnitSize:function(_605){
return (1/Geometry.DocumentCrs.PIXELS_PER_CM);
},getParams:function(){
var _606=this.callSuper(arguments.callee);
_606["Radius"]=this.options.radius;
return _606;
}});
Geometry.MercatorProjection=function MercatorProjection(from,to){
this.from=from;
this.to=to;
};
Object.extend(Geometry.MercatorProjection.prototype,{getTransform:function(){
var _609=2*Math.PI*this.to.radius;
var _60a=_609/2;
var _60b=-1*_609/2;
return new Geometry.Transform().add(new Geometry.MercatorTransform({radius:this.to.radius})).translate(_60a,_60b).scale(this.to.xScale,this.to.yScale);
}});
Geometry.Projections.instance.register(Geometry.MercatorProjection,Geometry.LatLongCrs,Geometry.MercatorCrs);
Geometry.ElementProjection=function ElementProjection(from,to){
this.from=from;
this.to=to;
};
Object.extend(Geometry.ElementProjection.prototype,{getTransform:function(){
var _60e=Position.cumulativeOffset(this.to.element);
return new Geometry.AffineTransform().translate(-_60e[0],-_60e[1]);
}});
Geometry.Projections.instance.register(Geometry.ElementProjection,Geometry.DocumentCrs,Geometry.ElementCrs);
Geometry.IDENTITY_TRANSFORM=new Geometry.IdentityTransform();
Geometry.CartesianProjection=function CartesianProjection(from,to){
this.from=from;
this.to=to;
};
Object.extend(Geometry.CartesianProjection.prototype,{getTransform:function(){
var _611=(this.to.getWidth()/this.to.getUnitSize())/(this.from.getWidth()/this.from.getUnitSize());
var _612=2*Math.PI*this.to.radius;
var _613=0;
var _614=-1*_612;
return new Geometry.AffineTransform().translate(this.from.falseEasting,this.from.falseNorthing).scale(_611,_611).translate(_613,_614).scale(this.to.xScale,this.to.yScale);
}});
Geometry.Projections.instance.register(Geometry.CartesianProjection,Geometry.CartesianCrs,Geometry.MercatorCrs);
Geometry.IDENTITY_TRANSFORM=new Geometry.IdentityTransform();
Geometry.io=new MapBuzz.IO.Manager();
Geometry.io.readers[MapBuzz.Mime.WKB]=new Geometry.Wkb.Reader();
Geometry.io.readers[MapBuzz.Mime.JSON]=new Geometry.Json.Reader();
Geometry.io.writers[MapBuzz.Mime.WKB]=new Geometry.Wkb.Writer();
Geometry.io.writers[MapBuzz.Mime.JSON]=new Geometry.Json.Writer();
namespace("MapBuzz.UI");
Object.extend(MapBuzz.UI,{REPLIES_LINK_CLICK:"UI_REPLIES_LINK_CLICK",SHARE_LINK_CLICK:"UI_SHARE_LINK_CLICK"});
MapBuzz.UI.AbstractPanel=function AbstractPanel(name,_616){
this.name=name;
this.parent=_616;
this.element=null;
this.panels=[];
if(this.parent){
this.parent.panels.push(this);
}
};
Object.extend(MapBuzz.UI.AbstractPanel.prototype,{initialize:function(_617){
if(!_617){
throw new Error("Must specify an element for a panel. "+"Constructor: "+this.constructor);
}
this.element=_617;
this.createPanels();
},release:function(){
for(var i=0;i<this.panels.length;i++){
this.panels[i].release();
}
this.panels.length=0;
this.element=null;
},getName:function(){
return this.name;
},getRoot:function(){
if(this.parent){
return this.parent.getRoot();
}else{
return this;
}
},show:function(){
Element.show(this.element);
},hide:function(){
Element.hide(this.element);
},enable:function(){
for(var i=0;i<this.panels.length;i++){
var _61a=this.panels[i];
_61a.enable();
}
},disable:function(){
for(var i=0;i<this.panels.length;i++){
var _61c=this.panels[i];
_61c.disable();
}
},getPanel:function(name){
for(var i=0;i<this.panels.length;i++){
if(this.panels[i].name==name){
return this.panels[i];
}
}
return null;
},createPanels:function(){
},update:function(){
this.updatePanels();
},updatePanels:function(){
for(var i=0;i<this.panels.length;i++){
var _620=this.panels[i];
_620.update();
}
},reset:function(){
this.element.className=this.removeErrorClass(this.element.className);
for(var i=0;i<this.panels.length;i++){
var _622=this.panels[i];
_622.reset();
}
},save:function(){
for(var i=0;i<this.panels.length;i++){
var _624=this.panels[i];
_624.save();
}
},getTemplate:function(){
NotImplementedError();
},content:function(){
var _625=this.getTemplate();
return _625.run({panel:this});
},getDimension:function(_626){
var _627=Element.getStyle(this.element,_626);
if(Browser.instance.isIE()){
if(_627.match(/em/i)){
_627=window.emToPixel(this.element,parseInt(_627,10));
}
}
return parseInt(_627,10);
},initializeCommand:function(){
return new MapBuzz.Command.Bind("Initialize Panel",this.initialize.bind(this));
},closeCommand:function(){
if(!this.closeCommand_){
this.closeCommand_=new MapBuzz.Command.Chain("Close",new MapBuzz.Command.Empty());
}
return this.closeCommand_;
},cancelCommand:function(){
if(!this.cancelCommand_){
this.cancelCommand_=new MapBuzz.Command.Chain("Cancel Insert Feature",new MapBuzz.Command.Empty());
}
return this.cancelCommand_;
},releaseCommand:function(){
return new MapBuzz.Command.Bind("Release Panel",this.release.bind(this));
},resetCommand:function(){
return new MapBuzz.Command.Bind("Panel Reset",this.reset.bind(this));
},saveCommand:function(){
return new MapBuzz.Command.Bind("Panel Save",this.save.bind(this));
},contentCommand:function(){
return new MapBuzz.Command.Bind("Panel Content",this.content.bind(this));
},addErrorClass:function(_628){
var _629=_628;
if(_629.length==0){
_629=MapBuzz.Validation.VALIDATION_ERROR_CLASS;
}else{
if(!_629.match(MapBuzz.Validation.VALIDATION_ERROR_CLASS)){
_629=_629+" "+MapBuzz.Validation.VALIDATION_ERROR_CLASS;
}
}
return _629;
},removeErrorClass:function(_62a){
var _62b=new RegExp("^(.*)"+MapBuzz.Validation.VALIDATION_ERROR_CLASS+"(.*)$");
var _62c=_62a.match(_62b);
if(!_62c){
return _62a;
}
return (_62c[1].strip()+" "+_62c[2].strip());
},showError:function(_62d){
this.element.className=this.addErrorClass(this.element.className);
},onStartResize:function(_62e,_62f){
},onResize:function(_630,_631){
},onEndResize:function(_632,_633){
}});
namespace("MapBuzz.UI");
Object.extend(MapBuzz.UI,{PROPERTY_CHANGE:"FEATURE_PROPERTY_CHANGE"});
MapBuzz.UI.ModelPanel=function ModelPanel(name,_635,_636){
this.callSuper(arguments.callee,name,_636);
this.model=_635;
};
MapBuzz.UI.ModelPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.ModelPanel.prototype,{initialize:function(_637){
this.applySuper(arguments);
this.registerListeners();
this.update();
},release:function(_638){
this.unregisterListeners();
this.applySuper(arguments);
},registerListeners:function(){
this.propertyChangeListener=MapBuzz.databus.registerListener(MapBuzz.UI.PROPERTY_CHANGE,function(_639){
if(this.isModel(_639.data.model)){
this.onPropertyChange(_639.source,_639.data.oldValue,_639.data.newValue);
}
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.UI.PROPERTY_CHANGE,this.propertyChangeListener);
},isModel:function(_63a){
if(this.model===_63a){
return true;
}else{
return false;
}
},onPropertyChange:function(_63b,_63c,_63d){
},reset:function(_63e){
this.model=_63e;
},content:function(){
var _63f=this.getTemplate();
return _63f.run({panel:this,model:this.model});
},validateCommand:function(){
return new MapBuzz.Command.Functor("Validate",{fail:function(_640){
if(_640 instanceof MapBuzz.Validation.Error){
for(var i=0;i<_640.errors.length;i++){
var _642=_640.errors[i];
var _643=this.getPanel(_642.property);
if(!_643){
continue;
}
_643.showError(_642);
}
}
}.bind(this)});
}});
MapBuzz.UI.AbstractPropertyPanel=function AbstractPropertyPanel(name,_645,_646,_647,_648){
this.callSuper(arguments.callee,name,_645,_646);
this.getter=_647;
this.setter=_648;
};
MapBuzz.UI.AbstractPropertyPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.AbstractPropertyPanel.prototype,{getProperty:function(){
var _649=null;
if(this.getter&&typeof this.getter=="function"){
_649=this.getter;
}else{
if(this.getter){
_649=this.model[this.getter];
}
}
if(typeof _649=="function"){
return _649.call(this.model);
}else{
return this.model[this.name];
}
},setProperty:function(_64a){
var _64b=null;
var _64c=this.getProperty();
if(this.setter&&typeof this.setter=="function"){
_64b=this.setter;
}else{
if(this.setter){
_64b=this.model[this.setter];
}
}
if(typeof _64b=="function"){
_64b.call(this.model,_64a);
}else{
this.model[this.name]=_64a;
}
MapBuzz.databus.send(this,MapBuzz.UI.PROPERTY_CHANGE,{model:this.model,oldValue:_64c,newValue:_64a});
}});
MapBuzz.UI.PrimitiveToElement=function PrimitiveToElement(name,_64e,_64f,_650){
this.applySuper(arguments);
};
MapBuzz.UI.PrimitiveToElement.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.PrimitiveToElement.prototype,{initialize:function(_651){
this.applySuper(arguments);
if(this.model.isReadOnly&&this.model.isReadOnly()){
this.element.readOnly=true;
}
},showError:function(_652){
this.element.className=this.addErrorClass(this.element.className);
this.element.innerHTML=_652.message;
},update:function(){
var html=this.getProperty()||" ";
if(this.element.tagName.match(/div/i)){
this.element.innerHTML=html;
}else{
if(typeof html=="string"){
this.element.innerHTML=html.escapeHTML();
}else{
this.element.innerHTML=html.toString();
}
}
}});
MapBuzz.UI.PrimitiveToInput=function PrimitiveToInput(name,_655,_656,_657,_658){
this.applySuper(arguments);
};
MapBuzz.UI.PrimitiveToInput.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.PrimitiveToInput.prototype,{initialize:function(_659){
this.applySuper(arguments);
if(this.model.isReadOnly()){
this.element.readOnly=true;
}
this.changeEventHandler=this.onChange.bindAsEventListener(this);
Event.observe(this.element,"change",this.changeEventHandler);
},release:function(){
Event.stopObserving(this.element,"change",this.changeEventHandler);
this.changeEventHandler=null;
this.applySuper(arguments);
},onChange:function(){
this.save();
},update:function(){
this.element.value=this.getProperty();
},save:function(){
this.setProperty(this.element.value);
},highlight:function(){
if(this.element.createTextRange){
var _65a=this.element.createTextRange();
_65a.select();
}else{
if(this.element.selectionStart){
this.element.setSelectionRange(0,this.element.value.length);
}
}
}});
MapBuzz.UI.PrimitiveToTextArea=function PrimitiveToTextArea(name,_65c,_65d,_65e,_65f){
this.applySuper(arguments);
};
MapBuzz.UI.PrimitiveToTextArea.inherits(MapBuzz.UI.PrimitiveToInput);
Object.extend(MapBuzz.UI.PrimitiveToTextArea.prototype,{update:function(){
this.element.value=(this.getProperty()||" ").unescapeHTML();
},save:function(){
var html=this.element.value.escapeHTML();
this.setProperty(html);
}});
MapBuzz.UI.PrimitiveToLink=function PrimitiveToLink(name,_662,_663,_664,_665){
this.callSuper(arguments.callee,name,_663,_664,_665);
this.linkProperty=_662;
};
MapBuzz.UI.PrimitiveToLink.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.PrimitiveToLink.prototype,{initialize:function(_666){
this.applySuper(arguments);
if(this.model.isReadOnly&&this.model.isReadOnly()){
this.element.readOnly=true;
}
},showError:function(_667){
this.element.className=this.addErrorClass(this.element.className);
this.element.innerHTML=_667.message;
},update:function(){
var _668=this.getProperty()||" ";
var link=this.model[this.linkProperty];
var html="<a href=\""+link.escapeHTML()+"\">"+_668.escapeHTML()+"</a>";
this.element.innerHTML=html;
}});
MapBuzz.UI.PrimitiveToInplaceEditor=function PrimitiveToInplaceEditor(name,_66c,_66d,_66e,_66f){
this.applySuper(arguments);
};
MapBuzz.UI.PrimitiveToInplaceEditor.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.PrimitiveToInplaceEditor.prototype,{initialize:function(_670){
this.applySuper(arguments);
this.createEditor();
},createEditor:function(){
var _671={okText:"OK",onFailure:function(){
},okClassName:"button inplace_button",cancelButton:true,cancelLink:false,cancelText:"Cancel",paramName:this.name+"_inplace_edit",cancelClassName:"button inplace_button"};
this.editor=new Ajax.InPlaceEditor(this.element,this.parent.model.resource.uri,_671);
var _672=this.parent.model.updateCommand();
var _673=this;
this.editor.onSubmit=function(){
_673.setProperty(this.editField.value);
this.onLoading();
var _674=new MapBuzz.Command.Functor("After inplace edit",{execute:function(){
_673.update();
this.onComplete();
}.bind(this),fail:this.onFailure.bind(this)});
_672.next(_674);
_672.execute();
if(arguments.length>1){
Event.stop(arguments[0]);
}
return false;
}.bind(this.editor);
},update:function(){
this.element.innerHTML=this.getProperty().escapeHTML();
}});
MapBuzz.UI.TimeToElement=function TimeToElement(name,_676,_677,_678,_679){
this.format="%m/%e/%Y %I:%M %P";
this.applySuper(arguments);
};
MapBuzz.UI.TimeToElement.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.TimeToElement.prototype,{initialize:function(_67a){
this.applySuper(arguments);
if(this.model.isReadOnly()){
this.element.readOnly=true;
}
},update:function(){
var time=this.getProperty();
if(!time){
return;
}
this.element.innerHTML=time.strftime(this.format);
}});
MapBuzz.UI.TimeToInput=function TimeToInput(name,_67d,_67e,_67f,_680){
this.format="%m/%e/%Y %I:%M %P";
this.applySuper(arguments);
};
MapBuzz.UI.TimeToInput.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.TimeToInput.prototype,{initialize:function(_681){
this.applySuper(arguments);
if(this.model.isReadOnly()){
this.element.readOnly=true;
}
this.changeEventHandler=this.onChange.bindAsEventListener(this);
Event.observe(this.element,"change",this.changeEventHandler);
},release:function(){
Event.stopObserving(this.element,"change",this.changeEventHandler);
this.changeEventHandler=null;
this.applySuper(arguments);
},onChange:function(){
this.save();
},update:function(){
var time=this.getProperty();
if(!time){
return;
}
this.element.value=time.strftime(this.format);
},save:function(){
var _683=Date.parse(this.element.value);
var _684=new Date(_683);
this.setProperty(_684);
},highlight:function(){
if(this.element.createTextRange){
var _685=this.element.createTextRange();
_685.select();
}else{
if(this.element.selectionStart){
this.element.setSelectionRange(0,this.element.value.length);
}
}
}});
MapBuzz.UI.PersonToLink=function PersonToLink(name,_687,_688,_689,_68a){
this.applySuper(arguments);
};
MapBuzz.UI.PersonToLink.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.PersonToLink.prototype,{update:function(){
var _68b=this.getProperty();
if(!_68b){
return null;
}
this.element.href=_68b.uri;
this.element.innerHTML=_68b.name.escapeHTML();
return _68b;
}});
MapBuzz.UI.IconAlbumToImage=function IconAlbumToImage(name,_68d,_68e,_68f){
this.applySuper(arguments);
};
MapBuzz.UI.IconAlbumToImage.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.IconAlbumToImage.prototype,{update:function(){
var _690=this.getProperty();
var _691=_690.defaultGroup();
if(!_691){
_691=this.model.dataSource.defaultIcons[this.model.constructor.TYPE_CATEGORY];
}
var icon=_691.get(MapBuzz.Media.ImageType.MEDIUM);
this.element.src=icon.resource.uri;
if(Browser.instance.isIE()){
fixPng(this.element);
}
}});
MapBuzz.UI.IconAlbumToChooser=function IconAlbumToChooser(name,_694,_695,_696,_697,_698){
this.chooserClass=_698||MapBuzz.Media.IconChooser;
this.callSuper(arguments.callee,name,_694,_695,_696,_697);
};
MapBuzz.UI.IconAlbumToChooser.inherits(MapBuzz.UI.AbstractPropertyPanel);
MapBuzz.UI.IconAlbumToChooser.SIZE=64;
Object.extend(MapBuzz.UI.IconAlbumToChooser.prototype,{initialize:function(_699){
this.imageType=MapBuzz.Media.ImageType.MEDIUM;
this.applySuper(arguments);
var _69a=this.getProperty();
this.chooser=new this.chooserClass(this.element,this.imageType,_69a,this.onChooseCommand());
},release:function(){
this.chooser.release();
},getImageElement:function(){
var _69b=this.element.getElementsByTagName("img");
return _69b[0];
},update:function(){
var _69c=this.getProperty();
var _69d=_69c.defaultGroup();
if(!_69d){
_69d=this.model.dataSource.defaultIcons[this.model.constructor.TYPE_CATEGORY];
}
var icon=_69d.get(MapBuzz.Media.ImageType.MEDIUM);
var _69f=this.getImageElement();
_69f.src=icon.resource.uri;
if(Browser.instance.isIE()){
fixPng(_69f);
}
},onChooseCommand:function(){
var _6a0=new MapBuzz.Command.Functor("Update icon element",{execute:function(_6a1){
this.setProperty(_6a1);
this.update();
if(this.parent.model.figures){
this.parent.model.figures.redisplay();
}
return _6a1;
}.bind(this)});
return _6a0;
}});
MapBuzz.UI.ImagesToCarousel=function ImagesToCarousel(name,_6a3,_6a4,_6a5){
this.applySuper(arguments);
};
MapBuzz.UI.ImagesToCarousel.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.ImagesToCarousel.prototype,{initialize:function(_6a6){
this.applySuper(arguments);
this.carousel=new MapBuzz.Media.ImageCarousel(_6a6,this.getProperty());
this.carousel.refresh();
}});
MapBuzz.UI.LinkToLink=function LinkToLink(name,_6a8,_6a9,rel){
this.rel=rel;
this.applySuper(arguments);
};
MapBuzz.UI.LinkToLink.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.LinkToLink.prototype,{getProperty:function(_6ab){
return this.model.links.findFirstByRel(this.rel);
},update:function(){
var link=this.getProperty();
if(!link){
Element.hide(this.element);
}else{
this.element.href=link.uri;
if(this.element.innerHTML==""){
this.element.innerHTML=link.title.escapeHTML();
}
}
}});
MapBuzz.UI.RepliesToLink=function RepliesToLink(name,_6ae,_6af,_6b0,_6b1){
this.applySuper(arguments);
};
MapBuzz.UI.RepliesToLink.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.RepliesToLink.prototype,{showLabels:function(){
var html=this.element.innerHTML;
return html.match(/[a-zA-Z]/)?true:false;
},getRepliesLink:function(){
var _6b3=this.getProperty();
return _6b3.getLink(MapBuzz.Mime.XHTML);
},displayValue:function(link){
var _6b5=null;
var _6b6=link.count;
if(!this.showLabels()){
_6b5=_6b6.toString();
}else{
if(_6b6==0){
_6b5="No comments";
}else{
if(_6b6==1){
_6b5=_6b6.toString()+" comment";
}else{
_6b5=_6b6.toString()+" comments";
}
}
}
return _6b5;
},update:function(){
var link=this.getRepliesLink();
if(!link){
return;
}
this.element.href=link.uri;
this.element.innerHTML=this.displayValue(link);
}});
MapBuzz.UI.CategoriesToLinks=function CategoriesToLinks(name,_6b9,_6ba,_6bb,_6bc){
this.applySuper(arguments);
};
MapBuzz.UI.CategoriesToLinks.inherits(MapBuzz.UI.PrimitiveToInput);
MapBuzz.UI.CategoriesToLinks.SEPARATOR=", ";
Object.extend(MapBuzz.UI.CategoriesToLinks.prototype,{update:function(){
var _6bd=this.getProperty();
if(!_6bd){
return;
}
var _6be=new Array();
for(var i=0;i<_6bd.length;i++){
var _6c0=_6bd[i];
_6be.push("<a href=\""+_6c0.uri()+"\">"+_6c0.label.escapeHTML()+"</a>");
}
var _6c1=_6be.join(MapBuzz.UI.CategoriesToInput.SEPARATOR);
this.element.innerHTML=_6c1;
}});
MapBuzz.UI.CategoriesToInput=function CategoriesToInput(name,_6c3,_6c4,_6c5,_6c6){
this.applySuper(arguments);
};
MapBuzz.UI.CategoriesToInput.inherits(MapBuzz.UI.PrimitiveToInput);
MapBuzz.UI.CategoriesToInput.SEPARATOR=", ";
Object.extend(MapBuzz.UI.CategoriesToInput.prototype,{getLabels:function(){
var _6c7=new Array();
var _6c8=null;
var _6c9=this.element.value.strip();
if(_6c9==""){
_6c8=[];
}else{
_6c8=this.element.value.split(MapBuzz.UI.CategoriesToInput.SEPARATOR);
}
for(var i=0;i<_6c8.length;i++){
var _6cb=_6c8[i].strip();
if(_6cb){
_6c7.push(_6cb);
}
}
return _6c7;
},onChange:function(){
this.save();
},update:function(){
var _6cc=this.getProperty();
if(!_6cc){
return;
}
var _6cd=new Array();
for(var i=0;i<_6cc.length;i++){
var _6cf=_6cc[i];
_6cd.push(_6cf.label);
}
this.element.value=_6cd.join(MapBuzz.UI.CategoriesToInput.SEPARATOR);
},save:function(){
var _6d0=new Array();
var _6d1=this.getLabels();
for(var i=0;i<_6d1.length;i++){
var _6d3=_6d1[i];
var _6d4=this.model.constructor.TAG_SCHEME;
var _6d5=new MapBuzz.Atom.Category(_6d4,_6d3);
_6d0.push(_6d5);
}
this.setProperty(_6d0);
}});
MapBuzz.UI.ContentToDiv=function ContentToDiv(name,_6d7,_6d8,_6d9){
this.applySuper(arguments);
};
MapBuzz.UI.ContentToDiv.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.ContentToDiv.prototype,{update:function(){
var _6da=this.getProperty();
if(_6da){
this.element.innerHTML=_6da;
}
},onResize:function(_6db,_6dc){
var _6dd=this.getDimension("height");
var _6de=_6dd+_6dc;
if(_6de>0){
this.element.style.height=(_6de+"px");
}
}});
MapBuzz.UI.ContentToStyledDiv=function ContentToStyledDiv(name,_6e0,_6e1,_6e2){
this.applySuper(arguments);
};
MapBuzz.UI.ContentToStyledDiv.inherits(MapBuzz.UI.ContentToDiv);
Object.extend(MapBuzz.UI.ContentToStyledDiv.prototype,{update:function(){
this.applySuper(arguments);
var _6e3=this.model.figures.values[0].styles.normal();
if(_6e3.fontFamily){
this.element.style.fontFamily=_6e3.fontFamily;
}
if(_6e3.fontSize){
this.element.style.fontSize=_6e3.fontSize;
}
if(_6e3.color){
this.element.style.color=_6e3.color;
}
}});
MapBuzz.UI.ContentToEditor=function ContentToEditor(name,_6e5,_6e6,_6e7,_6e8){
this.applySuper(arguments);
};
MapBuzz.UI.ContentToEditor.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.ContentToEditor.prototype,{initialize:function(_6e9){
this.applySuper(arguments);
this.changeHandler=this.onChange.bind(this);
this.mbEditor=new MapBuzz.UI.TextEditor(this.element.id,{"theme_advanced_statusbar_location":"none"});
this.mbEditor.editor.onChange.add(this.changeHandler);
},release:function(){
if(this.mbEditor){
this.mbEditor.editor.onChange.remove(this.changeHandler);
this.mbEditor.release();
this.mbEditor=null;
}
this.applySuper(arguments);
},onChange:function(_6ea){
this.save();
},getClass:function(){
if(this.model.isReadOnly()||!this.mbEditor){
return this.applySuper(arguments);
}else{
var _6eb=this.mbEditor.getIFrame();
var _6ec=_6eb.parentNode;
return _6ec.className;
}
},showError:function(_6ed){
var _6ee=this.mbEditor.getContainer();
_6ee.className=this.addErrorClass(_6ee.className);
},reset:function(){
var _6ef=this.mbEditor.getContainer();
_6ef.className=this.removeErrorClass(_6ef.className);
},update:function(){
var _6f0=this.getProperty();
if(_6f0){
this.element.innerHTML=_6f0;
}
},save:function(){
if(this.mbEditor.isInitialized()){
this.setProperty(this.mbEditor.getContent());
}
},onResize:function(_6f1,_6f2){
var _6f3=new Array();
_6f3.push(this.mbEditor.editor.getContainer());
_6f3.push($(this.mbEditor.editor.id+"_tbl"));
_6f3.push($(this.mbEditor.editor.id+"_ifr"));
for(var i=0;i<_6f3.length;i++){
var _6f5=_6f3[i];
var _6f6=_6f5.clientHeight;
var _6f7=_6f6+_6f2;
if(_6f7>0){
_6f5.style.height=(_6f7+"px");
}
}
}});
MapBuzz.UI.ActionPanel=function ActionPanel(_6f8,_6f9){
this.callSuper(arguments.callee,_6f9.name,_6f8);
this.action=_6f9;
};
MapBuzz.UI.ActionPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.ActionPanel,{ENABLED_CSS_CLASS:"",DISABLED_CSS_CLASS:"disabled",ACTIVATED_CSS_CLASS:"activated",DEACTIVATED_CSS_CLASS:"",HOVER_CSS_CLASS:"hover"});
Object.extend(MapBuzz.UI.ActionPanel.prototype,{initialize:function(_6fa){
this.applySuper(arguments);
this.action.register(this);
this.clickHandler=this.onClick.bindAsEventListener(this);
this.mouseOverHandler=this.onMouseOver.bindAsEventListener(this);
this.mouseOutHandler=this.onMouseOut.bindAsEventListener(this);
Event.observe(this.element,"click",this.clickHandler);
Event.observe(this.element,"mouseover",this.mouseOverHandler);
Event.observe(this.element,"mouseout",this.mouseOutHandler);
},release:function(){
Event.stopObserving(this.element,"click",this.clickHandler);
Event.stopObserving(this.element,"mouseover",this.mouseOverHandler);
Event.stopObserving(this.element,"mouseout",this.mouseOutHandler);
this.action.unregister(this);
this.action=null;
this.applySuper(arguments);
},onClick:function(_6fb){
this.action.execute(this);
},onMouseOver:function(_6fc){
},onMouseOut:function(_6fd){
},enable:function(){
this.element.className=MapBuzz.UI.ActionPanel.ENABLED_CSS_CLASS;
this.element.disabled=false;
},disable:function(){
this.element.className=MapBuzz.UI.ActionPanel.DISABLED_CSS_CLASS;
this.element.disabled=true;
},activate:function(){
this.element.className=MapBuzz.UI.ActionPanel.ACTIVATED_CSS_CLASS;
},deactivate:function(){
this.element.className=MapBuzz.UI.ActionPanel.DEACTIVATED_CSS_CLASS;
}});
MapBuzz.UI.NoteViewPanel=function NoteViewPanel(_6fe){
this.callSuper(arguments.callee,"NoteViewPanel",_6fe);
};
MapBuzz.UI.NoteViewPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.NoteViewPanel.prototype,{createPanels:function(){
var _6ff=new MapBuzz.UI.LinkToLink("share",this.model,this,MapBuzz.Atom.Links.SHARE);
_6ff.initialize(Element.getElementBySelector(this.element,".share a"));
_6ff=new MapBuzz.UI.RepliesToLink("replies",this.model,this);
_6ff.initialize(Element.getElementBySelector(this.element,".discussion a"));
if(MapBuzz.user.uri!=this.model.author.uri){
_6ff=new MapBuzz.UI.PersonToLink("author",this.model,this);
_6ff.initialize(Element.getElementBySelector(this.element,".user_link"));
}
_6ff=new MapBuzz.UI.PrimitiveToElement("content",this.model,this);
_6ff.initialize(Element.getElementBySelector(this.element,".map_note_content"));
},update:function(){
var _700=this.model.figures.values[0].styles.normal();
var _701=this.getPanel("content");
if(_700.fontFamily){
_701.element.style.fontFamily=_700.fontFamily;
}
if(_700.fontSize){
_701.element.style.fontSize=_700.fontSize;
}
if(_700.color){
_701.element.style.color=_700.color;
var _702=Element.getElementBySelector(this.element,".map_note_header");
_702.style.backgroundColor=_700.color;
var _703=Element.getElementBySelector(this.element,".map_note_callout");
_703.src=_703.src.replace(/callout_[^.]*/,function(_704,pos,_706){
var _707=_700.color.toLowerCase().substr(1);
return "callout_"+_707;
});
}
this.applySuper(arguments);
},getTemplate:function(){
if(!this.constructor.template){
var _708="<div class=\"map_note\" style=\"display: none\">"+"  <img class=\"map_note_callout\" src=\"/images/note/callout_000000.gif\" />"+"  <div class=\"map_note_body\">"+"    <div class=\"map_note_header\">"+"      <div class=\"map_note_title_panel\">"+"        <span class=\"share\"><img src=\"/images/share_icon.png\" alt=\"Share\" />"+"                            <a class=\"share\" href=\"#\">Share Note</a>"+"        </span>"+"        <span class=\"discussion\"><img src=\"/images/discussion_icon_small.gif\" alt=\"Discussion\" />"+"                            <a class=\"discussion\" href=\"#\">Comments</a>"+"        </span>"+"      </div>"+"    </div>"+"    <div class=\"map_note_content_container\">"+"      <div class=\"map_note_content\"></div>"+"    </div>"+"    <div class=\"map_note_footer\">"+"      <hr />"+"      <% if (MapBuzz.user.uri == this.model.author.uri) { %>"+"        <p class=\"user_panel\">Your note (<a class=\"edit\" href=\"#\">edit</a>)</p>"+"      <% } else { %>"+"        <p class=\"user_panel\">By <a class=\"user_link\" href=\"#\" target=\"_top\"></a></p>"+"      <% } %>"+"    </div>"+"  </div>"+"</div>";
MapBuzz.user;
this.constructor.template=new MapBuzz.Template.Template(_708);
}
return this.constructor.template;
}});
MapBuzz.UI.NoteEditPanel=function NoteEditPanel(_709){
this.callSuper(arguments.callee,"NoteEditPanel",_709);
};
MapBuzz.UI.NoteEditPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.NoteEditPanel.prototype,{initialize:function(_70a){
this.applySuper(arguments);
},createPanels:function(){
var _70b=new MapBuzz.UI.FontPanel("fontPanel",this.model,this);
_70b.initialize(Element.getElementBySelector(this.element,".font_panel"));
_70b=new MapBuzz.UI.PrimitiveToTextArea("content",this.model,this);
_70b.initialize(Element.getElementBySelector(this.element,".map_note_content"));
if(this.model.isNew()){
_70b=new MapBuzz.UI.InsertButtonPanel("buttonPanel",this);
_70b.initialize(Element.getElementBySelector(this.element,".button_panel"));
}else{
_70b=new MapBuzz.UI.UpdateButtonPanel("buttonPanel",this);
_70b.initialize(Element.getElementBySelector(this.element,".button_panel"));
var _70c=new MapBuzz.Command.Action("Delete",this.removeCommand());
_70b=new MapBuzz.UI.ActionPanel(this,_70c);
_70b.initialize(Element.getElementBySelector(this.element,".remove_button"));
}
},onPropertyChange:function(_70d,_70e,_70f){
this.update();
},update:function(){
var _710=this.model.figures.values[0].styles.normal();
var _711=this.getPanel("content");
if(_710.fontFamily){
_711.element.style.fontFamily=_710.fontFamily;
}
if(_710.fontSize){
_711.element.style.fontSize=_710.fontSize;
}
if(_710.color){
_711.element.style.color=_710.color;
var _712=Element.getElementBySelector(this.element,".map_note_header");
_712.style.backgroundColor=_710.color;
var _713=Element.getElementBySelector(this.element,".map_note_callout");
_713.src=_713.src.replace(/callout_[^.]*/,function(_714,pos,_716){
var _717=_710.color.toLowerCase().substr(1);
return "callout_"+_717;
});
}
this.applySuper(arguments);
},startProcessing:function(){
var _718=Element.getElementBySelector(this.element,".processing_message");
Element.show(_718);
_718=Element.getElementBySelector(this.element,".map_note_header");
Element.hide(_718);
var _719=this.getPanel("buttonPanel");
_719.disable();
},finishProcessing:function(){
var _71a=Element.getElementBySelector(this.element,".processing_message");
Element.hide(_71a);
_71a=Element.getElementBySelector(this.element,".map_note_header");
Element.show(_71a);
var _71b=this.getPanel("buttonPanel");
_71b.enable();
},startProcessingCommand:function(){
return new MapBuzz.Command.Bind("MapNoteProcessing",this.startProcessing.bind(this));
},finishProcessingCommand:function(){
return new MapBuzz.Command.Functor("MapNoteProcessing",{execute:this.finishProcessing.bind(this),fail:this.finishProcessing.bind(this)});
},insertCommand:function(){
var _71c=this.model.dataSource;
return MapBuzz.Command.Build(this.startProcessingCommand(),_71c.insertCommand(this.model),this.finishProcessingCommand(),this.closeCommand());
},updateCommand:function(){
if(this.model.isNew()){
return new MapBuzz.Command.Empty();
}else{
return MapBuzz.Command.Build(this.startProcessingCommand(),this.model.updateCommand(),this.finishProcessingCommand(),this.closeCommand());
}
},removeCommand:function(){
if(this.model.isNew()){
return new MapBuzz.Command.Empty();
}else{
return MapBuzz.Command.Build(this.startProcessingCommand(),this.model.removeCommand(),this.finishProcessingCommand(),this.closeCommand());
}
},getTemplate:function(){
if(!this.constructor.template){
var _71d="<div id=\"map_note_editor\" class=\"map_note\" style=\"display: none\">"+"  <img class=\"map_note_callout\" src=\"/images/note/callout_000000.gif\" />"+"  <img class=\"drag\" src=\"/images/drag.gif\" title=\"Move\" />"+"  <div class=\"map_note_body\">"+"    <% if (!this.model.isReadOnly() && !this.model.isNew()) { %>"+"    <img class=\"remove_button\" alt=\"Delete\" src=\"/images/delete.gif\" title=\"Delete\" />"+"    <% } %>"+"    <div class=\"processing_message\" style=\"display: none\">"+"Processing..."+"    </div>"+"    <div class=\"map_note_header\">"+"      <div class=\"font_panel\">"+"        <select class=\"font_family\" title=\"Font\"></select>"+"        <select class=\"font_size\" title=\"Size\"></select>"+"        <select class=\"color\" title=\"Color\"></select>"+"      </div>"+"    </div>"+"    <div class=\"map_note_content_container\">"+"      <textarea class=\"map_note_content\"></textarea>"+"    </div>"+"    <div class=\"map_note_footer\">"+"      <hr />"+"        <div class=\"button_panel\">"+"          <% if (this.model.isNew()) { %>"+"            <button class=\"insert_button\" type=\"button\">Insert</button>"+"          <% } else { %>"+"            <button class=\"update_button\" type=\"button\">Update</button>"+"          <% } %>"+"          <button class=\"cancel_button\" type=\"button\">Cancel</button>"+"          <img alt=\"Resize\" class=\"se_resize\" src=\"/images/resize.gif\" />"+"        </div>"+"    </div>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_71d);
}
return this.constructor.template;
}});
MapBuzz.UI.BoothViewerPanel=function BoothViewerPanel(_71e,_71f){
this.callSuper(arguments.callee,"View",_71e,_71f);
};
MapBuzz.UI.BoothViewerPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.BoothViewerPanel.prototype,{createPanels:function(){
panel=new MapBuzz.UI.PrimitiveToElement("title",this.model,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_title"));
var _720=this.model.product;
panel=new MapBuzz.UI.PrimitiveToElement("name",_720,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_product_name"));
panel=new MapBuzz.UI.PrimitiveToElement("purchaser",_720,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_product_purchaser"));
panel=new MapBuzz.UI.CloseButtonPanel("buttonPanel",this);
panel.initialize(Element.getElementBySelector(this.element,".buttons"));
},onResize:function(_721,_722){
var _723=this.getPanel("content");
_723.onResize(_721,_722);
},getTemplate:function(){
if(!this.constructor.template){
var _724="<div>"+"  <h2 id=\"booth_window_title\"></h2>"+"  <div class=\"booth_window_product\">"+"    <p id=\"booth_window_product_name\"></p>"+"    <p id=\"booth_window_product_purchaser\"></p>"+"  </div>"+"  <div class=\"buttons\">"+"    <button class=\"close_button\" type=\"button\">Close</button>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_724);
}
return this.constructor.template;
}});
MapBuzz.Command.Action=function Action(name,_726,_727){
this.panels=new Array();
this.name=name;
this.command=_726||new MapBuzz.Command.Empty();
this.images=_727;
this.enabled=true;
this.activated=false;
this.image=null;
this.description="";
};
Object.extend(MapBuzz.Command.Action.prototype,{initialize:function(){
},release:function(){
for(var i=this.panels.length;i>0;i--){
this.panels[i-1].release();
}
},execute:function(){
if(this.enabled){
return this.command.execute.apply(this.command,arguments);
}
},register:function(_729){
this.panels.push(_729);
return _729;
},unregister:function(_72a){
return this.panels.remove(_72a);
},enable:function(){
this.enabled=true;
for(var i=0;i<this.panels.length;i++){
this.panels[i].enable();
}
},disable:function(){
this.enabled=false;
for(var i=0;i<this.panels.length;i++){
this.panels[i].disable();
}
},activate:function(){
if(!this.enabled){
return;
}
this.activated=true;
for(var i=0;i<this.panels.length;i++){
this.panels[i].activate();
}
},deactivate:function(){
if(!this.enabled){
return;
}
this.activated=false;
for(var i=0;i<this.panels.length;i++){
this.panels[i].deactivate();
}
},suspend:function(){
},resume:function(_72f){
},getImage:function(){
if(!this.images){
return null;
}else{
if(!this.enabled){
return this.images.getDisabledImage();
}else{
if(this.activated){
return this.images.getActiveImage();
}else{
return this.images.getEnabledImage();
}
}
}
},getToolTipContent:function(){
return null;
}});
MapBuzz.Command.Action.prototype.toString=function toString(){
return "Action ["+this.name+"]";
};
MapBuzz.UI.AbstractRankPanel=function AbstractRankPanel(name,_731,_732,_733){
this.scheme=_733;
this.callSuper(arguments.callee,name,_731,_732);
};
MapBuzz.UI.AbstractRankPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.AbstractRankPanel.prototype,{getProperty:function(){
return this.model.getRank(this.scheme);
}});
MapBuzz.UI.RankToSpan=function RankToSpan(name,_735,_736,_737){
this.applySuper(arguments);
};
MapBuzz.UI.RankToSpan.inherits(MapBuzz.UI.AbstractRankPanel);
Object.extend(MapBuzz.UI.RankToSpan.prototype,{update:function(){
var rank=this.getProperty();
this.element.innerHTML=rank.getRoundedValue();
}});
MapBuzz.UI.BuzzesToSpan=function BuzzesToSpan(name,_73a,_73b,_73c){
this.applySuper(arguments);
};
MapBuzz.UI.BuzzesToSpan.inherits(MapBuzz.UI.AbstractRankPanel);
Object.extend(MapBuzz.UI.BuzzesToSpan.prototype,{showLabels:function(){
var html=this.element.innerHTML;
return html.match(/[a-zA-Z]/)?true:false;
},displayValue:function(){
var _73e=null;
var rank=this.getProperty();
var _740=rank.value;
if(!this.showLabels()){
_73e=_740.toString();
}else{
if(_740==0){
_73e="No buzzes";
}else{
if(_740==1){
_73e=_740.toString()+" buzz";
}else{
_73e=_740.toString()+" buzzes";
}
}
}
return _73e;
},update:function(){
this.element.innerHTML=this.displayValue();
}});
MapBuzz.UI.RankToRemove=function RankToRemove(name,_742,_743){
this.applySuper(arguments);
};
MapBuzz.UI.RankToRemove.inherits(MapBuzz.UI.AbstractRankPanel);
Object.extend(MapBuzz.UI.RankToRemove.prototype,{initialize:function(_744){
this.applySuper(arguments);
this.onClickHandler=this.onClick.bindAsEventListener(this);
Event.observe(this.element,"click",this.onClickHandler);
},release:function(){
Event.stopObserving(this.element,"click",this.onClickHandler);
this.applySuper(arguments);
},onClick:function(_745){
this.changeRank();
},update:function(){
var rank=this.getProperty();
if(rank.value){
Element.show(this.element);
}else{
Element.hide(this.element);
}
},changeRank:function(){
if(this.processing){
return;
}else{
this.processing=true;
}
var rank=this.getProperty();
var _748=rank.value;
var _749=null;
var _74a=MapBuzz.Command.Build(rank.setValueCommand(null),this.updateCommand(_748,_749));
_74a.execute();
},updateCommand:function(){
if(!this.updateCommand_){
var _74b=new MapBuzz.Command.MultiFunctor("Remove Rank",{execute:function(_74c,_74d){
this.update();
this.processing=false;
this.parent.updateRanks(_74c,_74d);
return [_74c,_74d];
}.bind(this)});
this.updateCommand_=new MapBuzz.Command.Chain("Update Rank Chain",_74b);
}
return this.updateCommand_;
}});
MapBuzz.UI.RanksToImage=function RanksToImage(name,_74f,_750,_751){
this.schemes=_751;
this.callSuper(arguments.callee,name,_74f,_750);
};
MapBuzz.UI.RanksToImage.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.RanksToImage.prototype,{initialize:function(_752){
this.applySuper(arguments);
this.update();
},update:function(){
var _753=this.getImage()||this.getDefaultImage();
this.updateImage(_753);
},updateImage:function(_754){
if(_754&&_754.src!=this.element.src){
this.element.src=_754.src;
}
},getImage:function(){
for(var i=0;i<this.schemes.length;i++){
var _756=this.schemes[i];
var rank=this.model.getRank(_756);
if(rank){
var img=MapBuzz.Rank.Images.instance.getImage(rank.scheme,rank.getRoundedValue());
if(img){
return img;
}
}
}
return null;
},getDefaultImage:function(){
var _759=null;
for(var i=0;i<this.schemes.length;i++){
var _75b=this.schemes[i];
var rank=this.model.getRank(_75b);
if(rank){
var img=MapBuzz.Rank.Images.instance.getDefaultImage(rank.scheme,rank.getRoundedValue());
if(img){
_759=img;
}
}
}
return _759;
}});
MapBuzz.UI.RanksToImageEditor=function RanksToImageEditor(name,_75f,_760,_761){
this.applySuper(arguments);
};
MapBuzz.UI.RanksToImageEditor.inherits(MapBuzz.UI.RanksToImage);
Object.extend(MapBuzz.UI.RanksToImageEditor,{MIN_USER_VALUE:1,MAX_USER_VALUE:5});
Object.extend(MapBuzz.UI.RanksToImageEditor.prototype,{initialize:function(_762){
this.applySuper(arguments);
this.initializeEvents();
},release:function(){
this.releaseEvents();
this.applySuper(arguments);
},initializeEvents:function(){
this.onImageMouseMoveHandler=this.onImageMouseMove.bindAsEventListener(this);
this.onImageMouseOutHandler=this.onImageMouseOut.bindAsEventListener(this);
this.onImageClickHandler=this.onImageClick.bindAsEventListener(this);
Event.observe(this.element,"mousemove",this.onImageMouseMoveHandler);
Event.observe(this.element,"mouseout",this.onImageMouseOutHandler);
Event.observe(this.element,"click",this.onImageClickHandler);
},releaseEvents:function(){
Event.stopObserving(this.element,"mousemove",this.onImageMouseMoveHandler);
Event.stopObserving(this.element,"mouseout",this.onImageMouseOutHandler);
Event.stopObserving(this.element,"click",this.onImageClickHandler);
},onImageMouseMove:function(_763){
var _764=this.calculateValue(_763);
var _765=MapBuzz.Rank.Images.instance.getImage(this.schemes[0],_764);
this.updateImage(_765);
},onImageMouseOut:function(_766){
this.update();
},onImageClick:function(_767){
var _768=this.calculateValue(_767);
this.changeRank(_768);
},getPosition:function(){
return Position.cumulativeOffset(this.element);
},calculateValue:function(_769){
var _76a=Event.pointerX(_769);
var left=this.getPosition()[0];
var _76c=this.element.clientWidth;
var _76d=(_76a-left);
var _76e=_76d/_76c;
var _76f=Math.ceil(_76e*MapBuzz.UI.RanksToImageEditor.MAX_USER_VALUE);
if(_76f<MapBuzz.UI.RanksToImageEditor.MIN_USER_VALUE){
_76f=MapBuzz.UI.RanksToImageEditor.MIN_USER_VALUE;
}else{
if(_76f>MapBuzz.UI.RanksToImageEditor.MAX_USER_VALUE){
_76f=MapBuzz.UI.RanksToImageEditor.MAX_USER_VALUE;
}
}
return _76f;
},changeRank:function(_770){
if(this.processing){
return;
}else{
this.processing=true;
}
var rank=this.model.getRank(this.schemes[0]);
var _772=rank.value;
var _773=MapBuzz.Command.Build(rank.setValueCommand(_770),this.updateCommand(_772,_770));
_773.execute();
},updateCommand:function(){
if(!this.updateCommand_){
var _774=new MapBuzz.Command.MultiFunctor("Update Rank",{execute:function(_775,_776){
this.update();
this.processing=false;
this.parent.updateRanks(_775,_776);
return [_775,_776];
}.bind(this)});
this.updateCommand_=new MapBuzz.Command.Chain("Update Rank Chain",_774);
}
return this.updateCommand_;
}});
MapBuzz.UI.RankViewerPanel=function RankViewerPanel(name,_778,_779){
this.applySuper(arguments);
};
MapBuzz.UI.RankViewerPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.RankViewerPanel.prototype,{createPanels:function(){
var _77a=new MapBuzz.UI.BuzzesToSpan("buzzes",this.model,this,this.model.constructor.RANK_RATINGS_SCHEME);
_77a.initialize(Element.getElementBySelector(this.element,".buzzes"));
var _77b=[this.model.constructor.RANK_AVERAGE_SCHEME];
if(MapBuzz.user.isAuthenticated()){
_77b.unshift(this.model.constructor.RANK_USER_SCHEME);
}
_77a=new MapBuzz.UI.RanksToImage("rank",this.model,this,_77b);
_77a.initialize(Element.getElementBySelector(this.element,".rank"));
}});
MapBuzz.UI.RankCreatorPanel=function RankCreatorPanel(name,_77d,_77e){
this.applySuper(arguments);
};
MapBuzz.UI.RankCreatorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.RankCreatorPanel.prototype,{createPanels:function(){
var _77f=new MapBuzz.UI.RankToRemove("rankRemove",this.model,this,this.model.constructor.RANK_USER_SCHEME);
_77f.initialize(Element.getElementBySelector(this.element,".remove_rank"));
_77f=new MapBuzz.UI.RanksToImageEditor("userRank",this.model,this,[this.model.constructor.RANK_USER_SCHEME]);
_77f.initialize(Element.getElementBySelector(this.element,".user_rank"));
},updateRanks:function(_780,_781){
}});
MapBuzz.UI.RankEditorPanel=function RankEditorPanel(name,_783,_784){
this.applySuper(arguments);
};
MapBuzz.UI.RankEditorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.RankEditorPanel.prototype,{createPanels:function(){
var _785=Element.getElementBySelector(this.element,".buzzes");
if(_785){
var _786=new MapBuzz.UI.BuzzesToSpan("buzzes",this.model,this,this.model.constructor.RANK_RATINGS_SCHEME);
_786.initialize(_785);
}
var _787=Element.getElementBySelector(this.element,".remove_rank");
if(_787){
_786=new MapBuzz.UI.RankToRemove("rankRemove",this.model,this,this.model.constructor.RANK_USER_SCHEME);
_786.initialize(_787);
}
var _788=Element.getElementBySelector(this.element,".rank");
if(_788){
_786=new MapBuzz.UI.RanksToImage("rank",this.model,this,[this.model.constructor.RANK_AVERAGE_SCHEME]);
_786.initialize(_788);
}
var _789=Element.getElementBySelector(this.element,".user_rank");
if(_789){
var _78a=[this.model.constructor.RANK_USER_SCHEME];
if(!_788){
_78a.push(this.model.constructor.RANK_AVERAGE_SCHEME);
}
_786=new MapBuzz.UI.RanksToImageEditor("userRank",this.model,this,_78a);
_786.initialize(_789);
}
},updateRanks:function(_78b,_78c){
var _78d=this.model.getCountRank();
var _78e=this.model.getAverageRank();
var _78f=0;
if(!_78b){
_78f+=1;
}else{
if(!_78c){
_78f-=1;
}
}
var _790=(_78c||0)-(_78b||0);
var _791=(_78d.value||0)*(_78e.value||0);
var _792=(_78d.value||0)+_78f;
var _793=0;
if(_792>0){
_793=(_791+_790)/_792;
}
_78e.value=_793;
_78d.value=_792;
this.updatePanels();
}});
MapBuzz.UI.FeatureEditorPanel=function FeatureEditorPanel(_794,_795){
this.callSuper(arguments.callee,"Edit",_794,_795);
};
MapBuzz.UI.FeatureEditorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.FeatureEditorPanel.prototype,{createPanels:function(){
var _796=new MapBuzz.UI.ContentToEditor("content",this.model,this);
_796.initialize(Element.getElementBySelector(this.element,"#feature_window_content"));
_796=new MapBuzz.UI.RepliesToLink("replies",this.model,this);
_796.initialize(Element.getElementBySelector(this.element,"#feature_window_replies"));
_796=new MapBuzz.UI.IconAlbumToChooser("iconAlbum",this.model,this,null,null,MapBuzz.Media.InPlaceIconChooser);
_796.initialize(Element.getElementBySelector(this.element,"#feature_window_icon_container"));
_796=new MapBuzz.UI.ImagesToCarousel("images",this.model,this);
_796.initialize(Element.getElementBySelector(this.element,"#image_carousel"));
_796=new MapBuzz.UI.PrimitiveToInput("title",this.model,this,null,"setTitle");
_796.initialize(Element.getElementBySelector(this.element,"#feature_window_title"));
_796=new MapBuzz.UI.CategoriesToInput("tags",this.model,this,"getTags","setTags");
_796.initialize(Element.getElementBySelector(this.element,"#feature_window_categories"));
_796=new MapBuzz.UI.RankEditorPanel("ranks",this.model.ranks,this);
_796.initialize(Element.getElementBySelector(this.element,"table.summary"));
_796=new MapBuzz.UI.UpdateButtonPanel("buttonPanel",this);
_796.initialize(Element.getElementBySelector(this.element,".buttons"));
},updateCommand:function(){
return MapBuzz.Command.Build(this.saveCommand(),this.resetCommand(),this.model.updateCommand(),this.validateCommand(),this.closeCommand());
},removeCommand:function(){
return MapBuzz.Command.Build(this.model.removeCommand(),this.closeCommand());
},onResize:function(_797,_798){
var _799=this.getPanel("content");
_799.onResize(_797,_798);
},getTemplate:function(){
if(!this.constructor.template){
var _79a="<form id=\"feature_editor_form\" class=\"one_column no_fieldset\" "+"method=\"post\" action=\"<%= this.model.resource.uri %>\" "+"onsubmit=\"return false;\">"+"  <fieldset id=\"form_content\">"+"    <table class=\"title feature_title\">"+"      <tr>"+"        <td class=\"icon\">"+"          <div id=\"feature_window_icon_container\" class=\"icon_container\">"+"            <img id=\"feature_window_icon\" alt=\"Feature Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"          </div>"+"        </td>"+"        <td class=\"title\">"+"          <label for=\"feature_window_title\">Name:</label>"+"          <input id=\"feature_window_title\" type=\"text\" name=\"Feature[name]\" value=\"\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div class=\"tags\">"+"      <label for=\"feature_window_categories\" class=\"tag_label\">"+"        <img class=\"tag_icon\" src=\"/images/tag_icon.gif\" alt=\"Tags Icon\"/>Tags: "+"        <input id=\"feature_window_categories\" type=\"text\" />"+"      </label>"+"    </div>"+"    <table class=\"summary\">"+"      <tr>"+"        <th>My Rating</th>"+"        <th>Rating</th>"+"        <th>Buzzes</th>"+"        <th class=\"last-child\">Comments</th>"+"      </tr>"+"      <tr>"+"        <td>"+"          <a class=\"remove_rank delete_link\" href=\"#\" title=\"Delete rating\">x</a>"+"          <img class=\"user_rank\" alt=\"User Feature Rank\" src=\"/images/blank.gif\" />"+"        </td>"+"        <td>"+"          <img class=\"rank\" alt=\"Feature Rank\" src=\"/images/blank.gif\" />"+"        </td>"+"        <td>"+"          <span class=\"buzzes\" />"+"        </td>"+"        <td class=\"count last-child\">"+"          <img id=\"feature_window_discussion\" class=\"discussion_icon\" src=\"/images/discussion_icon_small.gif\" alt=\"replies\" /><a id=\"feature_window_replies\" href=\"#\">0</a>"+"        </td>"+"      </tr>"+"    </table>"+"    <div id=\"feature_window_content\" class=\"article\">"+"    </div>"+"    <div id=\"image_carousel\">"+"    <h3>Photos<span> (Loading)</span>:</h3>"+"    <span class=\"add_image\"> "+"      <a id=\"add_photo\" href=\"#\" class=\"icon_container\"> "+"        <img alt=\"Add photo\" class=\"icon_image\" src=\"/images/add_photo_64.png?1208458490\" title=\"Add photo\"/> "+"      </a> "+"    </span> "+"      <span class=\"images\"></span>"+"    </div>"+"    <div class=\"buttons\">"+"      <button class=\"update_button\" type=\"button\">Update</button>"+"      <button class=\"cancel_button\" type=\"button\">Cancel</button>"+"    </div>"+"  </fieldset>"+"</form>";
this.constructor.template=new MapBuzz.Template.Template(_79a);
}
return this.constructor.template;
}});
MapBuzz.UI.ImageBrowserPanel=function ImageBrowserPanel(_79b){
this.imageType=_79b;
this.callSuper(arguments.callee,"Image Browser");
};
MapBuzz.UI.ImageBrowserPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.ImageBrowserPanel,{IMAGE_CLASS:"icon_image",CATEGORY_TITLE:"category_title",UPLOAD_LINK:"upload_link",ICONS_LINK:"icons_link",ICON_CATEGORIES:"icon_categories",ICON_LINK_CLASS:"icon_link",PANEL_CONTAINER:"panel_container",ICONS_PANEL:"icons_panel",ICON_PANEL:"icon_panel",CREATE_PANEL:"create_panel",BROWSER_PANEL:"browser_panel",UPDATE_PANEL:"update_panel"});
Object.extend(MapBuzz.UI.ImageBrowserPanel.prototype,{createPanels:function(){
this.showUploadPanelCommand().execute();
var _79c=$(MapBuzz.UI.ImageBrowserPanel.ICON_CATEGORIES);
this.currentCategoryLink=Element.getElementBySelector(_79c,"a.current");
this.clickCategoryHandler=this.onClickCategory.bindAsEventListener(this);
this.clickIconsLinkHandler=this.onClickIconsLink.bindAsEventListener(this);
this.clickUploadLinkHandler=this.onClickUploadLink.bindAsEventListener(this);
this.clickIconHandler=this.onClickIcon.bindAsEventListener(this);
this.iconCreatedHandler=this.onIconCreated.bindAsEventListener(this);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.ICON_CATEGORIES),"click",this.clickCategoryHandler);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.ICONS_LINK),"click",this.clickIconsLinkHandler);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.UPLOAD_LINK),"click",this.clickUploadLinkHandler);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.PANEL_CONTAINER),"click",this.clickIconHandler);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.CREATE_PANEL),"load",this.iconCreatedHandler);
if(Browser.instance.isIE()&&Browser.instance.majorVersion<7){
this.mouseOverHandler=this.onMouseOver.bindAsEventListener(this);
this.mouseOutHandler=this.onMouseOut.bindAsEventListener(this);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL),"mouseover",this.mouseOverHandler);
Event.observe($(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL),"mouseout",this.mouseOutHandler);
}
this.registerListeners();
},release:function(){
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.ICON_CATEGORIES),"click",this.clickCategoryHandler);
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.ICONS_LINK),"click",this.clickIconsLinkHandler);
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.UPLOAD_LINK),"click",this.clickUploadLinkHandler);
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.PANEL_CONTAINER),"click",this.clickIconHandler);
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.CREATE_PANEL),"load",this.iconCreatedHandler);
if(Browser.instance.isIE()&&Browser.instance.majorVersion<7){
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL),"mouseover",this.mouseOverHandler);
Event.stopObserving($(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL),"mouseout",this.mouseOutHandler);
}
this.unregisterListeners();
},registerListeners:function(){
this.beforeLoadTabListener=MapBuzz.databus.registerListener(MapBuzz.UI.TabsPanel.BEFORE_LOAD_TAB,function(_79d){
var tab=_79d.data.tab;
var _79f=tab.parent.getContentElement();
if(Element.descendantOf(this.element,_79f)){
this.release();
}
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.UI.TabsPanel.BEFORE_LOAD_TAB,this.beforeLoadTabListener);
},onClickCategory:function(_7a0){
Event.stop(_7a0);
var _7a1=Event.element(_7a0);
if(_7a1.tagName.toLowerCase()!="a"){
return;
}
if(_7a1.className=="current"){
return;
}
if(this.currentCategoryLink){
this.currentCategoryLink.className="";
}
this.currentCategoryLink=_7a1;
this.currentCategoryLink.className="current";
this.viewIconsCommand(this.currentCategoryLink).execute();
},onClickIconsLink:function(_7a2){
if(_7a2){
Event.stop(_7a2);
}
$(MapBuzz.UI.ImageBrowserPanel.ICONS_LINK).parentNode.className="current";
$(MapBuzz.UI.ImageBrowserPanel.UPLOAD_LINK).parentNode.className="";
if(Element.visible($(MapBuzz.UI.ImageBrowserPanel.ICON_PANEL))){
this.viewIconsCommand(this.currentCategoryLink).execute();
}else{
this.showIconsPanelCommand().execute();
}
},onClickUploadLink:function(_7a3){
if(_7a3){
Event.stop(_7a3);
}
$(MapBuzz.UI.ImageBrowserPanel.ICONS_LINK).parentNode.className="";
$(MapBuzz.UI.ImageBrowserPanel.UPLOAD_LINK).parentNode.className="current";
this.showUploadPanelCommand().execute();
},onClickIcon:function(_7a4){
var _7a5=Event.element(_7a4);
if(_7a5.tagName.match(/img/i)){
this.onClickIconImage(_7a4,_7a5);
}else{
if(_7a5.tagName.match(/a/i)&&_7a5.id.match(/edit_icon/)){
Event.stop(_7a4);
this.viewIconCommand(_7a5.href).execute();
}else{
if(_7a5.tagName.match(/button/i)&&_7a5.id.match(/delete_icon/i)){
Event.stop(_7a4);
this.removeIconCommand(_7a5.form.action).execute();
}
}
}
},onClickIconImage:function(_7a6,_7a7){
Event.stop(_7a6);
var uri=_7a7.pngFixSrc||_7a7.src;
var icon=MapBuzz.Media.Image.createFromUri(uri);
this.closeCommand().execute(icon);
},onIconCreated:function(_7aa){
var _7ab=$(MapBuzz.UI.ImageBrowserPanel.CREATE_PANEL);
if(!_7ab.contentWindow.getIconGroupData){
return;
}
var data=_7ab.contentWindow.getIconGroupData();
var _7ad=MapBuzz.Media.Group.createFromJson(data);
var icon=_7ad.get(this.imageType);
if(!icon){
return;
}
this.closeCommand().execute(icon);
},onMouseOver:function(_7af){
var _7b0=Event.element(_7af);
if(_7b0&&_7b0.tagName.toLowerCase()=="div"&&_7b0.className=="icon"){
_7b0.style.borderColor="#C3D6EE";
}
},onMouseOut:function(_7b1){
var _7b2=Event.element(_7b1);
var _7b3=Event.relatedTarget(_7b1);
if(_7b2&&_7b2.tagName.toLowerCase()=="div"&&_7b2.className=="icon"){
if(_7b3&&_7b3.tagName.toLowerCase()=="div"&&_7b3.className=="icon_image_container"){
return;
}
if(_7b3&&_7b3.tagName.toLowerCase()=="img"&&_7b3.className=="icon_image"){
return;
}
_7b2.style.borderColor="White";
}
},viewIconsCommand:function(_7b4){
var _7b5=new MapBuzz.Resource.Remote(_7b4.href);
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Loading",MapBuzz.Message.PROCESSING),_7b5.getCommand().copy(),new MapBuzz.Command.UpdateElement(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL),this.updateCategoryCommand(_7b4.id),new MapBuzz.Command.Databus(MapBuzz.Message.CLEAR_MESSAGE,{level:MapBuzz.Message.PROCESSING}),this.showIconsPanelCommand());
},viewIconCommand:function(uri){
var _7b7=new MapBuzz.Resource.Remote(uri);
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Loading",MapBuzz.Message.PROCESSING),_7b7.getCommand(),new MapBuzz.Command.UpdateElement(MapBuzz.UI.ImageBrowserPanel.ICON_PANEL),new MapBuzz.Command.Databus(MapBuzz.Message.CLEAR_MESSAGE,{level:MapBuzz.Message.PROCESSING}),this.showIconPanelCommand());
},updateCategoryCommand:function(id){
return new MapBuzz.Command.Functor("Update Category",{execute:function(){
var _7b9=id.match(/^category_\d+_(.*)$/);
if(!_7b9||_7b9.length!=2){
return;
}
var _7ba=_7b9[1];
if(_7ba!="Icons"){
_7b9=_7ba.match(/Icons\.(.*)/);
if(!_7b9||_7b9.length!=2){
return;
}
_7ba=_7b9[1];
}
Element.update(MapBuzz.UI.ImageBrowserPanel.CATEGORY_TITLE,_7ba);
}.bind(this)});
},removeIconCommand:function(uri){
var _7bc=new MapBuzz.Resource.Permissions(false,true,true);
var _7bd=new MapBuzz.Resource.Remote(uri,_7bc);
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Deleting icon",MapBuzz.Message.PROCESSING),_7bd.deleteCommand(),new MapBuzz.Command.UpdateElement(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL),new MapBuzz.Command.Databus(MapBuzz.Message.CLEAR_MESSAGE,{level:MapBuzz.Message.PROCESSING}),this.showIconsPanelCommand());
},showIconsPanelCommand:function(){
return new MapBuzz.Command.Functor("Show Icons Panel",{execute:function(){
Element.hide($(MapBuzz.UI.ImageBrowserPanel.CREATE_PANEL));
Element.show($(MapBuzz.UI.ImageBrowserPanel.BROWSER_PANEL));
Element.show($(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL));
Element.hide($(MapBuzz.UI.ImageBrowserPanel.ICON_PANEL));
if(Browser.instance.isIE()){
fixPngs(this.element);
}
}.bind(this)});
},showUploadPanelCommand:function(){
return new MapBuzz.Command.Functor("Show Upload Panel",{execute:function(){
Element.show($(MapBuzz.UI.ImageBrowserPanel.CREATE_PANEL));
Element.hide($(MapBuzz.UI.ImageBrowserPanel.BROWSER_PANEL));
}.bind(this)});
},showIconPanelCommand:function(){
return new MapBuzz.Command.Functor("Show Icon Panel",{execute:function(){
Element.hide($(MapBuzz.UI.ImageBrowserPanel.CREATE_PANEL));
Element.hide($(MapBuzz.UI.ImageBrowserPanel.ICONS_PANEL));
Element.show($(MapBuzz.UI.ImageBrowserPanel.ICON_PANEL));
}.bind(this)});
}});
MapBuzz.UI.BoothRemovePanel=function BoothRemovePanel(_7be,_7bf){
this.callSuper(arguments.callee,"Edit",_7be,_7bf);
};
MapBuzz.UI.BoothRemovePanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.BoothRemovePanel.prototype,{updateCommand:function(){
return MapBuzz.Command.Build(this.saveCommand(),this.resetCommand(),this.model.updateCommand(),this.validateCommand(),this.closeCommand());
},removeCommand:function(){
return MapBuzz.Command.Build(this.model.removeCommand(),this.closeCommand());
},createPanels:function(){
panel=new MapBuzz.UI.PrimitiveToElement("title",this.model,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_title"));
var _7c0=this.model.product;
panel=new MapBuzz.UI.PrimitiveToElement("name",_7c0,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_product_name"));
panel=new MapBuzz.UI.PrimitiveToElement("dependencies",_7c0,this,function(){
return "";
});
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_dependencies"));
panel=new MapBuzz.UI.RemoveButtonPanel("buttonPanel",this);
panel.initialize(Element.getElementBySelector(this.element,".buttons"));
},onResize:function(_7c1,_7c2){
var _7c3=this.getPanel("content");
_7c3.onResize(_7c1,_7c2);
},getTemplate:function(){
if(!this.constructor.template){
var _7c4="<div>"+"  <div class=\"booth_window_product\">"+"    <p id=\"booth_window_product_name\"></p>"+"  </div>"+"  <h2 id=\"booth_window_title\"></h2>"+"  <div id=\"booth_window_dependencies\">"+"  </div>"+"  <div class=\"buttons\">"+"    <button class=\"remove_button\" type=\"button\">Remove Booth</button>"+"    <button class=\"cancel_button\" type=\"button\">Close</button>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_7c4);
}
return this.constructor.template;
}});
MapBuzz.UI.ToolTipInsidePanel=function ToolTipInsidePanel(_7c5){
this.callSuper(arguments.callee,"Tooltip",_7c5);
};
MapBuzz.UI.ToolTipInsidePanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.ToolTipInsidePanel.prototype,{createPanels:function(){
var _7c6=new MapBuzz.UI.PrimitiveToElement("title",this.model,this,null,"setTitle");
_7c6.initialize(Element.getElementBySelector(this.element,".tooltip_title"));
},getTemplate:function(){
if(!this.constructor.template){
var _7c7="<div class=\"tooltip\" style=\"display: none\">"+"  <div class=\"item\">"+"    <h2 class=\"tooltip_title\"></h2>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_7c7);
}
return this.constructor.template;
}});
MapBuzz.UI.ToolTipPanel=function ToolTipPanel(_7c8){
this.callSuper(arguments.callee,"Tooltip",_7c8);
};
MapBuzz.UI.ToolTipPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.ToolTipPanel.prototype,{createPanels:function(){
var _7c9=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_7c9.initialize(Element.getElementBySelector(this.element,".tooltip_icon"));
_7c9=new MapBuzz.UI.PrimitiveToElement("title",this.model,this,null,"setTitle");
_7c9.initialize(Element.getElementBySelector(this.element,".tooltip_title"));
_7c9=new MapBuzz.UI.PersonToLink("author",this.model,this);
_7c9.initialize(Element.getElementBySelector(this.element,".tooltip_creator"));
var _7ca=this.model.ranks;
if(_7ca){
var _7cb=[_7ca.constructor.RANK_AVERAGE_SCHEME];
if(MapBuzz.user.isAuthenticated()){
_7cb.unshift(_7ca.constructor.RANK_USER_SCHEME);
}
_7c9=new MapBuzz.UI.RanksToImage("rank",_7ca,this,_7cb);
_7c9.initialize(Element.getElementBySelector(this.element,"img.rank"));
}
if(this.model.replies){
_7c9=new MapBuzz.UI.RepliesToLink("replies",this.model,this);
_7c9.initialize(Element.getElementBySelector(this.element,".tooltip_replies"));
}
},getTemplate:function(){
if(!this.constructor.template){
var _7cc="<div class=\"tooltip\" style=\"display: none\">"+"  <div class=\"item\">"+"    <div class=\"icon\">"+"      <img class=\"tooltip_icon icon_image\" alt=\"Feature Icon\" src=\"/images/blank.gif\" />"+"    </div>"+"    <h2 class=\"tooltip_title\"></h2>"+"    <span class=\"user_link\">By <a class=\"tooltip_creator user_link\" href=\"#\"></a></span>"+"    <div class=\"links\">"+"      <span class=\"ranks\">"+"        <img class=\"rank\" alt=\"Feature Rank\" src=\"/images/blank.gif\" />"+"      </span>"+"      <img class=\"tooltip_discussion discussion_icon\" src=\"/images/discussion_icon_small.gif\" alt=\"replies\" /><a class=\"tooltip_replies\" href=\"#\">0</a>"+"    </div>"+"    <p><strong>Click</strong> to learn more about this feature.</p>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_7cc);
}
return this.constructor.template;
}});
MapBuzz.UI.Images=function Images(_7cd,path,_7cf){
this.baseName=_7cd;
this.path=path||"/images/";
this.extension=_7cf||".gif";
};
Object.extend(MapBuzz.UI.Images.prototype,{getEnabledImage:function(){
if(!this.enabledImage){
this.enabledImage=new Image();
this.enabledImage.src=this.path+this.baseName+this.extension;
}
return this.enabledImage;
},getDisabledImage:function(){
if(!this.disabledImage){
this.disabledImage=new Image();
this.disabledImage.src=this.path+this.baseName+"_disabled"+this.extension;
}
return this.disabledImage;
},getHoverImage:function(){
if(!this.hoverImage){
this.hoverImage=new Image();
this.hoverImage.src=this.path+this.baseName+"_hover"+this.extension;
}
return this.hoverImage;
},getActiveImage:function(){
if(!this.activeImage){
this.activeImage=new Image();
this.activeImage.src=this.path+this.baseName+"_active"+this.extension;
}
return this.activeImage;
}});
MapBuzz.UI.Images.prototype.toString=function toString(){
return "Images ["+this.getEnabledImage()+"]";
};
MapBuzz.UI.CloseButtonPanel=function CloseButtonPanel(name,_7d1){
this.applySuper(arguments);
};
MapBuzz.UI.CloseButtonPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.CloseButtonPanel.prototype,{createPanels:function(){
var _7d2=new MapBuzz.Command.Action("Close",this.getRoot().closeCommand());
var _7d3=new MapBuzz.UI.ActionPanel(this,_7d2);
_7d3.initialize(Element.getElementBySelector(this.element,".close_button"));
}});
MapBuzz.UI.InsertButtonPanel=function InsertButtonPanel(name,_7d5){
this.applySuper(arguments);
};
MapBuzz.UI.InsertButtonPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.InsertButtonPanel.prototype,{createPanels:function(){
var _7d6=new MapBuzz.Command.Action("Insert",this.getRoot().insertCommand());
var _7d7=new MapBuzz.UI.ActionPanel(this,_7d6);
_7d7.initialize(Element.getElementBySelector(this.element,".insert_button"));
_7d6=new MapBuzz.Command.Action("Cancel",this.getRoot().cancelCommand());
_7d7=new MapBuzz.UI.ActionPanel(this,_7d6);
_7d7.initialize(Element.getElementBySelector(this.element,".cancel_button"));
}});
MapBuzz.UI.UpdateButtonPanel=function UpdateButtonPanel(name,_7d9){
this.applySuper(arguments);
};
MapBuzz.UI.UpdateButtonPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.UpdateButtonPanel.prototype,{createPanels:function(){
var _7da=new MapBuzz.Command.Action("Update",this.getRoot().updateCommand());
var _7db=new MapBuzz.UI.ActionPanel(this,_7da);
_7db.initialize(Element.getElementBySelector(this.element,".update_button"));
_7da=new MapBuzz.Command.Action("Cancel",this.getRoot().cancelCommand());
_7db=new MapBuzz.UI.ActionPanel(this,_7da);
_7db.initialize(Element.getElementBySelector(this.element,".cancel_button"));
}});
MapBuzz.UI.AddButtonPanel=function AddButtonPanel(name,_7dd){
this.applySuper(arguments);
};
MapBuzz.UI.AddButtonPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.AddButtonPanel.prototype,{createPanels:function(){
var _7de=null;
var _7df=null;
if(this.isInsertable()){
_7de=new MapBuzz.Command.Action("Add",this.getRoot().addCommand());
_7df=new MapBuzz.UI.ActionPanel(this,_7de);
_7df.initialize(Element.getElementBySelector(this.element,".add_button"));
}
_7de=new MapBuzz.Command.Action("Close",this.getRoot().closeCommand());
_7df=new MapBuzz.UI.ActionPanel(this,_7de);
_7df.initialize(Element.getElementBySelector(this.element,".close_button"));
},isInsertable:function(){
var _7e0=this.parent.model.dataSource.dataSources.getActive();
if(_7e0&&_7e0.resource.isInsertable()){
return true;
}else{
return false;
}
}});
MapBuzz.UI.RemoveButtonPanel=function RemoveButtonPanel(name,_7e2){
this.applySuper(arguments);
};
MapBuzz.UI.RemoveButtonPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.RemoveButtonPanel.prototype,{createPanels:function(){
var _7e3=null;
var _7e4=null;
if(this.isRemovable()){
_7e3=new MapBuzz.Command.Action("Remove",this.getRoot().removeCommand());
_7e4=new MapBuzz.UI.ActionPanel(this,_7e3);
_7e4.initialize(Element.getElementBySelector(this.element,".remove_button"));
}
_7e3=new MapBuzz.Command.Action("Close",this.getRoot().closeCommand());
_7e4=new MapBuzz.UI.ActionPanel(this,_7e3);
_7e4.initialize(Element.getElementBySelector(this.element,".cancel_button"));
},isRemovable:function(){
var _7e5=this.parent.model.dataSource.dataSources.getActive();
if(_7e5&&_7e5.resource.isRemovable()){
return true;
}else{
return false;
}
}});
MapBuzz.UI.RouteButtonPanel=function RouteButtonPanel(name,_7e7){
this.applySuper(arguments);
};
MapBuzz.UI.RouteButtonPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.RouteButtonPanel.prototype,{createPanels:function(){
var _7e8=new MapBuzz.Command.Action("Route",this.getRoot().routeCommand());
var _7e9=new MapBuzz.UI.ActionPanel(this,_7e8);
_7e9.initialize(Element.getElementBySelector(this.element,".route_button"));
_7e8=new MapBuzz.Command.Action("Close",this.getRoot().closeCommand());
_7e9=new MapBuzz.UI.ActionPanel(this,_7e8);
_7e9.initialize(Element.getElementBySelector(this.element,".close_button"));
}});
MapBuzz.UI.EventCreatorPanel=function EventCreatorPanel(_7ea,_7eb){
this.callSuper(arguments.callee,"Create",_7ea,_7eb);
};
MapBuzz.UI.EventCreatorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.EventCreatorPanel.prototype,{createPanels:function(){
var _7ec=new MapBuzz.UI.ContentToEditor("content",this.model,this);
_7ec.initialize(Element.getElementBySelector(this.element,"#event_window_content"));
_7ec=new MapBuzz.UI.IconAlbumToChooser("iconAlbum",this.model,this,null,null,MapBuzz.Media.InPlaceIconChooser);
_7ec.initialize(Element.getElementBySelector(this.element,"#event_window_icon_container"));
_7ec=new MapBuzz.UI.PrimitiveToInput("title",this.model,this,null,"setTitle");
_7ec.initialize(Element.getElementBySelector(this.element,"#event_window_title"));
_7ec=new MapBuzz.UI.CategoriesToInput("tags",this.model,this,"getTags","setTags");
_7ec.initialize(Element.getElementBySelector(this.element,"#event_window_categories"));
_7ec=new MapBuzz.UI.TimeToInput("start",this.model,this);
_7ec.initialize(Element.getElementBySelector(this.element,"#event_window_start_time"));
_7ec=new MapBuzz.UI.TimeToInput("end",this.model,this);
_7ec.initialize(Element.getElementBySelector(this.element,"#event_window_end_time"));
_7ec=new MapBuzz.UI.InsertButtonPanel("buttonPanel",this);
_7ec.initialize(Element.getElementBySelector(this.element,".buttons"));
},insertCommand:function(){
var _7ed=this.model.dataSource;
if(!this.insertCommand_){
this.insertCommand_=new MapBuzz.Command.Chain("Insert Event",this.saveCommand(),this.resetCommand(),_7ed.insertCommand(this.model),this.validateCommand(),this.closeCommand());
}
return this.insertCommand_;
},onResize:function(_7ee,_7ef){
var _7f0=this.getPanel("content");
_7f0.onResize(_7ee,_7ef);
},getTemplate:function(){
if(!this.constructor.template){
var _7f1="<form id=\"event_editor_form\" class=\"no_fieldset\" "+"method=\"post\" action=\"<%= this.model.resource.uri %>\" "+"onsubmit=\"return false;\">"+"  <fieldset id=\"form_content\">"+"    <table class=\"title event_title\">"+"      <tr>"+"        <td class=\"icon\">"+"          <div id=\"event_window_icon_container\" class=\"icon_container\">"+"            <img id=\"event_window_icon\" alt=\"Event Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"          </div>"+"        </td>"+"        <td class=\"title\">"+"          <label for=\"event_window_title\">Name:</label>"+"          <input id=\"event_window_title\" type=\"text\" name=\"Event[name]\" value=\"\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div class=\"tags\">"+"      <img class=\"tag_icon\" src=\"/images/tag_icon.gif\" alt=\"Tags Icon\"/>"+"      <span class=\"tag_label\">Tags:</span>"+"      <input id=\"event_window_categories\" type=\"text\" />"+"    </div>"+"    <table class=\"when\">"+"      <tr>"+"        <td class=\"label\">"+"           <label for=\"event_window_start_time\">Start: </label>"+"        </td>"+"        <td>"+"           <input type=\"text\" id=\"event_window_start_time\" />"+"        </td>"+"      </tr>"+"      <tr>"+"        <td class=\"label\">"+"           <label for=\"event_window_end_time\" >End: </label>"+"        </td>"+"        <td>"+"          <input type=\"text\" id=\"event_window_end_time\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div id=\"event_window_content\" class=\"article\">"+"    </div>"+"    <div class=\"buttons\">"+"      <button class=\"insert_button\" type=\"button\">Insert</button>"+"      <button class=\"cancel_button\" type=\"button\">Cancel</button>"+"    </div>"+"  </fieldset>"+"</form>";
this.constructor.template=new MapBuzz.Template.Template(_7f1);
}
return this.constructor.template;
}});
MapBuzz.ToolTip=function ToolTip(){
this.visible=false;
this.onMouseMoveHandler=this.onMouseMove.bindAsEventListener(this);
};
Object.extend(MapBuzz.ToolTip,{CLASS_NAME:"tooltip",PIXEL_X_OFFSET:30,PIXEL_Y_OFFSET:10});
Object.extend(MapBuzz.ToolTip.prototype,{initialize:function(){
this.createElement();
Event.observe(this.element,"mousemove",this.onMouseMoveHandler);
},release:function(){
Event.stopObserving(this.element,"mousemove",this.onMouseMoveHandler);
this.element=null;
},createElement:function(){
this.element=Element.create("div");
this.element.style.display="none";
this.element.className=MapBuzz.ToolTip.CLASS_NAME;
var body=document.getBodyElement();
body.insertBefore(this.element,body.firstChild);
},show:function(_7f3){
var docX=Event.pointerX(_7f3);
var docY=Event.pointerY(_7f3);
this.showAt(docX,docY);
},showAt:function(x,y){
if(!this.element){
this.initialize();
}
x+=MapBuzz.ToolTip.PIXEL_X_OFFSET;
y+=MapBuzz.ToolTip.PIXEL_Y_OFFSET;
this.moveTo(x,y);
if(!this.visible){
Element.show(this.element);
}
this.visible=true;
},hide:function(){
if(!this.element){
return;
}
if(this.visible){
Element.hide(this.element);
}
this.visible=false;
},moveTo:function(x,y){
if(!this.element){
this.initialize();
}
this.element.style.left=x+"px";
this.element.style.top=y+"px";
},setContent:function(_7fa){
if(!this.element){
return;
}
Element.update(this.element,_7fa||"");
},setPanel:function(_7fb){
if(!this.element){
return;
}
var html=_7fb.contentCommand().execute();
this.setContent(html);
_7fb.initializeCommand().execute(this.element);
},onMouseMove:function(_7fd){
if(this.visible){
var docX=Event.pointerX(_7fd);
var docY=Event.pointerY(_7fd);
this.moveTo(docX,docY);
}
}});
MapBuzz.ToolTip.instance=new MapBuzz.ToolTip();
MapBuzz.UI.RoutePanel=function RoutePanel(_800,_801){
this.callSuper(arguments.callee,"Directions",_800,_801);
};
MapBuzz.UI.RoutePanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.RoutePanel.prototype,{createPanels:function(){
var _802=new MapBuzz.UI.RouteButtonPanel("buttonPanel",this);
_802.initialize(Element.getElementBySelector(this.element,".buttons"));
},routeCommand:function addCommand(){
var _803=new MapBuzz.Command.Functor("Route",{execute:function(){
var map=this.model.dataSource.dataSources.map;
var view=map.view;
var _806=new MapBuzz.Component.Directions(view);
var _807=this.getDestination();
_806.load(this.model,_807);
this.closeCommand().execute();
}.bind(this)});
return _803;
},getDestination:function(){
var _808="";
var _809=Element.getElementBySelector(this.element,"input:checked[type=\"radio\"][name=\"destination\"]");
var _80a=null;
if(_809.value=="feature"){
_80a=$("destination_feature");
}else{
if(_809.value=="address"){
_80a=$("destination_address");
}
}
return _80a.value;
},getTemplate:function(){
if(!this.constructor.template){
var _80b="<div class=\"route\">           <p><a href=\"#\">To Here</a> | <a href=\"#\">From Here</a></p>           <form action=\"#\" method=\"get\">             <fieldset>             <table class=\"route\">             <tr>               <td><label for=\"destination_address\">               <input checked=\"true\" name=\"destination\" type=\"radio\" value=\"address\" />Address:               </label></td>               <td class=\"entry\"><input id=\"destination_address\" type=\"text\" value=\"\" /></td>             </tr> <!--            <tr>               <td><label for=\"destination_feature\">               <input name=\"destination\" type=\"radio\" value=\"feature\" />Feature:               </label></td>               <td class=\"entry\"><input id=\"destination_feature\" type=\"text\" /></td>             </tr> -->            </table>             </fieldset>           </form>           <div class=\"buttons\">             <button class=\"route_button\" type=\"button\">Directions</button>             <button class=\"close_button\" type=\"button\">Close</button>           </div>         </div>";
this.constructor.template=new MapBuzz.Template.Template(_80b);
}
return this.constructor.template;
}});
MapBuzz.UI.FeatureCreatorPanel=function FeatureCreatorPanel(_80c,_80d){
this.callSuper(arguments.callee,"Create",_80c,_80d);
};
MapBuzz.UI.FeatureCreatorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.FeatureCreatorPanel.prototype,{createPanels:function(){
var _80e=new MapBuzz.UI.ContentToEditor("content",this.model,this);
_80e.initialize(Element.getElementBySelector(this.element,"#feature_window_content"));
_80e=new MapBuzz.UI.IconAlbumToChooser("iconAlbum",this.model,this,null,null,MapBuzz.Media.InPlaceIconChooser);
_80e.initialize(Element.getElementBySelector(this.element,"#feature_window_icon_container"));
_80e=new MapBuzz.UI.PrimitiveToInput("title",this.model,this,null,"setTitle");
_80e.initialize(Element.getElementBySelector(this.element,"#feature_window_title"));
_80e=new MapBuzz.UI.CategoriesToInput("tags",this.model,this,"getTags","setTags");
_80e.initialize(Element.getElementBySelector(this.element,"#feature_window_categories"));
_80e=new MapBuzz.UI.RankCreatorPanel("ranks",this.model.ranks,this);
_80e.initialize(Element.getElementBySelector(this.element,"table.summary"));
_80e=new MapBuzz.UI.InsertButtonPanel("buttonPanel",this);
_80e.initialize(Element.getElementBySelector(this.element,".buttons"));
},insertCommand:function(){
var _80f=this.model.dataSource;
if(!this.insertCommand_){
this.insertCommand_=new MapBuzz.Command.Chain("Insert Feature",this.saveCommand(),this.resetCommand(),_80f.insertCommand(this.model),this.validateCommand(),this.closeCommand());
}
return this.insertCommand_;
},onResize:function(_810,_811){
var _812=this.getPanel("content");
_812.onResize(_810,_811);
},getTemplate:function(){
if(!this.constructor.template){
var _813="<form id=\"feature_editor_form\" class=\"one_column no_fieldset\" "+"method=\"post\" action=\"<%= this.model.resource.uri %>\" "+"onsubmit=\"return false;\">"+"  <fieldset id=\"form_content\">"+"    <table class=\"title feature_title\">"+"      <tr>"+"        <td class=\"icon\">"+"          <div id=\"feature_window_icon_container\" class=\"icon_container\">"+"            <img id=\"feature_window_icon\" alt=\"Feature Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"          </div>"+"        </td>"+"        <td class=\"title\">"+"          <label for=\"feature_window_title\">Name:</label>"+"          <input id=\"feature_window_title\" type=\"text\" name=\"Feature[name]\" value=\"\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div class=\"tags\">"+"      <img class=\"tag_icon\" src=\"/images/tag_icon.gif\" alt=\"Tags Icon\"/>"+"      <span class=\"tag_label\">Tags:</span>"+"      <input id=\"feature_window_categories\" type=\"text\" />"+"    </div>"+"    <table class=\"summary\">"+"      <tr>"+"        <th>My Rating</th>"+"      </tr>"+"      <tr>"+"        <td>"+"          <a class=\"remove_rank delete_link\" href=\"#\" title=\"Delete rating\">x</a>"+"          <img class=\"user_rank\" alt=\"User Feature Rank\" src=\"/images/blank.gif\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div id=\"feature_window_content\" class=\"article\">"+"    </div>"+"    <div class=\"buttons\">"+"      <button class=\"insert_button\" type=\"button\">Insert</button>"+"      <button class=\"cancel_button\" type=\"button\">Cancel</button>"+"    </div>"+"  </fieldset>"+"</form>";
this.constructor.template=new MapBuzz.Template.Template(_813);
}
return this.constructor.template;
}});
MapBuzz.UI.ToolBar=function ToolBar(_814,_815,_816,_817,_818){
this.toolManager=_814;
this.options=_818||{showToolTip:true};
this.imagePath=_816;
this.buttons=new Array();
this.callSuper(arguments.callee,"Toolbar",_817);
this.initialize(_815);
};
MapBuzz.UI.ToolBar.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.ToolBar.prototype,{release:function(){
for(var i=0;i<this.buttons.length;i++){
var _81a=this.buttons[i];
_81a.release();
}
this.buttons.length=0;
},createPanels:function(){
var _81b=this.element.getElementsByTagName("button");
var _81c=null;
for(var i=0;i<_81b.length;i++){
var _81e=_81b[i];
var _81f=_81e.className;
var _820=MapBuzz.Tool[_81f.camelize(true)];
if(!_820){
continue;
}
var _821=new MapBuzz.UI.Images(_81f.underscore(),this.imagePath);
var _822=new _820(this.toolManager,_821);
_81c=new MapBuzz.UI.ToolBarButton(this,_822);
this.buttons.push(_81c);
_81c.initialize(_81e);
}
if(this.buttons.length>0){
_81c=this.buttons[0];
var tool=_81c.action;
this.toolManager.setDefaultTool(tool);
tool.execute();
}
}});
MapBuzz.UI.ToolBarButton=function ToolBarButton(_824,_825){
this.applySuper(arguments);
};
MapBuzz.UI.ToolBarButton.inherits(MapBuzz.UI.ActionPanel);
Object.extend(MapBuzz.UI.ToolBarButton.prototype,{initialize:function(_826){
this.applySuper(arguments);
this.imageElement=this.element.getElementsByTagName("img")[0];
this.imageElement.src=this.action.getImage().src;
},onMouseOver:function(_827){
this.showToolTip();
if(this.action.enabled){
this.imageElement.src=this.action.images.getHoverImage().src;
}
this.applySuper(arguments);
},onMouseOut:function(_828){
this.hideToolTip();
if(this.action.enabled){
this.imageElement.src=this.action.getImage().src;
}
this.applySuper(arguments);
},enable:function(){
var _829=this.action.getImage();
if(this.imageElement.src!=_829.src){
this.imageElement.src=_829.src;
}
this.applySuper(arguments);
},disable:function(){
var _82a=this.action.getImage();
if(this.imageElement.src!=_82a.src){
this.imageElement.src=_82a.src;
}
this.applySuper(arguments);
},activate:function(){
var _82b=this.action.getImage();
if(this.imageElement.src!=_82b.src){
this.imageElement.src=_82b.src;
}
this.applySuper(arguments);
},deactivate:function(){
var _82c=this.action.getImage();
if(this.imageElement.src!=_82c.src){
this.imageElement.src=_82c.src;
}
this.applySuper(arguments);
},showToolTip:function(){
if(!this.parent.options.showToolTip){
return;
}
var _82d=Position.cumulativeOffset(this.element);
var _82e=Element.getDimensions(this.element);
var docX=_82d[0]+_82e.width;
var docY=_82d[1]+_82e.height;
var _831=MapBuzz.ToolTip.instance;
_831.showAt(docX,docY);
_831.setContent(this.action.getToolTipContent());
},hideToolTip:function(_832){
MapBuzz.ToolTip.instance.hide();
}});
MapBuzz.UI.ExhibitorViewerPanel=function ExhibitorViewerPanel(_833,_834){
this.callSuper(arguments.callee,"View",_833,_834);
};
MapBuzz.UI.ExhibitorViewerPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.ExhibitorViewerPanel.prototype,{createPanels:function(){
var _835=new MapBuzz.UI.ContentToDiv("content",this.model,this);
_835.initialize(Element.getElementBySelector(this.element,"#feature_window_content"));
_835=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_835.initialize(Element.getElementBySelector(this.element,"#feature_window_icon"));
var link=this.model.links.alternate(MapBuzz.Mime.HTML);
var data={title:this.model.title,uri:link.uri};
_835=new MapBuzz.UI.PrimitiveToLink("title","uri",data,this);
_835.initialize(Element.getElementBySelector(this.element,"#feature_window_title"));
_835=new MapBuzz.UI.PrimitiveToElement("booth",this.model,this);
_835.initialize(Element.getElementBySelector(this.element,"#feature_window_booth"));
_835=new MapBuzz.UI.CloseButtonPanel("buttonPanel",this);
_835.initialize(Element.getElementBySelector(this.element,".buttons"));
},onResize:function(_838,_839){
var _83a=this.getPanel("content");
_83a.onResize(_838,_839);
},getTemplate:function(){
if(!this.constructor.template){
var _83b="<div>"+"  <table class=\"title feature_title\">"+"    <tr>"+"      <td class=\"icon\">"+"        <div id=\"feature_window_icon_container\" class=\"icon_container\">"+"          <img id=\"feature_window_icon\" alt=\"Feature Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"        </div>"+"      </td>"+"      <td class=\"title\">"+"        <h2 id=\"feature_window_title\"></h2>"+"        <h3 id=\"feature_window_booth\"></h3>"+"      </td>"+"    </tr>"+"  </table>"+"  <div id=\"feature_window_content\" class=\"article\">"+"  </div>"+"  <div class=\"buttons\">"+"    <button class=\"close_button\" type=\"button\">Close</button>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_83b);
}
return this.constructor.template;
}});
MapBuzz.UI.ToolTipEventPanel=function ToolTipEventPanel(_83c){
this.callSuper(arguments.callee,"Tooltip",_83c);
};
MapBuzz.UI.ToolTipEventPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.ToolTipEventPanel.prototype,{createPanels:function(){
var _83d=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_83d.initialize(Element.getElementBySelector(this.element,".tooltip_icon"));
_83d=new MapBuzz.UI.PrimitiveToElement("title",this.model,this,null,"setTitle");
_83d.initialize(Element.getElementBySelector(this.element,".tooltip_title"));
},getTemplate:function(){
if(!this.constructor.template){
var _83e="<div class=\"tooltip\" style=\"display: none\">"+"  <div class=\"item\">"+"    <div class=\"icon\">"+"      <img class=\"tooltip_icon\" alt=\"Feature Icon\" class=\"icon_image\" src=\"/images/blank.gif\" />"+"    </div>"+"    <h2 class=\"tooltip_title\"></h2>"+"    <p><strong>Click</strong> to learn more about this feature.</p>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_83e);
}
return this.constructor.template;
}});
MapBuzz.UI.ToolButton=function ToolButton(_83f,_840){
this.callSuper(arguments.callee,null,_840);
this.initialize($(_83f));
this.element.src=this.action.getImage().src;
};
MapBuzz.UI.ToolButton.inherits(MapBuzz.UI.ActionPanel);
Object.extend(MapBuzz.UI.ToolButton.prototype,{onMouseOver:function(_841){
this.showToolTip();
if(this.action.enabled){
this.element.src=this.action.images.getHoverImage().src;
}
this.applySuper(arguments);
},onMouseOut:function(_842){
this.hideToolTip();
if(this.action.enabled){
this.element.src=this.action.getImage().src;
}
this.applySuper(arguments);
},enable:function(){
this.element.src=this.action.getImage().src;
this.applySuper(arguments);
},disable:function(){
this.element.src=this.action.getImage().src;
this.applySuper(arguments);
},activate:function(){
this.element.src=this.action.getImage().src;
this.applySuper(arguments);
},deactivate:function(){
this.element.src=this.action.getImage().src;
this.applySuper(arguments);
},showToolTip:function(){
var _843=Position.cumulativeOffset(this.element);
var _844=Element.getDimensions(this.element);
var docX=_843[0]+_844.width;
var docY=_843[1]+_844.height;
var _847=MapBuzz.ToolTip.instance;
_847.showAt(docX,docY);
_847.setContent(this.action.getToolTipContent());
},hideToolTip:function(_848){
MapBuzz.ToolTip.instance.hide();
}});
MapBuzz.UI.ToolTipExhibitorPanel=function ToolTipExhibitorPanel(_849){
this.callSuper(arguments.callee,"Tooltip",_849);
};
MapBuzz.UI.ToolTipExhibitorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.ToolTipExhibitorPanel.prototype,{createPanels:function(){
panel=new MapBuzz.UI.PrimitiveToElement("title",this.model,this,this.model.getToolTipText);
panel.initialize(Element.getElementBySelector(this.element,".tooltip_title"));
},getTemplate:function(){
if(!this.constructor.template){
var _84a="<div class=\"tooltip\" style=\"display: none\">"+"  <div class=\"item\">"+"    <h2 class=\"tooltip_title\"></h2>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_84a);
}
return this.constructor.template;
}});
MapBuzz.UI.TabsPanel=function TabsPanel(name,_84c){
this.callSuper(MapBuzz.UI.TabsPanel,name,_84c);
MapBuzz.UI.TabsPanel.instances[this.name]=this;
this.cookieStorage=new CookieStorage();
this.current=null;
};
Function.inherits(MapBuzz.UI.TabsPanel,MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.TabsPanel,{SELECTED_TAB_CLASS:"selected",UNSELECTED_TAB_CLASS:"",BEFORE_LOAD_TAB:"BEFORE_LOAD_TAB",AFTER_LOAD_TAB:"AFTER_LOAD_TAB"});
Object.extend(MapBuzz.UI.TabsPanel,{instances:new HashTable(),LoadTabsFromJson:function(_84d){
var tabs=new MapBuzz.UI.TabsPanel(_84d.id);
for(var i=0;i<_84d.tabs.length;i++){
var _850=_84d.tabs[i];
var uri=_850.uri;
var _852=null;
if(uri){
_852=new MapBuzz.Resource.Remote(_850.uri);
}else{
_852=new MapBuzz.Resource.Local("#tab",_850.content);
}
var tab=new MapBuzz.UI.TabPanel(_850.id,tabs,_850.title,_852);
if(_850.current){
tabs.current=tab;
}
}
tabs.initialize();
return tabs;
}});
Object.extend(MapBuzz.UI.TabsPanel.prototype,{initialize:function(_854){
_854=_854||document.getElementById(this.name+"_tabs");
this.callSuper(this.initialize,_854);
this.setupEvents();
this.setCurrent(this.current||this.panels[0]);
this.current.initialize();
},release:function(){
if(this.current){
this.current.release();
}
this.panels.length=0;
this.releaseEvents();
this.element=null;
},setupEvents:function(){
this.clickHandler=this.onClick.bindAsEventListener(this);
Event.observe(this.element,"click",this.clickHandler);
},releaseEvents:function(){
Event.stopObserving(this.element,"click",this.clickHandler);
this.clickHandler=null;
},onClick:function(_855){
var _856=this.figureTab(_855);
if(!_856){
return true;
}
Event.stop(_855);
var _857=_856.getTabClass();
if(_857!=MapBuzz.UI.TabsPanel.SELECTED_TAB_CLASS){
this.changeTabsCommand(_856).execute();
}
return false;
},figureTab:function(_858){
var _859=Event.element(_858);
if(!_859.nodeName.match(/a/i)){
return null;
}
return this.getPanel(_859.id);
},getTabByName:function(name){
for(var i=0;i<this.panels.length;i++){
var tab=this.panels[i];
if(tab.name==name){
return tab;
}
}
return null;
},getTabByTitle:function(_85d){
for(var i=0;i<this.panels.length;i++){
var tab=this.panels[i];
if(tab.title==_85d){
return tab;
}
}
return null;
},getContentId:function(){
return (this.name+"_tab_content");
},getContentElement:function(){
return $(this.getContentId());
},getTabsElement:function(){
return Element.getElementBySelector(this.element,"ul.tabs");
},appendTab:function insertTab(tab){
var _861=Element.create("li");
var _862=Element.create("a");
_862.href="#";
_862.id=tab.name.escapeHTML();
_862.title=tab.title.escapeHTML();
_862.innerHTML=tab.title.escapeHTML();
_861.appendChild(_862);
this.getTabsElement().appendChild(_861);
},setCurrent:function(tab){
if(this.current){
this.current.setTabClass(MapBuzz.UI.TabsPanel.UNSELECTED_TAB_CLASS);
}
this.current=tab;
this.current.setTabClass(MapBuzz.UI.TabsPanel.SELECTED_TAB_CLASS);
var _864=this.name+"_tabs";
this.cookieStorage.write(_864,tab.name);
},getTemplate:function(){
if(!this.constructor.template){
var _865="<div id=\"<%= this.panel.name %>_tabs\">           <ul class=\"tabs\">             <% for (var i=0; i<this.panel.panels.length; i++) { %>                <% var tab = this.panel.panels[i] %>                <li class=\"<%= tab.figureTabClass() %>\"><a href=\"#\" id=\"<%= tab.name.escapeHTML() %>\"><%= tab.title.escapeHTML() %></a></li>             <% } %>           </ul>           <div id=\"<%= this.panel.getContentId() %>\" class=\"tab_content\">             <%= this.panel.current.contentCommand().execute(); %>           </div>         </div>";
this.constructor.template=new MapBuzz.Template.Template(_865);
}
return this.constructor.template;
},setCurrentCommand:function(_866){
var _867=new MapBuzz.Command.Functor("Set Current Tab",{execute:this.setCurrent.bind(this,_866),fail:this.setCurrent.bind(this,_866)});
return _867;
},changeTabsCommand:function(_868){
var _869=null;
if(this.current){
_869=this.current.releaseCommand();
}else{
_869=new MapBuzz.Command.Empty();
}
return new MapBuzz.Command.Chain("Change Tab",new MapBuzz.Command.Databus(MapBuzz.UI.TabsPanel.BEFORE_LOAD_TAB,{tab:_868}),new MapBuzz.Command.Message("Loading",MapBuzz.Message.PROCESSING),_869,_868.contentCommand(),new MapBuzz.Command.UpdateElement(this.getContentElement()),_868.initializeCommand(),this.setCurrentCommand(_868),new MapBuzz.Command.Databus(MapBuzz.Message.CLEAR_MESSAGE,{level:MapBuzz.Message.PROCESSING}),new MapBuzz.Command.Databus(MapBuzz.UI.TabsPanel.AFTER_LOAD_TAB,{tab:_868}));
},onStartResize:function(_86a,_86b){
this.current.onStartResize(_86a,_86b);
},onResize:function(_86c,_86d){
this.current.onResize(_86c,_86d);
},onEndResize:function(_86e,_86f){
this.current.onEndResize(_86e,_86f);
}});
MapBuzz.UI.TabPanel=function TabPanel(name,_871,_872,_873){
this.callSuper(MapBuzz.UI.TabPanel,name,_871);
this.title=_872;
this.resource=_873;
};
Function.inherits(MapBuzz.UI.TabPanel,MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.TabPanel.prototype,{initialize:function(){
var _874=this.parent.getContentElement();
this.callSuper(this.initialize,_874);
if(this.panels.length==1){
return this.panels[0].initialize(_874);
}
},getIndex:function(){
for(var i=0;i<this.parent.panels.length;i++){
var _876=this.parent.panels[i];
if(_876===this){
return i;
}
}
return -1;
},getTabElement:function(){
var _877=$(this.name);
if(_877){
return _877.parentNode;
}
},figureTabClass:function getTabClass(){
var _878=this.getIndex();
if(_878==0){
return MapBuzz.UI.TabsPanel.SELECTED_TAB_CLASS;
}else{
if(_878==this.parent.panels.length-1){
return "last-child";
}else{
return "";
}
}
},getTabClass:function(){
var _879=this.getTabElement();
if(_879){
return _879.className;
}
},setTabClass:function(_87a){
var _87b=this.getTabElement();
if(_87b){
_87b.className=_87a;
}
},activate:function(){
this.parent.changeTabsCommand(this).execute();
},contentCommand:function(){
if(this.resource){
return this.resource.getCommand();
}else{
if(this.panels.length==1){
return this.panels[0].contentCommand().copy();
}else{
new Error("Tab does not provide a content command. Tab: "+this.name+".");
}
}
return null;
},initializeCommand:function(){
var _87c=new MapBuzz.Command.Empty();
if(this.panels.length==1){
_87c=this.panels[0].initializeCommand().copy();
}
return _87c;
},releaseCommand:function(){
var _87d=new MapBuzz.Command.Empty();
if(this.panels.length==1){
_87d=this.panels[0].releaseCommand().copy();
}
return _87d;
},onStartResize:function(_87e,_87f){
this.panels[0].onStartResize(_87e,_87f);
},onResize:function(_880,_881){
this.panels[0].onResize(_880,_881);
},onEndResize:function(_882,_883){
this.panels[0].onEndResize(_882,_883);
}});
MapBuzz.UI.LocationPanel=function LocationPanel(_884){
this.callSuper(arguments.callee,"Location",_884);
};
MapBuzz.UI.LocationPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.LocationPanel.prototype,{createPanels:function(){
var _885=new MapBuzz.UI.PrimitiveToElement("title",this.model,this,null,"setTitle");
_885.initialize(Element.getElementBySelector(this.element,"#location_window_title"));
_885=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_885.initialize(Element.getElementBySelector(this.element,"#location_window_icon"));
_885=new MapBuzz.UI.AddButtonPanel("buttonPanel",this);
_885.initialize(Element.getElementBySelector(this.element,".buttons"));
},createModel:function(geom){
var _887=this.model.dataSource.dataSources.getActive();
var _888=_887.factory.create();
var _889=_888.figures.create(geom);
_888.figures.display();
_888.figures.select();
this.shape=_889.shapes[0];
return _888;
},isInsertable:function(){
var _88a=this.model.dataSource.dataSources.getActive();
if(_88a&&_88a.resource.isInsertable()){
return true;
}else{
return false;
}
},addCommand:function(){
var _88b=new MapBuzz.Command.Functor("Add to Map",{execute:function(){
var map=this.model.dataSource.dataSources.map;
var _88d=map.toolManager;
var geom=this.model.figures.values[0].geom;
var _88f=this.model;
this.model=this.createModel(geom);
this.model.content=_88f.title.escapeHTML();
_88f.release();
this.closeCommand().execute();
var tool=new MapBuzz.Tool.FeatureEditorTool(_88d,this.shape,geom);
_88d.pushTool(tool);
}.bind(this)});
return _88b;
},getTemplate:function(){
if(!this.constructor.template){
var _891="<div>"+"  <table class=\"title location_title\">"+"    <tr>"+"      <td class=\"icon\">"+"        <div class=\"icon\">"+"          <img id=\"location_window_icon\" alt=\"Location Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"        </div>"+"      </td>"+"      <td class=\"title\">"+"        <h2 id=\"location_window_title\"></h2>"+"      </td>"+"    </tr>"+"  </table>"+"  <div class=\"buttons\">"+"<% if (this.panel.isInsertable()) { %>"+"<button class=\"add_button\" type=\"button\">Add to Map</button>"+"<% } %>"+"<button class=\"close_button\" type=\"button\">Close</button>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_891);
}
return this.constructor.template;
}});
MapBuzz.UI.LocationToolTipPanel=function LocationToolTipPanel(_892){
this.callSuper(arguments.callee,"Tooltip",_892);
};
MapBuzz.UI.LocationToolTipPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.LocationToolTipPanel.prototype,{createPanels:function(){
var _893=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_893.initialize(Element.getElementBySelector(this.element,".tooltip_icon"));
_893=new MapBuzz.UI.PrimitiveToElement("title",this.model,this,null,"setTitle");
_893.initialize(Element.getElementBySelector(this.element,".tooltip_title"));
_893=new MapBuzz.UI.PersonToLink("author",this.model,this);
_893.initialize(Element.getElementBySelector(this.element,".tooltip_creator"));
},getTemplate:function(){
if(!this.constructor.template){
var _894="<div class=\"tooltip\">"+"  <div class=\"item\">"+"    <div class=\"icon\">"+"      <img class=\"tooltip_icon\" alt=\"Feature Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"    </div>"+"    <h2 class=\"tooltip_title\"></h2>"+"    <span>By <a class=\"tooltip_creator\" class=\"user_link\" href=\"#\"></a></span>"+"    <p><strong>Click</strong> to learn more about this location.</p>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_894);
}
return this.constructor.template;
}});
MapBuzz.UI.EventEditorPanel=function EventEditorPanel(_895,_896){
this.callSuper(arguments.callee,"Edit",_895,_896);
};
MapBuzz.UI.EventEditorPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.EventEditorPanel.prototype,{createPanels:function(){
var _897=new MapBuzz.UI.ContentToEditor("content",this.model,this);
_897.initialize(Element.getElementBySelector(this.element,"#event_window_content"));
_897=new MapBuzz.UI.IconAlbumToChooser("iconAlbum",this.model,this,null,null,MapBuzz.Media.InPlaceIconChooser);
_897.initialize(Element.getElementBySelector(this.element,"#event_window_icon_container"));
_897=new MapBuzz.UI.PrimitiveToInput("title",this.model,this,null,"setTitle");
_897.initialize(Element.getElementBySelector(this.element,"#event_window_title"));
_897=new MapBuzz.UI.CategoriesToInput("tags",this.model,this,"getTags","setTags");
_897.initialize(Element.getElementBySelector(this.element,"#event_window_categories"));
_897=new MapBuzz.UI.TimeToInput("start",this.model,this);
_897.initialize(Element.getElementBySelector(this.element,"#event_window_start_time"));
_897=new MapBuzz.UI.TimeToInput("end",this.model,this);
_897.initialize(Element.getElementBySelector(this.element,"#event_window_end_time"));
_897=new MapBuzz.UI.UpdateButtonPanel("buttonPanel",this);
_897.initialize(Element.getElementBySelector(this.element,".buttons"));
},updateCommand:function(){
return MapBuzz.Command.Build(this.saveCommand(),this.resetCommand(),this.model.updateCommand(),this.validateCommand(),this.closeCommand());
},removeCommand:function(){
return MapBuzz.Command.Build(this.model.removeCommand(),this.closeCommand());
},onResize:function(_898,_899){
var _89a=this.getPanel("content");
_89a.onResize(_898,_899);
},getTemplate:function(){
if(!this.constructor.template){
var _89b="<form id=\"event_editor_form\" class=\"one_column no_fieldset\" "+"method=\"post\" action=\"<%= this.model.resource.uri %>\" "+"onsubmit=\"return false;\">"+"  <fieldset id=\"form_content\">"+"    <table class=\"title event_title\">"+"      <tr>"+"        <td class=\"icon\">"+"          <div id=\"event_window_icon_container\" class=\"icon_container\">"+"            <img id=\"event_window_icon\" alt=\"Event Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"          </div>"+"        </td>"+"        <td class=\"title\">"+"          <label for=\"event_window_title\">Name:</label>"+"          <input id=\"event_window_title\" type=\"text\" name=\"Event[name]\" value=\"\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div class=\"tags\">"+"      <label for=\"event_window_categories\" class=\"tag_label\">"+"        <img class=\"tag_icon\" src=\"/images/tag_icon.gif\" alt=\"Tags Icon\"/>Tags: "+"        <input id=\"event_window_categories\" type=\"text\" />"+"      </label>"+"    </div>"+"    <table class=\"when\">"+"      <tr>"+"        <td class=\"label\">"+"           <label for=\"event_window_start_time\">Start: </label>"+"        </td>"+"        <td>"+"           <input type=\"text\" id=\"event_window_start_time\" />"+"        </td>"+"      </tr>"+"      <tr>"+"        <td class=\"label\">"+"           <label for=\"event_window_end_time\" >End: </label>"+"        </td>"+"        <td>"+"          <input type=\"text\" id=\"event_window_end_time\" />"+"        </td>"+"      </tr>"+"    </table>"+"    <div id=\"event_window_content\" class=\"article\">"+"    </div>"+"    <div class=\"buttons\">"+"      <button class=\"update_button\" type=\"button\">Update</button>"+"      <button class=\"cancel_button\" type=\"button\">Cancel</button>"+"    </div>"+"  </fieldset>"+"</form>";
this.constructor.template=new MapBuzz.Template.Template(_89b);
}
return this.constructor.template;
}});
MapBuzz.UI.FeatureViewerPanel=function FeatureViewerPanel(_89c,_89d){
this.callSuper(arguments.callee,"View",_89c,_89d);
};
MapBuzz.UI.FeatureViewerPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.FeatureViewerPanel.prototype,{createPanels:function(){
var _89e=new MapBuzz.UI.ContentToDiv("content",this.model,this);
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_content"));
_89e=new MapBuzz.UI.RepliesToLink("replies",this.model,this);
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_replies"));
_89e=new MapBuzz.UI.PersonToLink("author",this.model,this);
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_creator"));
if(!this.model.isReadOnly()){
_89e=new MapBuzz.UI.IconAlbumToChooser("iconAlbum",this.model,this,null,null,MapBuzz.Media.IconChooser);
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_icon_container"));
_89e=new MapBuzz.UI.PrimitiveToInplaceEditor("title",this.model,this,null,this.model.setTitle.bind(this.model));
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_title"));
}else{
_89e=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_icon"));
_89e=new MapBuzz.UI.PrimitiveToElement("title",this.model,this);
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_title"));
}
_89e=new MapBuzz.UI.ImagesToCarousel("images",this.model,this);
_89e.initialize(Element.getElementBySelector(this.element,"#image_carousel"));
_89e=new MapBuzz.UI.CategoriesToLinks("tags",this.model,this,"getTags","setTags");
_89e.initialize(Element.getElementBySelector(this.element,"#feature_window_categories"));
if(!MapBuzz.user.isAuthenticated()){
_89e=new MapBuzz.UI.RankViewerPanel("ranks",this.model.ranks,this);
_89e.initialize(Element.getElementBySelector(this.element,"table.summary"));
}else{
_89e=new MapBuzz.UI.RankEditorPanel("ranks",this.model.ranks,this);
_89e.initialize(Element.getElementBySelector(this.element,"table.summary"));
}
_89e=new MapBuzz.UI.CloseButtonPanel("buttonPanel",this);
_89e.initialize(Element.getElementBySelector(this.element,".buttons"));
},onResize:function(_89f,_8a0){
var _8a1=this.getPanel("content");
_8a1.onResize(_89f,_8a0);
},getTemplate:function(){
if(!this.constructor.template){
var _8a2="<div>"+"  <table class=\"title feature_title\">"+"    <tr>"+"      <td class=\"icon\">"+"        <div id=\"feature_window_icon_container\" class=\"icon_container\">"+"          <img id=\"feature_window_icon\" alt=\"Feature Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>"+"        </div>"+"      </td>"+"      <td class=\"title\">"+"        <h2 id=\"feature_window_title\"></h2>"+"        <span class=\"user_link\">By <a id=\"feature_window_creator\" class=\"user_link\" href=\"#\"></a></span>"+"      </td>"+"    </tr>"+"  </table>"+"  <div class=\"tags\">"+"    <img class=\"tag_icon\" src=\"/images/tag_icon.gif\" alt=\"Tags Icon\"/>"+"    <span class=\"tag_label\">Tags:</span>"+"    <span id=\"feature_window_categories\" class=\"tag_links\"></span>"+"  </div>"+"  <table class=\"summary\">"+"    <tr>"+"      <% if (MapBuzz.user.isAuthenticated()) { %>"+"      <th>My Rating</th>"+"      <% } %>"+"      <th>Rating</th>"+"      <th>Buzzes</th>"+"      <th class=\"last-child\">Comments</th>"+"    </tr>"+"    <tr>"+"      <% if (MapBuzz.user.isAuthenticated()) { %>"+"      <td>"+"        <a class=\"remove_rank delete_link\" href=\"#\" title=\"Delete rating\">x</a>"+"        <img class=\"user_rank\" alt=\"User Feature Rank\" src=\"/images/blank.gif\" />"+"      </td>"+"      <% } %>"+"      <td>"+"        <img class=\"rank\" alt=\"Feature Rank\" src=\"/images/blank.gif\" />"+"      </td>"+"      <td>"+"        <span class=\"buzzes\" />"+"      </td>"+"      <td class=\"count last-child\">"+"        <img id=\"feature_window_discussion\" class=\"discussion_icon\" src=\"/images/discussion_icon_small.gif\" alt=\"replies\" /><a id=\"feature_window_replies\" href=\"#\">0</a>"+"      </td>"+"    </tr>"+"  </table>"+"  <div id=\"feature_window_content\" class=\"article\">"+"  </div>"+"  <div id=\"image_carousel\">"+"    <h3>Photos<span> (Loading)</span>:</h3>"+"    <span class=\"images\"></span>"+"  </div>"+"  <div class=\"buttons\">"+"    <button class=\"close_button\" type=\"button\">Close</button>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_8a2);
}
return this.constructor.template;
}});
MapBuzz.UI.DirectionsPanel=function DirectionsPanel(_8a3,_8a4){
this.callSuper(arguments.callee,"Directions",_8a3,_8a4);
};
MapBuzz.UI.DirectionsPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.DirectionsPanel.prototype,{getTemplate:function(){
if(!this.constructor.template){
var _8a5="<div>           <table id=\"directions\" class=\"directions\">             <tr>               <td></td>               <td></td>               <td class=\"results\"><a href=\"/map/directions?to=<%= this.model.to.escapeHTML()%>&amp;from=<%= this.model.from.escapeHTML()%>\"><img alt=\"Print\" src=\"/images/printer.png\" /> Print</a></td>             </tr>             <% for (var i=0; i<this.model.directions.getNumRoutes(); i++) { %>               <% var route = this.model.directions.getRoute(i); %>               <% for (var j=0; j<route.getNumSteps(); j++) { %>                 <tr>                   <% var step = route.getStep(j); %>                   <td><%= (i + j + 1); %>.</td>                   <td><%= step.getDescriptionHtml(); %></td>                   <td class=\"results\"><%= step.getDistance().html.replace(/&nbsp;/, \" \"); %><br />(<%= step.getDuration().html.replace(/&nbsp;/, \" \"); %>)</td>                 </tr>               <% } %>             <% } %>             <tr>               <td colspan=\"2\">Total:</td>               <td class=\"results\"><%= this.model.directions.getDistance().html.replace(/&nbsp;/, \" \"); %><br />(<%= this.model.directions.getDuration().html.replace(/&nbsp;/, \" \"); %>)</td>             </tr>           </table>           <div>             <a href=\"/map/directions\" title=\"Print\">Print</a>           </div>         </div>";
this.constructor.template=new MapBuzz.Template.Template(_8a5);
}
return this.constructor.template;
}});
MapBuzz.UI.FontToSelect=function FontToSelect(name,_8a7,_8a8,_8a9,_8aa){
this.applySuper(arguments);
};
MapBuzz.UI.FontToSelect.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.FontToSelect.prototype,{initialize:function(_8ab){
this.applySuper(arguments);
this.setupElement();
this.update();
this.changeEventHandler=this.onChange.bindAsEventListener(this);
Event.observe(this.element,"change",this.changeEventHandler);
},release:function(){
Event.stopObserving(this.element,"change",this.changeEventHandler);
this.changeEventHandler=null;
this.applySuper(arguments);
},setupElement:function(){
var _8ac=[["Cursive","\"Comic Sans\",\"Comic Sans MS\",cursive"],["Sans Serif","Verdana,Tahoma,Geneva,sans-serif"],["Serif","Georgia,\"Times New Roman\",Times,serif"],["Monospace","\"Courier New\",Courier,monospace"]];
for(var i=0;i<_8ac.length;i++){
var _8ae=_8ac[i][0];
var _8af=_8ac[i][1];
var _8b0=Element.create("option");
_8b0.value=_8af;
_8b0.innerHTML=_8ae;
this.element.appendChild(_8b0);
}
},onChange:function(_8b1){
this.save();
},update:function(){
var _8b2=this.getProperty();
for(var i=0;i<this.element.options.length;i++){
var _8b4=this.element.options[i];
if(_8b4.value==_8b2){
_8b4.selected=true;
break;
}
}
},save:function(){
var _8b5=this.element.options[this.element.selectedIndex];
var _8b6=_8b5.value;
this.setProperty(_8b6);
}});
MapBuzz.UI.FontSizeToSelect=function FontSizeToSelect(name,_8b8,_8b9,_8ba,_8bb){
this.applySuper(arguments);
};
MapBuzz.UI.FontSizeToSelect.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.FontSizeToSelect.prototype,{initialize:function(_8bc){
this.applySuper(arguments);
this.setupElement();
this.update();
this.changeEventHandler=this.onChange.bindAsEventListener(this);
Event.observe(this.element,"change",this.changeEventHandler);
},release:function(){
Event.stopObserving(this.element,"change",this.changeEventHandler);
this.changeEventHandler=null;
this.applySuper(arguments);
},setupElement:function(){
var _8bd=["8","10","12","14","18","24","36","48"];
for(var i=0;i<_8bd.length;i++){
var _8bf=_8bd[i];
var size=_8bf+"pt";
var _8c1=Element.create("option");
_8c1.innerHTML=_8bf;
_8c1.value=size;
this.element.appendChild(_8c1);
}
},onChange:function(_8c2){
this.save();
},update:function(){
var _8c3=this.getProperty();
for(var i=0;i<this.element.options.length;i++){
var _8c5=this.element.options[i];
if(_8c5.value==_8c3){
_8c5.selected=true;
break;
}
}
},save:function(){
var _8c6=this.element.options[this.element.selectedIndex];
var _8c7=_8c6.value;
this.setProperty(_8c7);
}});
MapBuzz.UI.ColorToSelect=function ColorToSelect(name,_8c9,_8ca,_8cb,_8cc){
this.applySuper(arguments);
};
MapBuzz.UI.ColorToSelect.inherits(MapBuzz.UI.AbstractPropertyPanel);
Object.extend(MapBuzz.UI.ColorToSelect.prototype,{initialize:function(_8cd){
this.applySuper(arguments);
this.setupElement();
this.update();
this.changeEventHandler=this.onChange.bindAsEventListener(this);
Event.observe(this.element,"change",this.changeEventHandler);
},release:function(){
Event.stopObserving(this.element,"change",this.changeEventHandler);
this.changeEventHandler=null;
this.applySuper(arguments);
},setupElement:function(){
var _8ce=["#E34B32","#FF962B","#EDDA49","#ADD952","#5D93B1","#85C2D6","#B46E90","#FF9CBF","#666666","#000000"];
var _8cf=document.getElementById("note_color");
for(var i=0;i<_8ce.length;i++){
var _8d1=_8ce[i];
var _8d2=Element.create("option");
_8d2.innerHTML=" ";
_8d2.value=_8d1;
_8d2.style.backgroundColor=_8d1;
this.element.appendChild(_8d2);
}
},onChange:function(_8d3){
this.save();
},update:function(){
var _8d4=this.getProperty();
this.element.style.backgroundColor=_8d4;
for(var i=0;i<this.element.options.length;i++){
var _8d6=this.element.options[i];
if(_8d6.value==_8d4){
_8d6.selected=true;
break;
}
}
},save:function(){
var _8d7=this.element.options[this.element.selectedIndex];
var _8d8=_8d7.value;
this.element.style.backgroundColor=_8d8;
this.setProperty(_8d8);
}});
MapBuzz.UI.FontPanel=function FontPanel(name,_8da,_8db){
this.applySuper(arguments);
};
MapBuzz.UI.FontPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.FontPanel.prototype,{createPanels:function(){
var _8dc=this.model.figures.values[0].styles.normal();
var _8dd=new MapBuzz.UI.FontToSelect("fontFamily",_8dc,this);
_8dd.initialize(Element.getElementBySelector(this.element,".font_family"));
_8dd=new MapBuzz.UI.FontSizeToSelect("fontSize",_8dc,this);
_8dd.initialize(Element.getElementBySelector(this.element,".font_size"));
_8dd=new MapBuzz.UI.ColorToSelect("color",_8dc,this);
_8dd.initialize(Element.getElementBySelector(this.element,".color"));
},isModel:function(_8de){
if(this.model===_8de){
return true;
}else{
if(this.model.figures.values[0].styles.normal()===_8de){
return true;
}else{
return false;
}
}
},onPropertyChange:function(_8df,_8e0,_8e1){
if(_8df.parent==this){
MapBuzz.databus.send(this,MapBuzz.UI.PROPERTY_CHANGE,{model:this.model,oldValue:_8e1,newValue:_8e0});
}
}});
MapBuzz.UI.BoothSelectPanel=function BoothSelectPanel(_8e2,_8e3){
this.callSuper(arguments.callee,"Edit",_8e2,_8e3);
};
MapBuzz.UI.BoothSelectPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.BoothSelectPanel.prototype,{updateCommand:function(){
return MapBuzz.Command.Build(this.saveCommand(),this.resetCommand(),this.model.updateCommand(),this.validateCommand(),this.closeCommand());
},removeCommand:function(){
return MapBuzz.Command.Build(this.model.removeCommand(),this.closeCommand());
},createPanels:function(){
panel=new MapBuzz.UI.PrimitiveToElement("title",this.model,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_title"));
var _8e4=this.model.product;
panel=new MapBuzz.UI.PrimitiveToElement("name",_8e4,this);
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_product_name"));
panel=new MapBuzz.UI.PrimitiveToElement("dependencies",_8e4,this,function(){
return "";
});
panel.initialize(Element.getElementBySelector(this.element,"#booth_window_dependencies"));
panel=new MapBuzz.UI.UpdateButtonPanel("buttonPanel",this);
panel.initialize(Element.getElementBySelector(this.element,".buttons"));
},onResize:function(_8e5,_8e6){
var _8e7=this.getPanel("content");
_8e7.onResize(_8e5,_8e6);
},getTemplate:function(){
if(!this.constructor.template){
var _8e8="<div>"+"  <div class=\"booth_window_product\">"+"    <p id=\"booth_window_product_name\"></p>"+"  </div>"+"  <h2 id=\"booth_window_title\"></h2>"+"  <div id=\"booth_window_dependencies\">"+"  </div>"+"  <div class=\"buttons\">"+"    <button class=\"update_button\" type=\"button\">Select Booth</button>"+"    <button class=\"cancel_button\" type=\"button\">Close</button>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_8e8);
}
return this.constructor.template;
}});
MapBuzz.UI.ToolTipBoothPanel=function ToolTipBoothPanel(_8e9){
this.callSuper(arguments.callee,"Tooltip",_8e9);
};
MapBuzz.UI.ToolTipBoothPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.ToolTipBoothPanel.prototype,{createPanels:function(){
if(this.model.product.available){
panel=new MapBuzz.UI.PrimitiveToElement("title",this.model,this);
}else{
panel=new MapBuzz.UI.PrimitiveToElement("name",this.model.product.exhibitor,this);
}
panel.initialize(Element.getElementBySelector(this.element,".tooltip_title"));
},getTemplate:function(){
if(!this.constructor.template){
var _8ea="<div class=\"tooltip\" style=\"display: none\">"+"  <div class=\"item\">"+"    <h2 class=\"tooltip_title\"></h2>"+"  </div>"+"</div>";
this.constructor.template=new MapBuzz.Template.Template(_8ea);
}
return this.constructor.template;
}});
MapBuzz.UI.EventViewerPanel=function EventViewerPanel(_8eb,_8ec){
this.callSuper(arguments.callee,"View",_8eb,_8ec);
};
MapBuzz.UI.EventViewerPanel.inherits(MapBuzz.UI.ModelPanel);
Object.extend(MapBuzz.UI.EventViewerPanel.prototype,{createPanels:function(){
var _8ed=new MapBuzz.UI.ContentToDiv("content",this.model,this);
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_content"));
if(!this.model.isReadOnly()){
_8ed=new MapBuzz.UI.IconAlbumToChooser("iconAlbum",this.model,this,null,null,MapBuzz.Media.IconChooser);
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_icon_container"));
_8ed=new MapBuzz.UI.PrimitiveToInplaceEditor("title",this.model,this,null,this.model.setTitle.bind(this.model));
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_title"));
}else{
_8ed=new MapBuzz.UI.IconAlbumToImage("iconAlbum",this.model,this);
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_icon"));
_8ed=new MapBuzz.UI.PrimitiveToElement("title",this.model,this);
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_title"));
}
_8ed=new MapBuzz.UI.TimeToElement("start",this.model,this);
_8ed.format="%a, %b %d, %Y";
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_date"));
_8ed=new MapBuzz.UI.TimeToElement("start",this.model,this);
_8ed.format="%I:%M %p";
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_time"));
_8ed=new MapBuzz.UI.CloseButtonPanel("buttonPanel",this);
_8ed.initialize(Element.getElementBySelector(this.element,".buttons"));
_8ed=new MapBuzz.UI.LinkToLink("venue",this.model,this,MapBuzz.Atom.Links.ALTERNATE);
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_rel_link"));
if(this.model.venue){
_8ed=new MapBuzz.UI.LinkToLink("venue",this.model.venue,this,MapBuzz.Atom.Links.VENUE);
_8ed.initialize(Element.getElementBySelector(this.element,"#event_window_venue_link"));
}
},onResize:function(_8ee,_8ef){
var _8f0=this.getPanel("content");
_8f0.onResize(_8ee,_8ef);
},getTemplate:function(){
if(!this.constructor.template){
var _8f1="<div class=\"event\">           <table class=\"title event_title\">             <tr>               <td class=\"icon\">                 <div id=\"event_window_icon_container\" class=\"icon_container\">                   <img id=\"event_window_icon\" alt=\"Event Icon\" class=\"icon_image\" src=\"/images/blank.gif\"/>                 </div>               </td>               <td class=\"title\">                 <h2 id=\"event_window_title\"></h2>               </td>             </tr>           </table>           <div class=\"event_info\">             <div class=\"event_details\">               <div class=\"event_when\">                 <h4>When</h4>                 <p><span id=\"event_window_date\"></span></p>                 <p>at <span id=\"event_window_time\"></span></p>               </div>               <div class=\"event_where\">                 <h4>Where</h4>                 <p><a id=\"event_window_venue_link\"></a></p>               </div>             </div>             <div>               <h4>Description</h4>               <div id=\"event_window_content\" class=\"article\"></div>             </div>             <div class=\"more\">                <p><a id=\"event_window_rel_link\">More Information</a></p>             </div>             <div class=\"buttons\">               <button class=\"close_button\" type=\"button\">Close</button>             </div>           </div>         </div>";
this.constructor.template=new MapBuzz.Template.Template(_8f1);
}
return this.constructor.template;
}});
MapBuzz.UI.EventSidebarPanel=function EventSidebarPanel(_8f2,_8f3){
this.models=_8f2;
this.callSuper(arguments.callee,"EventSidebar",_8f3);
};
MapBuzz.UI.EventSidebarPanel.inherits(MapBuzz.UI.AbstractPanel);
Object.extend(MapBuzz.UI.EventSidebarPanel.prototype,{createPanels:function(){
},content:function(){
var _8f4=this.getTemplate();
return _8f4.run({panel:this,models:this.models});
},getTemplate:function(){
if(!this.constructor.template){
var _8f5="<% if (this.models.length == 0) return; %>         <% var dataSource = this.models[0].dataSource; %>         <div id=\"<%= dataSource.resource.uri %>_events_sidebar\">           <% for(var i=0; i<this.models.length; i++) { %>             <% model = this.models[i];               var iconGroup = model.iconAlbum.defaultGroup();               if (!iconGroup)                 iconGroup = model.dataSource.defaultIcons[model.constructor.TYPE_CATEGORY];               var icon = iconGroup.get(MapBuzz.Media.ImageType.MEDIUM); %>             <% if (model.constructor.TYPE_CATEGORY != MapBuzz.Feature.Event.TYPE_CATEGORY) continue %>             <div class=\"item\">               <div class=\"icon_container\">                 <a href=\"<%= model.alternateResource.uri.escapeHTML() %>\">                   <img width=\"64\" height=\"64\" alt=\"Event\" class=\"icon_image\" src=\"<%= icon.resource.uri.escapeHTML() %>\"/>                 </a>               </div>               <p class=\"info\">                 <h2>                    <a href=\"<%= model.alternateResource.uri.escapeHTML() %>\">                      <%= model.title.escapeHTML() %>                    </a>                  </h2>                 <div class=\"owner\">                    By <a href=\"<%= model.author.uri ? model.author.uri : \"#\" %>\" class=\"user_link\">                      <%= model.author.name ? model.author.name.escapeHTML() : \"\" %>                    </a>                   </div>                  <div class=\"event_time\">                   <span class=\"timestamp\">                      <%= model.toWhenString() %>                   </span>                 </div>               </p>             </div>           <% } %>         </div>";
this.constructor.template=new MapBuzz.Template.Template(_8f5);
}
return this.constructor.template;
}});
namespace("MapBuzz.Editor");
MapBuzz.Editor.AbstractEditor=function AbstractEditor(_8f6){
this.panel=_8f6;
this.opened=false;
};
Object.extend(MapBuzz.Editor.AbstractEditor.prototype,{updateCommand:function(){
return this.panel.updateCommand();
},open:function(_8f7,_8f8,_8f9,_8fa){
this.shape=_8f7;
this.point=_8f8;
this.openCommand(this.panel.contentCommand(),_8f9,_8fa).execute();
return this;
},openAjax:function(uri,_8fc,_8fd,_8fe){
var _8ff=new MapBuzz.Resource.Remote(uri);
var _900=new MapBuzz.Command.Message("Loading",MapBuzz.Message.PROCESSING);
_900.next(_8ff.getCommand(_8fc));
this.openCommand(_900,_8fd,_8fe).execute();
return this;
},close:function(){
this.closeCommand().execute();
return this;
},cancel:function(){
this.cancelCommand().execute();
return this;
},isOpen:function(){
return this.opened;
},openEditor:function(_901){
this.opened=true;
},drawEditor:function(){
},closeEditor:function(){
this.opened=false;
},cancelEditor:function(){
this.opened=false;
},openCommand:function(_902,_903,_904){
if(!this.openCommand_){
this.openCommand_=new MapBuzz.Command.Chain("Open Editor Chain",_902,new MapBuzz.Command.Bind("Open Editor",this.openEditor.bind(this)),this.initializeCommand(_903,_904),this.panel.initializeCommand(),new MapBuzz.Command.Bind("Draw Editor",this.drawEditor.bind(this)));
}
return this.openCommand_;
},setupPanel:function(){
this.panel.closeCommand().next(this.closeCommand());
this.panel.cancelCommand().next(this.cancelCommand());
},releasePanel:function(){
this.panel.releaseCommand().execute();
this.panel.closeCommand().remove(this.closeCommand());
this.panel.cancelCommand().remove(this.cancelCommand());
this.panel=null;
},initializeCommand:function(_905,_906){
if(!this._initializeCommand){
var _907=new MapBuzz.Command.Functor("Initialize Editor",{execute:function(_908){
this.setupPanel();
if(_905){
this.closeCommand().next(_905);
}
if(_906){
this.cancelCommand().next(_906);
}
return _908;
}.bind(this)});
this.initializeCommand_=new MapBuzz.Command.Chain("Initialize Editor Chain",_907);
}
return this.initializeCommand_;
},closeCommand:function(){
if(!this.closeCommand_){
this.closeCommand_=new MapBuzz.Command.Chain("Close Editor Chain",new MapBuzz.Command.Bind("Release Panel",this.releasePanel.bind(this)),new MapBuzz.Command.Bind("Close Editor",this.closeEditor.bind(this)));
}
return this.closeCommand_;
},cancelCommand:function(){
if(!this.cancelCommand_){
this.cancelCommand_=new MapBuzz.Command.Chain("Cancel Editor Chain",new MapBuzz.Command.Bind("Release Panel",this.releasePanel.bind(this)),new MapBuzz.Command.Bind("Cancel Editor",this.cancelEditor.bind(this)));
}
return this.cancelCommand_;
}});
MapBuzz.Editor.InPlaceEditor=function InPlaceEditor(_909){
this.callSuper(arguments.callee,_909);
};
MapBuzz.Editor.InPlaceEditor.inherits(MapBuzz.Editor.AbstractEditor);
Object.extend(MapBuzz.Editor.InPlaceEditor.prototype,{openEditor:function(_90a){
this.opened=true;
var view=this.shape.surface.view;
new Insertion.Bottom(view.element,_90a);
this.element=view.element.lastChild;
return this.element;
},closeEditor:function(){
this.element.parentNode.removeChild(this.element);
this.opened=false;
},cancelEditor:function(){
this.element.parentNode.removeChild(this.element);
this.opened=false;
},drawEditor:function(){
Element.show(this.element);
},transform:function(_90c){
this.shape.figure.transform(_90c);
this.drawEditor();
},getGeom:function(){
var _90d=this.shape.figure.geom.copy();
return this.shape.surface.view.convertWorldToView(_90d);
}});
namespace("MapBuzz.Editor");
MapBuzz.Editor.WindowEditor=function MapBuzzWindowEditor(_90e){
this.applySuper(arguments);
this.windowImpl=new MapBuzz.Window.WINDOW_IMPL(this,this.getWindowOptions());
};
MapBuzz.Editor.WindowEditor.inherits(MapBuzz.Editor.AbstractEditor);
Object.extend(MapBuzz.Editor.WindowEditor.prototype,{getWindowOptions:function(){
return new Object();
},getLinks:function(){
return [];
},getTitleLinksContent:function(){
var src="<span class=\"actions\">"+"<% for (var i=0; i<this.links.length; i++) { %>"+"  <% var link = this.links[i] %>"+"  <% var className = \"\" %>"+"  <% if (i == this.links.length -1 ) { %>"+"   <% className = \"last-child\" %>"+"  <% } %>"+"  <a id=\"<%= link.title.escapeHTML().toLowerCase() %>_link\" class=\"<%= className %>\" href=\"<%= link.uri.escapeHTML() %>\"><%= link.title.escapeHTML() %></a>"+"<% } %>"+"</span>";
var _910=new MapBuzz.Template.Template(src);
return _910.run({links:this.getLinks()});
},openEditor:function(_911){
Windows.addObserver(this);
this.opened=true;
return this.windowImpl.open(_911);
},closeEditor:function(){
Windows.removeObserver(this);
this.opened=false;
return this.windowImpl.close();
},cancelEditor:function(){
Windows.removeObserver(this);
this.opened=false;
return this.windowImpl.cancel();
},onStartResize:function(_912,win){
this.startWidth=win.element.offsetWidth;
this.startHeight=win.element.offsetHeight;
this.panel.onStartResize(this.startWidth,this.startHeight);
},onResize:function(_914,win){
this.panel.onResize(win.element.offsetWidth-this.startWidth,win.element.offsetHeight-this.startHeight);
this.startWidth=win.element.offsetWidth;
this.startHeight=win.element.offsetHeight;
},onEndResize:function(_916,win){
this.panel.onEndResize(win.element.offsetWidth,win.element.offsetHeight);
}});
MapBuzz.Editor.TabbedWindow=function EditorTabbedWindow(_918){
var _919=this.createTabs(_918);
this.callSuper(arguments.callee,_919);
};
MapBuzz.Editor.TabbedWindow.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.TabbedWindow.prototype,{createTabs:function(_91a){
var tabs=new MapBuzz.UI.TabsPanel("feature_window");
for(var i=0;i<_91a.length;i++){
var _91d=_91a[i];
var name=_91d.getName().underscore()+"_tab";
var _91f=_91d.getName().capitalize();
var tab=new MapBuzz.UI.TabPanel(name,tabs,_91f);
tab.panels.push(_91d);
if(i==0){
tabs.current=tab;
}
}
return tabs;
},setupPanel:function(){
for(var i=0;i<this.panel.panels.length;i++){
var _922=this.panel.panels[i];
var _923=_922.panels[0];
_923.closeCommand().next(this.closeCommand());
_923.cancelCommand().next(this.cancelCommand());
}
},releasePanel:function(){
this.panel.releaseCommand().execute();
for(var i=0;i<this.panel.panels.length;i++){
var _925=this.panel.panels[i];
var _926=_925.panels[0];
_926.closeCommand().remove(this.closeCommand());
_926.cancelCommand().remove(this.cancelCommand());
}
},getTabContentElement:function(){
if(!this.tabContentElement){
this.tabContentElement=$("feature_window_tab_content");
}
return this.tabContentElement;
}});
MapBuzz.Editor.NoteViewer=function NoteViewer(_927){
this.callSuper(arguments.callee,this.createPanel(_927));
};
MapBuzz.Editor.NoteViewer.inherits(MapBuzz.Editor.InPlaceEditor);
MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_LEFT=13;
MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_TOP=15;
Object.extend(MapBuzz.Editor.NoteViewer.prototype,{createPanel:function(_928){
return new MapBuzz.UI.NoteViewPanel(_928);
},openEditor:function(){
var _929=this.applySuper(arguments);
this.bodyElement=Element.getElementBySelector(_929,".map_note_body");
this.contentContainerElement=Element.getElementBySelector(_929,".map_note_content_container");
return _929;
},drawEditor:function(){
var geom=this.getGeom();
var left=Math.round(geom.x)+MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_LEFT;
var top=Math.round(geom.y)+MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_TOP;
this.panel.element.style.left=left+"px";
this.panel.element.style.top=top+"px";
var _92d=this.shape.figure.styles.normal();
this.bodyElement.style.width=_92d.width+"em";
this.contentContainerElement.style.height=_92d.height+"em";
this.setupChildElements(this.panel.element);
Element.show(this.panel.element);
this.bounds=null;
},setupChildElements:function(_92e){
var _92f=_92e.firstChild;
while(_92f){
this.setupChildElements(_92f);
_92f=_92f.nextSibling;
}
if(_92e.nodeType!=MapBuzz.Surface.AbstractShape.TEXT_NODE){
_92e.mbShape=this.shape;
}
},getBounds:function(){
if(!this.bounds){
var _930=this.panel.element;
var xMin=_930.offsetLeft-MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_LEFT;
var xMax=xMin+this.bodyElement.clientWidth+MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_LEFT;
var yMin=_930.offsetTop-MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_TOP;
var yMax=yMin+this.bodyElement.clientHeight+MapBuzz.Editor.NoteViewer.CALLOUT_OFFSET_TOP;
this.bounds=new Geometry.Envelope(xMin,yMin,xMax,yMax,this.shape.surface.view.viewCrs);
}
return this.bounds;
}});
MapBuzz.Editor.EventEditor=function EventEditor(_935){
this.model=_935;
var _936=[new MapBuzz.UI.EventViewerPanel(_935),new MapBuzz.UI.EventEditorPanel(_935)];
this.callSuper(arguments.callee,_936);
};
MapBuzz.Editor.EventEditor.inherits(MapBuzz.Editor.TabbedWindow);
Object.extend(MapBuzz.Editor.EventEditor.prototype,{getWindowOptions:function(){
var _937="<span class=\"title_dark\">edit</span><span class=\"title_light\">event</span>";
return {title:_937};
}});
MapBuzz.Editor.EventCreator=function EventCreator(_938){
this.model=_938;
var _939=new MapBuzz.UI.EventCreatorPanel(_938);
this.callSuper(arguments.callee,_939);
};
MapBuzz.Editor.EventCreator.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.EventCreator.prototype,{getWindowOptions:function(){
var _93a="<span class=\"title_dark\">create</span><span class=\"title_light\">event</span>";
return {title:_93a};
}});
MapBuzz.Editor.NoteEditor=function NoteEditor(_93b){
this.callSuper(arguments.callee,_93b);
};
MapBuzz.Editor.NoteEditor.inherits(MapBuzz.Editor.NoteViewer);
Object.extend(MapBuzz.Editor.NoteEditor.prototype,{createPanel:function(_93c){
return new MapBuzz.UI.NoteEditPanel(_93c);
},openEditor:function(_93d){
var _93e=this.applySuper(arguments);
var _93f=Element.getElementBySelector(this.element,".se_resize");
_93f.handle=new MapBuzz.Figure.EditorSEResizeHandle(this);
return _93e;
},drawEditor:function(){
this.applySuper(arguments);
var _940=this.panel.getPanel("content");
_940.element.focus();
_940.highlight();
},setBounds:function(_941){
var _942=this.bodyElement.clientHeight-this.contentContainerElement.clientHeight;
var _943=this.getBounds();
var _944=_943.width;
var _945=_943.height-_942;
var _946=_941.width/_944;
var _947=(_941.height-_942)/_945;
var _948=this.shape.figure.styles.normal();
_948.width*=_946;
_948.height*=_947;
this.drawEditor();
}});
MapBuzz.Editor.EventViewer=function EventViewer(_949){
this.model=_949;
var _94a=new MapBuzz.UI.EventViewerPanel(this.model);
this.callSuper(arguments.callee,_94a);
};
MapBuzz.Editor.EventViewer.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.EventViewer.prototype,{getWindowOptions:function(){
var _94b="<span class=\"title_dark\">view</span><span class=\"title_light\">event</span>";
return {title:_94b};
}});
MapBuzz.Editor.BoothEditor=function BoothEditor(_94c){
this.model=_94c;
if(this.model.product.isAvailable()){
var _94d=new MapBuzz.UI.BoothSelectPanel(this.model);
}else{
var _94d=new MapBuzz.UI.BoothRemovePanel(this.model);
}
this.callSuper(arguments.callee,_94d);
};
MapBuzz.Editor.BoothEditor.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.BoothEditor.prototype,{getWindowOptions:function(){
var _94e="<span class=\"title_dark\">Select</span> <span class=\"title_light\">Your Booth</span>";
return {title:_94e};
}});
MapBuzz.Editor.ExhibitorViewer=function ExhibitorViewer(_94f){
this.model=_94f;
var _950=new MapBuzz.UI.ExhibitorViewerPanel(_94f);
this.callSuper(arguments.callee,_950);
};
MapBuzz.Editor.ExhibitorViewer.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.ExhibitorViewer.prototype,{getLinks:function(){
return [];
},getWindowOptions:function(){
return {};
}});
namespace("MapBuzz");
MapBuzz.Editor.ImageBrowser=function ImageBrowser(_951){
var _952=new MapBuzz.UI.ImageBrowserPanel(_951);
this.callSuper(arguments.callee,_952);
};
MapBuzz.Editor.ImageBrowser.inherits(MapBuzz.Editor.WindowEditor);
MapBuzz.Editor.ImageBrowser.DEFAULT_RESOURCE=MapBuzz.Resource.Local.instance;
Object.extend(MapBuzz.Editor.ImageBrowser.prototype,{getWindowOptions:function(){
var _953="<span class=\"title_dark\">choose</span>"+"<span class=\"title_light\">Icon</span>";
return {id:"icon_chooser_window",title:_953,width:620,height:400};
}});
MapBuzz.Editor.LocationViewer=function LocationViewer(_954){
this.model=_954;
var _955=new MapBuzz.UI.LocationPanel(_954);
this.callSuper(arguments.callee,_955);
};
MapBuzz.Editor.LocationViewer.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.LocationViewer.prototype,{getWindowOptions:function(){
var _956="<span class=\"title_dark\">view</span><span class=\"title_light\">location</span>"+"<img class=\"action_icon\" src=\"/images/action_icon.gif\" alt=\"Actions\" />";
return {title:_956};
}});
MapBuzz.Editor.FeatureViewer=function FeatureViewer(_957){
this.model=_957;
var _958=[new MapBuzz.UI.FeatureViewerPanel(_957),new MapBuzz.UI.RoutePanel(_957)];
this.callSuper(arguments.callee,_958);
};
MapBuzz.Editor.FeatureViewer.inherits(MapBuzz.Editor.TabbedWindow);
Object.extend(MapBuzz.Editor.FeatureViewer.prototype,{getLinks:function(){
var _959=[];
var _95a=this.model.links.self(MapBuzz.Mime.HTML)||this.model.links.self(MapBuzz.Mime.XHTML);
if(_95a){
_95a.title="Details";
_959.push(_95a);
}
return _959;
},getWindowOptions:function(){
var _95b="<span class=\"title_dark\">view</span><span class=\"title_light\">feature</span>"+"<img class=\"action_icon\" src=\"/images/action_icon.gif\" alt=\"Actions\" />"+this.getTitleLinksContent();
return {title:_95b};
}});
MapBuzz.Editor.BoothViewer=function BoothViewer(_95c){
this.model=_95c;
var _95d=new MapBuzz.UI.BoothViewerPanel(_95c);
this.callSuper(arguments.callee,_95d);
};
MapBuzz.Editor.BoothViewer.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.BoothViewer.prototype,{getWindowOptions:function(){
var _95e="<span class=\"title_dark\">Booth</span> <span class=\"title_light\">Information</span>";
return {title:_95e};
}});
MapBuzz.Editor.FeatureCreator=function FeatureCreator(_95f){
this.model=_95f;
var _960=new MapBuzz.UI.FeatureCreatorPanel(_95f);
this.callSuper(arguments.callee,_960);
};
MapBuzz.Editor.FeatureCreator.inherits(MapBuzz.Editor.WindowEditor);
Object.extend(MapBuzz.Editor.FeatureCreator.prototype,{getWindowOptions:function(){
var _961="<span class=\"title_dark\">create</span><span class=\"title_light\">feature</span>";
return {title:_961};
}});
MapBuzz.Editor.FeatureEditor=function FeatureEditor(_962){
this.model=_962;
var _963=[new MapBuzz.UI.FeatureViewerPanel(_962),new MapBuzz.UI.FeatureEditorPanel(_962),new MapBuzz.UI.RoutePanel(_962)];
this.callSuper(arguments.callee,_963);
};
MapBuzz.Editor.FeatureEditor.inherits(MapBuzz.Editor.TabbedWindow);
Object.extend(MapBuzz.Editor.FeatureEditor.prototype,{getLinks:function(){
var _964=[];
var _965=this.model.links.self(MapBuzz.Mime.HTML)||this.model.links.self(MapBuzz.Mime.XHTML);
if(_965){
_965.title="Details";
_964.push(_965);
}
return _964;
},getWindowOptions:function(){
var _966="<span class=\"title_dark\">edit</span><span class=\"title_light\">feature</span>"+"<img class=\"action_icon\" src=\"/images/action_icon.gif\" alt=\"Actions\" />"+this.getTitleLinksContent();
return {title:_966};
}});
MapBuzz.Editor.TooltipViewer=function TooltipViewer(_967){
this.callSuper(arguments.callee,_967);
};
MapBuzz.Editor.TooltipViewer.inherits(MapBuzz.Editor.InPlaceEditor);
Object.extend(MapBuzz.Editor.TooltipViewer,{OFFSET_LEFT:30,OFFSET_TOP:10});
Object.extend(MapBuzz.Editor.TooltipViewer.prototype,{drawEditor:function(){
var left=Math.round(this.point.x)+MapBuzz.Editor.TooltipViewer.OFFSET_LEFT;
var top=Math.round(this.point.y)+MapBuzz.Editor.TooltipViewer.OFFSET_TOP;
this.panel.element.style.left=left+"px";
this.panel.element.style.top=top+"px";
Element.show(this.element);
var _96a=left+this.element.offsetWidth;
var _96b=this.element.parentNode.offsetWidth;
var _96c=_96a-_96b;
if(_96c>0){
this.element.style.left=(left-_96c)+"px";
}
},closeEditor:function(){
this.constructor.tooltip=null;
this.element.parentNode.removeChild(this.element);
this.opened=false;
}});
namespace("MapBuzz.Rank");
MapBuzz.Rank.Ranks=function Ranks(_96d){
this.schemes=_96d;
this.ranks=new HashTable();
};
Object.extend(MapBuzz.Rank.Ranks,{fromJson:function(_96e){
var _96f=new MapBuzz.Rank.Ranks();
for(var i=0;i<_96e.length;i++){
var _971=_96e[i];
var rank=MapBuzz.Rank.Rank.fromJson(_971);
_96f.add(rank);
}
return _96f;
}});
Object.extend(MapBuzz.Rank.Ranks.prototype,{add:function(rank){
this.ranks[rank.scheme]=rank;
return rank;
},values:function(){
return this.ranks.values();
},getRank:function(_974){
return this.ranks[_974];
},getAverageRank:function(){
NotImplementedError();
},getUserRank:function(){
NotImplementedError();
},getCountRank:function(){
NotImplementedError();
}});
MapBuzz.Rank.Ranks.prototype.toString=function toString(){
return this.ranks.toString();
};
namespace("MapBuzz.Rank");
MapBuzz.Rank.Images=function RankImages(){
this.images=new HashTable();
};
MapBuzz.Rank.Images.DEFAULT_IMAGE="default";
Object.extend(MapBuzz.Rank.Images.prototype,{cacheImage:function(_975,_976,uri){
var _978=this.images[_975];
if(!_978){
_978=this.images[_975]=new HashTable();
}
var _979=new Image();
_979.src=uri;
_978[_976]=_979;
},cacheDefaultImage:function(_97a,uri){
this.cacheImage(_97a,MapBuzz.Rank.Images.DEFAULT_IMAGE,uri);
},cacheImages:function(_97c,_97d){
_97d=new HashTable(_97d);
var keys=_97d.keys();
for(var i=0;i<keys.length;i++){
var key=keys[i];
var _981=_97d[key];
this.cacheImage(_97c,key,_981);
}
},getImage:function(_982,_983){
if(_983==null){
return null;
}
var _984=this.images[_982];
if(!_984){
return null;
}else{
return _984[_983];
}
},getDefaultImage:function(_985){
return this.getImage(_985,MapBuzz.Rank.Images.DEFAULT_IMAGE);
}});
MapBuzz.Rank.Images.instance=new MapBuzz.Rank.Images();
namespace("MapBuzz.Rank");
MapBuzz.Rank.Rank=function Rank(_986,_987,_988,_989){
this.scheme=_986;
this.value=_987;
this.label=_988;
this.domain=null;
this.resource=_989||MapBuzz.Resource.Local.instance;
};
Object.extend(MapBuzz.Rank.Rank,{RANK_INSERT:"RANK_INSERT",RANK_UPDATE:"RANK_UPDATE",RANK_REMOVE:"RANK_REMOVE"});
Object.extend(MapBuzz.Rank.Rank,{fromJson:function(_98a){
var _98b=_98a.resource;
var _98c=new MapBuzz.Resource.Permissions(_98b.insert,_98b.update,_98b.remove);
var _98d=new MapBuzz.Resource.Remote(_98b.uri,_98c);
return new MapBuzz.Rank.Rank(_98a.scheme,_98a.value,_98a.label,_98d);
}});
Object.extend(MapBuzz.Rank.Rank.prototype,{getRoundedValue:function(){
if(this.value==null){
return null;
}else{
return Math.round(this.value*2)/2;
}
},setValueCommand:function(_98e){
if(!this.value&&_98e&&this.resource.isInsertable()){
return this.insertCommand(_98e);
}else{
if(this.value&&_98e&&this.resource.isUpdatable()){
return this.updateCommand(_98e);
}else{
if(this.value&&!_98e&&this.resource.isRemovable()){
return this.removeCommand(_98e);
}else{
return this.updateLocalCommand(_98e);
}
}
}
},insertCommand:function(_98f){
var _990={parameters:"rating[rating]="+_98f};
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Saving rating",MapBuzz.Message.PROCESSING),new MapBuzz.Command.Databus(MapBuzz.Rank.Rank.RANK_INSERT,{rank:this}),this.resource.postCommand(_990),this.successCommand(_98f),new MapBuzz.Command.Message("Successfully saved rating.",MapBuzz.Message.STATUS));
},updateLocalCommand:function(_991){
var _992=new MapBuzz.Command.MultiFunctor("Update Rank Local",{execute:function(){
var _993=this.value;
this.value=_991;
return [_993,this.value];
}.bind(this)});
return _992;
},updateCommand:function(_994){
var _995={parameters:"rating[rating]="+_994};
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Updating rating",MapBuzz.Message.PROCESSING),new MapBuzz.Command.Databus(MapBuzz.Rank.Rank.RANK_UPDATE,{rank:this}),this.resource.putCommand(_995),this.successCommand(_994),new MapBuzz.Command.Message("Successfully saved rating.",MapBuzz.Message.STATUS));
},removeCommand:function(_996){
var _997={parameters:"rating[rating]="+_996};
return MapBuzz.Command.Build(new MapBuzz.Command.Message("Deleting rating",MapBuzz.Message.PROCESSING),new MapBuzz.Command.Databus(MapBuzz.Rank.Rank.RANK_REMOVE,{rank:this}),this.resource.deleteCommand(_997),this.successCommand(_996),new MapBuzz.Command.Message("Successfully deleted rating.",MapBuzz.Message.STATUS));
},successCommand:function(_998){
var _999=new MapBuzz.Command.MultiFunctor("Set Rank Success",{execute:function(){
var _99a=this.value;
this.value=_998;
return [_99a,this.value];
}.bind(this)});
return _999;
}});
MapBuzz.Rank.Rank.prototype.toString=function toString(){
return "Rank [Scheme: "+this.scheme+", "+"Rank: "+this.value+", "+"Label: "+this.label+"]";
};
MapBuzz.Rank.MapBuzz=function MapBuzzRanks(){
this.applySuper(arguments);
};
MapBuzz.Rank.MapBuzz.inherits(MapBuzz.Rank.Ranks);
Object.extend(MapBuzz.Rank.MapBuzz,{RANK_AVERAGE_SCHEME:"http://www.mapbuzz.com/rating#all",RANK_USER_SCHEME:"http://www.mapbuzz.com/rating#user",RANK_RATINGS_SCHEME:"http://www.mapbuzz.com/rating#buzzes",fromJson:function(_99b){
var _99c=new MapBuzz.Rank.MapBuzz();
for(var i=0;i<_99b.length;i++){
var _99e=_99b[i];
var rank=MapBuzz.Rank.Rank.fromJson(_99e);
_99c.add(rank);
}
return _99c;
}});
Object.extend(MapBuzz.Rank.MapBuzz.prototype,{getAverageRank:function(){
return this.getRank(MapBuzz.Rank.MapBuzz.RANK_AVERAGE_SCHEME);
},getUserRank:function(){
return this.getRank(MapBuzz.Rank.MapBuzz.RANK_USER_SCHEME);
},getCountRank:function(){
return this.getRank(MapBuzz.Rank.MapBuzz.RANK_RATINGS_SCHEME);
}});
MapBuzz.Rank.Images.instance.cacheImages(MapBuzz.Rank.MapBuzz.RANK_AVERAGE_SCHEME,{0:"/images/ratings/rating_00.gif",0.5:"/images/ratings/rating_05.gif",1:"/images/ratings/rating_10.gif",1.5:"/images/ratings/rating_15.gif",2:"/images/ratings/rating_20.gif",2.5:"/images/ratings/rating_25.gif",3:"/images/ratings/rating_30.gif",3.5:"/images/ratings/rating_35.gif",4:"/images/ratings/rating_40.gif",4.5:"/images/ratings/rating_45.gif",5:"/images/ratings/rating_50.gif"});
MapBuzz.Rank.Images.instance.cacheDefaultImage(MapBuzz.Rank.MapBuzz.RANK_AVERAGE_SCHEME,"/images/ratings/rating_00.gif");
MapBuzz.Rank.Images.instance.cacheImages(MapBuzz.Rank.MapBuzz.RANK_USER_SCHEME,{1:"/images/ratings/user_rating_10.gif",2:"/images/ratings/user_rating_20.gif",3:"/images/ratings/user_rating_30.gif",4:"/images/ratings/user_rating_40.gif",5:"/images/ratings/user_rating_50.gif"});
MapBuzz.Rank.Images.instance.cacheDefaultImage(MapBuzz.Rank.MapBuzz.RANK_USER_SCHEME,"/images/ratings/rating_00.gif");
MapBuzz.Rank.Yahoo=function(){
this.applySuper(arguments);
var _9a0=new MapBuzz.Rank.Rank(MapBuzz.Rank.Yahoo.RANK_USER_SCHEME,null,"User Rating");
this.add(_9a0);
};
MapBuzz.Rank.Yahoo.inherits(MapBuzz.Rank.Ranks);
Object.extend(MapBuzz.Rank.Yahoo,{RANK_AVERAGE_SCHEME:"urn:yahoo:lcl:average",RANK_USER_SCHEME:"urn:yahoo:lcl:user",RANK_RATINGS_SCHEME:"urn:yahoo:lcl:ratings"});
Object.extend(MapBuzz.Rank.Yahoo.prototype,{getAverageRank:function(){
return this.getRank(MapBuzz.Rank.Yahoo.RANK_AVERAGE_SCHEME);
},getUserRank:function(){
return this.getRank(MapBuzz.Rank.Yahoo.RANK_USER_SCHEME);
},getCountRank:function(){
return this.getRank(MapBuzz.Rank.Yahoo.RANK_RATINGS_SCHEME);
}});
MapBuzz.Rank.Images.instance.cacheImages(MapBuzz.Rank.Yahoo.RANK_AVERAGE_SCHEME,{0:"/images/ratings/rating_00.gif",0.5:"/images/ratings/rating_05.gif",1:"/images/ratings/rating_10.gif",1.5:"/images/ratings/rating_15.gif",2:"/images/ratings/rating_20.gif",2.5:"/images/ratings/rating_25.gif",3:"/images/ratings/rating_30.gif",3.5:"/images/ratings/rating_35.gif",4:"/images/ratings/rating_40.gif",4.5:"/images/ratings/rating_45.gif",5:"/images/ratings/rating_50.gif"});
MapBuzz.Rank.Images.instance.cacheImages(MapBuzz.Rank.Yahoo.RANK_USER_SCHEME,{1:"/images/ratings/user_rating_10.gif",2:"/images/ratings/user_rating_20.gif",3:"/images/ratings/user_rating_30.gif",4:"/images/ratings/user_rating_40.gif",5:"/images/ratings/user_rating_50.gif"});
namespace("MapBuzz.Component");
MapBuzz.Component.Directions=function DirectionsComponent(view){
this.view=view;
this.initialize();
};
Object.extend(MapBuzz.Component.Directions,{AFTER_DIRECTIONS:"AFTER_DIRECTIONS"});
Object.extend(MapBuzz.Component.Directions.prototype,{initialize:function(){
this.surface=this.view.surfaces.findSurfaceByType(MapBuzz.Surface.Google);
this.directions=new GDirections(this.surface.gMap);
GEvent.addListener(this.directions,"load",this.onLoad.bind(this));
},load:function(from,to,_9a4){
var _9a5=new Array();
this.from=this.processWaypoint(from);
this.to=this.processWaypoint(to);
_9a5.push(this.to);
_9a5.push(this.from);
this.directions.loadFromWaypoints(_9a5,{getSteps:true});
},processWaypoint:function(_9a6){
var geom=null;
if(typeof _9a6=="string"||_9a6 instanceof String){
return _9a6;
}else{
if(_9a6 instanceof Geometry.AbstractGeometry){
geom=_9a6;
}else{
if(_9a6 instanceof MapBuzz.Feature.MapBuzz){
geom=_9a6.figures.values[0].geom;
}else{
throw new Error("Waypoint is not geometry, feature or address: "+_9a6.toString()+".");
}
}
}
var _9a8=geom.getCenter();
return (_9a8.y+","+_9a8.x);
},onLoad:function(){
MapBuzz.databus.send(this,MapBuzz.Component.Directions.AFTER_DIRECTIONS,{directions:this});
}});
namespace("MapBuzz.Component");
MapBuzz.Component.RemoteLogger=function RemoteLogger(){
this.registerListeners();
this.logging=false;
};
Object.extend(MapBuzz.Component.RemoteLogger.prototype,{registerListeners:function(){
MapBuzz.databus.registerListener(MapBuzz.Message.MESSAGE,function(_9a9){
var _9aa=_9a9.data.level;
if(_9aa==MapBuzz.Message.UNEXPECTED_ERROR){
this.log(_9a9.data.message,_9a9.data.stack);
}
}.bind(this));
},log:function(_9ab,_9ac){
if(!this.logging){
this.logging=true;
var _9ad="resource=error";
var _9ae="error="+encodeURIComponent(_9ab)+"&stack="+encodeURIComponent(_9ac);
var _9af={method:"post",parameters:_9ad,accept:MapBuzz.Mime.JSON,postBody:_9ae,onSuccess:function(_9b0){
this.logging=false;
}.bind(this)};
var _9b1=new MapBuzz.Resource.Remote("/logger");
var _9b2=new MapBuzz.Ajax.Command(_9b1,_9af);
_9b2.execute();
}
}});
MapBuzz.Component.RemoteLogger.instance=new MapBuzz.Component.RemoteLogger();
namespace("MapBuzz.Media");
MapBuzz.Media.ImageCarousel=function ImageCarousel(_9b3,_9b4,_9b5){
this.container=$(_9b3);
this.album=_9b4;
this.imageType=_9b5||MapBuzz.Media.ImageType.MEDIUM;
this.processing=false;
this.initialize();
};
Object.extend(MapBuzz.Media.ImageCarousel.prototype,{initialize:function(){
this.addElement=Element.getElementBySelector(this.container,"span.add_image");
this.editable=(this.addElement!=null);
this.imagesElement=Element.getElementBySelector(this.container,"span.images");
this.processingElement=Element.getElementBySelector(this.container,"h3 span");
this.clickHandler=this.onClick.bindAsEventListener(this);
this.mouseOverHandler=this.onMouseOver.bindAsEventListener(this);
this.mouseOutHandler=this.onMouseOut.bindAsEventListener(this);
this.removeHandler=this.onRemove.bindAsEventListener(this);
Event.observe(this.imagesElement,"mouseover",this.mouseOverHandler);
Event.observe(this.imagesElement,"mouseout",this.mouseOutHandler);
if(this.editable){
Event.observe(this.addElement,"click",this.clickHandler);
Event.observe(this.getRemoveElement(),"click",this.removeHandler);
}
},release:function(){
Event.stopObserving(this.imagesElement,"mouseover",this.mouseOverHandler);
Event.stopObserving(this.imagesElement,"mouseout",this.mouseOutHandler);
if(this.editable){
Event.stopObserving(this.addElement,"click",this.clickHandler);
Event.stopObserving(this.getRemoveElement(),"click",this.removeHandler);
}
this.clickHandler=null;
this.mouseOverHandler=null;
this.mouseOutHandler=null;
this.removeHandler=null;
},onClick:function(_9b6){
this.openChooser();
},onMouseOver:function(_9b7){
if(this.processing){
return;
}
var _9b8=Event.element(_9b7);
if(!_9b8.tagName.match(/img/i)){
return;
}
if(_9b8==this.getRemoveElement()){
return;
}
this.showRemoveImage(_9b8);
},onMouseOut:function(_9b9){
var _9ba=Event.relatedTarget(_9b9);
if(_9ba==this.getRemoveElement()){
return;
}
this.hideRemoveImage();
},onRemove:function(_9bb){
var _9bc=this.getRemoveElement();
var _9bd=_9bc.targetImage;
this.hideRemoveImage();
var _9be=this.album.get(_9bd.id);
if(!_9be){
return;
}
var icon=_9be.get(this.imageType);
var _9c0=this.album.removeCommand(icon);
_9c0.next(this.updateCommand());
this.setProcessing(true);
_9c0.execute();
},refresh:function(){
if(this.album.resource instanceof MapBuzz.Resource.Local){
return;
}
this.hideRemoveImage();
var _9c1=this.album.readCommand();
_9c1.next(this.updateCommand());
this.setProcessing(true);
_9c1.execute();
},getRemoveElement:function(){
if(!this.removeElement){
this.removeElement=Element.create("img");
this.removeElement.style.display="none";
this.removeElement.style.position="absolute";
this.removeElement.src="/images/delete.gif";
this.removeElement.title=this.removeElement.alt="Remove photo";
this.container.appendChild(this.removeElement);
}
return this.removeElement;
},showRemoveImage:function(_9c2){
if(!this.editable){
return;
}
var pos=Position.positionedOffset(_9c2);
var _9c4=this.getRemoveElement();
var _9c5=10;
var _9c6=8;
var left=pos[0]+this.imageType.size-_9c5;
var top=pos[1]-_9c6;
_9c4.style.left=(left+"px");
_9c4.style.top=(top+"px");
_9c4.targetImage=_9c2;
Element.show(this.removeElement);
},hideRemoveImage:function(){
var _9c9=this.getRemoveElement();
Element.hide(_9c9);
},getPhotoElement:function(){
if(!this.photoElement){
this.photoElement=Element.create("img");
this.photoElement.style.display="none";
this.photoElement.style.position="absolute";
var _9ca=this.container.parentNode;
_9ca.insertBefore(this.photoElement,this.container.nextSibling);
}
return this.photoElement;
},showPhoto:function(_9cb){
var _9cc=this.album.get(_9cb.id);
if(!_9cc){
return;
}
var _9cd=this.getPhotoElement();
_9cd.title=_9cc.title;
var _9ce=_9cc.get(MapBuzz.Media.ImageType.PHOTO);
if(_9ce){
_9cd.src=_9ce.resource.uri;
Element.show(_9cd);
}else{
Element.hide(_9cd);
}
},hidePhoto:function(){
var _9cf=this.getPhotoElement();
Element.hide(_9cf);
},openChooser:function(){
if(!this.album.browserResource.uri){
return;
}
var _9d0=MapBuzz.Command.Build(this.album.insertCommand(),this.updateCommand());
this.browser=new MapBuzz.Editor.ImageBrowser(this.imageType);
this.setProcessing(true);
this.browser.openAjax(this.album.browserResource.uri,{},_9d0,this.cancelCommand());
},updateCommand:function(){
var _9d1=new MapBuzz.Command.Functor("Update images",{execute:function(_9d2){
this.album=_9d2;
this.updateImages(_9d2);
this.setProcessing(false);
return _9d2;
}.bind(this)});
return _9d1;
},cancelCommand:function(){
return new MapBuzz.Command.Functor("Cancel chooser",{execute:function(){
this.setProcessing(false);
}.bind(this)});
},updateImages:function(_9d3){
this.imagesElement.innerHTML=" ";
var _9d4=_9d3.groups.keys();
for(var i=0;i<_9d4.length;i++){
var _9d6=_9d3.groups[_9d4[i]];
this.createImage(_9d6);
}
},createImage:function(_9d7){
var icon=_9d7.get(this.imageType);
var _9d9=document.createElement("a");
_9d9.a=icon.resource.uri;
var _9da=new Image();
_9da.id=_9d7.getId();
_9da.src=icon.resource.uri;
_9da.title=_9d7.title;
_9da.className="icon_image";
_9d9.appendChild(_9da);
this.imagesElement.appendChild(_9d9);
},setProcessing:function(_9db){
if(_9db){
this.processingElement.innerHTML=" (loading)";
}else{
this.processingElement.innerHTML=" ";
}
this.processing=_9db;
}});
namespace("MapBuzz.Component");
MapBuzz.Component.Context=function Context(_9dc){
this.cookies=new CookieStorage();
this.mapId=_9dc;
this.registerListeners();
};
Object.extend(MapBuzz.Component.Context.prototype,{registerListeners:function(){
this.centerScaleListener=MapBuzz.databus.registerListener(MapBuzz.View.CENTER_SCALE_UPDATED,function(_9dd){
var view=_9dd.source;
this.updateContext(view);
}.bind(this));
},unregisterListeners:function(){
MapBuzz.databus.unregisterListener(MapBuzz.View.CENTER_SCALE_UPDATED,this.centerScaleListener);
},updateContext:function(view){
var _9e0=view.toQueryParams();
if(this.mapId){
_9e0+="&map_id="+this.mapId;
}
this.cookies.write("context",_9e0);
}});
namespace("MapBuzz.Validation");
MapBuzz.Validation.VALIDATION_ERROR_MESSAGE="MAPBUZZ_VALIDATION_ERROR_MESSAGE";
MapBuzz.Validation.VALIDATION_ERROR_CLASS="validation_error";
MapBuzz.Validation.PropertyError=function ValidationPropertyError(_9e1,_9e2,_9e3){
this.property=_9e1;
this.displayValue=_9e2||_9e1;
this.message=_9e3;
};
Object.extend(MapBuzz.Validation.PropertyError.prototype,{toHtml:function(_9e4){
var _9e5="<li>";
if(this.displayValue!="Error"){
_9e5+=(this.displayValue+" ");
}
_9e5+=this.message.escapeHTML();
_9e5+="</li>";
return _9e5;
}});
MapBuzz.Validation.Error=function ValidationError(_9e6,_9e7){
this.target=_9e6;
this.message=_9e7||"";
this.errors=new Array();
};
Object.extend(MapBuzz.Validation.Error.prototype,window.ErrorMixin);
Object.extend(MapBuzz.Validation.Error.prototype,{add:function(_9e8){
this.errors.push(_9e8);
}});
MapBuzz.Validation.Error.prototype.toString=function toString(){
return this.message;
};
Ajax.Responders.register({on418:function on418(_9e9,_9ea){
var _9eb=new MapBuzz.Ajax.Response(_9ea);
var _9ec=_9eb.getMediaType();
var _9ed=MapBuzz.Validation.io.read(_9eb.getResponse(_9ec),_9ec,_9eb.getAllResponseHeaders());
MapBuzz.databus.send(this,MapBuzz.Validation.VALIDATION_ERROR_MESSAGE,{error:_9ed});
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:_9ed.toString(),level:MapBuzz.Message.ERROR});
}});
MapBuzz.Validation.JsonReader=function ValidationJsonReader(_9ee){
this.applySuper(arguments);
this.initialize();
};
MapBuzz.Validation.JsonReader.inherits(MapBuzz.IO.AbstractReader);
Object.extend(MapBuzz.Validation.JsonReader.prototype,{read:function(data,_9f0){
var _9f1=data.name;
var _9f2=this.factory.create(_9f1);
_9f2.message=this.readPropertyErrors(_9f2,data.errors);
return _9f2;
},readPropertyErrors:function(_9f3,_9f4){
var _9f5="";
if(_9f3.target&&_9f3.target!="Argument Error"){
_9f5+="This "+_9f3.target+" could not be saved. ";
}
_9f5+="The following problems occurred:";
_9f5+="<ul>";
_9f4=new HashTable(_9f4);
var keys=_9f4.keys();
for(var i=0;i<keys.length;i++){
var _9f8=keys[i];
var _9f9=_9f8;
var _9fa=_9f4[_9f8];
if(_9f8=="display_value"){
_9f8="title";
_9f9="title";
}else{
if(_9f8=="feature_names"){
_9f8="title";
_9f9="title";
}else{
if(_9f8=="tag_name"){
_9f8="tags";
}
}
}
_9f9=_9f9.humanize();
var _9fb=new MapBuzz.Validation.PropertyError(_9f8,_9f9,_9fa);
_9f3.add(_9fb);
_9f5+="<li>"+(_9f9||_9f8)+" "+_9fa.escapeHTML()+"</li>";
}
_9f5+="</ul>";
return _9f5;
}});
MapBuzz.Validation.AtomReader=function ValidationAtomReader(_9fc){
this.applySuper(arguments);
this.initialize();
};
MapBuzz.Validation.AtomReader.inherits(MapBuzz.IO.XmlReader);
MapBuzz.Validation.AtomReader.getHandlers=MapBuzz.IO.XmlReader.getHandlers;
MapBuzz.Validation.AtomReader.mixin=MapBuzz.IO.XmlReader.mixin;
Object.extend(MapBuzz.Validation.AtomReader.prototype,{read:function(_9fd,_9fe){
var root=this.getRootElement(_9fd);
var _a00=root.selectSingleNode("atom:title");
var _a01=root.selectSingleNode("atom:summary")||root.selectSingleNode("atom:content");
var _a02=this.readText(_a01);
var _a03=this.factory.create("",_a02);
this.readPropertyErrors(_a03,_a01);
return _a03;
},readPropertyErrors:function(_a04,_a05){
var dts=_a05.selectNodes("xhtml:div/xhtml:dl/xhtml:dt");
var dds=_a05.selectNodes("xhtml:div/xhtml:dl/xhtml:dd");
for(var i=0;i<dts.length;i++){
var dt=dts[i];
var _a0a=this.readText(dt);
var _a0b=_a0a;
var dd=dds[i];
var _a0d=this.readText(dd);
var _a0e=new MapBuzz.Validation.PropertyError(_a0a,_a0b,_a0d);
_a04.add(_a0e);
}
}});
MapBuzz.Validation.HtmlReader=function ValidationHtmlReader(_a0f){
this.applySuper(arguments);
this.initialize();
};
MapBuzz.Validation.HtmlReader.inherits(MapBuzz.IO.AbstractReader);
Object.extend(MapBuzz.Validation.HtmlReader.prototype,{read:function(_a10,_a11){
var _a12=this.factory.create("",_a10);
return _a12;
}});
MapBuzz.Validation.Factory=function ValidationFactory(){
};
Object.extend(MapBuzz.Validation.Factory.prototype,{create:function(_a13,_a14){
return new MapBuzz.Validation.Error(_a13,_a14);
}});
MapBuzz.Validation.io=new MapBuzz.IO.Manager();
MapBuzz.Validation.io.readers[MapBuzz.Mime.JSON]=new MapBuzz.Validation.JsonReader(new MapBuzz.Validation.Factory());
MapBuzz.Validation.io.readers[MapBuzz.Mime.ATOM]=new MapBuzz.Validation.AtomReader(new MapBuzz.Validation.Factory());
MapBuzz.Validation.io.readers[MapBuzz.Mime.XML]=new MapBuzz.Validation.AtomReader(new MapBuzz.Validation.Factory());
MapBuzz.Validation.io.readers[MapBuzz.Mime.HTML]=new MapBuzz.Validation.HtmlReader(new MapBuzz.Validation.Factory());
MapBuzz.Validation.io.readers[MapBuzz.Mime.XHTML]=new MapBuzz.Validation.HtmlReader(new MapBuzz.Validation.Factory());
namespace("MapBuzz.Media");
MapBuzz.Media.Tabs=function MediaTabs(_a15,_a16){
this.container=$(_a15);
this.updateElement=Element.getElementBySelector(document.documentElement,_a16);
this.clickHandler=this.onClick.bindAsEventListener(this);
this.initialize();
};
MapBuzz.Media.Tabs.CURRENT_CLASS_NAME="current";
Object.extend(MapBuzz.Media.Tabs.prototype,{initialize:function(){
var _a17=Element.getElementsBySelector(this.container,"ul.media_tabs li a");
for(var i=0;i<_a17.length;i++){
var _a19=_a17[i];
if(_a19.getAttribute("target")!="_blank"){
Event.observe(_a19,"click",this.clickHandler);
}
}
},onClick:function(_a1a){
Event.stop(_a1a);
var _a1b=Event.element(_a1a);
this.updateCurrent(_a1b);
this.loadMedia(_a1b.href);
},updateCurrent:function(_a1c){
var _a1d=Element.getElementBySelector(this.container,"ul.media_tabs li.current");
if(_a1d){
Element.removeClassName(_a1d,MapBuzz.Media.Tabs.CURRENT_CLASS_NAME);
}
var _a1e=_a1c;
while(_a1e){
if(_a1e.tagName.match(/li/i)){
Element.addClassName(_a1e,MapBuzz.Media.Tabs.CURRENT_CLASS_NAME);
break;
}
_a1e=_a1e.parentNode;
}
},loadMedia:function(uri){
var _a20=new MapBuzz.Resource.Remote(uri);
var _a21={method:"get",accept:MapBuzz.Mime.HTML};
var _a22=MapBuzz.Command.Build(new MapBuzz.Command.Message("Loading media",MapBuzz.Message.PROCESSING),new MapBuzz.Ajax.Command(_a20,_a21),new MapBuzz.Command.UpdateElement(this.updateElement));
_a22.execute();
}});
namespace("MapBuzz");
function NotSupported(){
if(!window.location.pathname.match(/not_supported/)){
var uri="/not_supported"+"?agent_string="+encodeURI(window.navigator.userAgent)+"&agent="+Browser.instance.agent+"&major_version="+Browser.instance.majorVersion+"&minor_version="+Browser.instance.minorVersion;
window.location=uri;
}
}
if(Browser.instance.isOpera()){
Loader.require("/client/javascripts/opera_support.js");
}else{
if(Browser.instance.isIE()){
Loader.require("/client/javascripts/ie_support.js");
}
}
window.onerror=function(_a24,uri,line){
if(_a24 instanceof Event){
return false;
}
var _a27=_a24+"\n at "+uri+": "+line;
_a27=_a27.escapeHTML();
var _a28=Function.callStack();
MapBuzz.databus.send(this,MapBuzz.Message.MESSAGE,{message:_a27,level:MapBuzz.Message.UNEXPECTED_ERROR,stack:_a28});
return false;
};
MapBuzz.user=new MapBuzz.Atom.Person(null,null,false);
namespace("MapBuzz.Window");
MapBuzz.Window.WINDOW_=null;
MapBuzz.Window.AbstractWindow=function AbstractWindow(_a29,_a2a){
this.opener=_a29;
this.options=_a2a||new Object();
};
Object.extend(MapBuzz.Window.AbstractWindow.prototype,{open:function(_a2b){
NotImplementedError();
},close:function(){
NotImplementedError();
},cancel:function(){
NotImplementedError();
}});
MapBuzz.Window.Google=function WindowGoogle(_a2c,_a2d){
this.applySuper(arguments);
this.onMoveHandle=null;
};
MapBuzz.Window.Google.inherits(MapBuzz.Window.AbstractWindow);
Object.extend(MapBuzz.Window.Google.prototype,{openInfoWindow:function(_a2e,_a2f,_a30){
var gMap=this.getGMap();
this.view.moveState=MapBuzz.View.Viewer.SYSTEM_MOVE_STATE;
gMap.closeInfoWindow();
this.onCloseHandle=GEvent.addListener(gMap,"infowindowclose",this.cancelInfoWindow.bind(this));
_a2f.convertToCrs(Geometry.CrsFactory.instance.latLongCrs());
window.setTimeout(function(){
gMap.openInfoWindow(_a2f.toGLatLng(),_a2e);
},100);
},closeInfoWindow:function(){
GEvent.removeListener(this.onCloseHandle);
var gMap=this.getGMap();
gMap.closeInfoWindow();
this.reset();
},cancelInfoWindow:function(){
GEvent.removeListener(this.onCloseHandle);
this.reset();
if(this.onCancel){
window.setTimeout(this.onCancel,100);
}
},reset:function(){
this.opened=false;
var gMap=this.getGMap();
this.onMoveHandle=GEvent.addListener(gMap,"moveend",this.onMoveEnd.bind(this));
gMap.panTo(this.originalCenter.toGLatLng());
},onMoveEnd:function(){
GEvent.removeListener(this.onMoveHandle);
window.setTimeout(function(){
GEvent.removeListener(this.onCloseHandle);
this.view.moveState=MapBuzz.View.Viewer.USER_MOVE_STATE;
}.bind(this),500);
},getGMap:function(){
var _a34=this.getSurface();
return _a34.gMap;
},getSurface:function(){
var _a35=this.view.surfaces;
for(var i=0;i<_a35.length;i++){
if(_a35[i] instanceof MapBuzz.Surface.Google){
return _a35[i];
}
}
throw new Error("Could not find Google Data Source");
}});
MapBuzz.Window.Prototype=function WindowPrototype(_a37,_a38){
this.applySuper(arguments);
};
MapBuzz.Window.Prototype.inherits(MapBuzz.Window.AbstractWindow);
Object.extend(MapBuzz.Window.Prototype.prototype,{open:function(_a39){
this.options.showEffect=this.options.showEffect||Element.show;
this.options.hideEffect=this.options.hideEffect||Element.hide;
this.options.destroyOnClose=true;
this.options.closeCallback=this.onCloseWindow.bind(this);
this.options.minimizable=false;
this.prototypeWindow=new Window(this.options);
var _a3a=this.prototypeWindow.getContent();
if(typeof _a39=="string"){
new Insertion.Top(_a3a,_a39);
}else{
_a3a.appendChild(_a39);
}
this.prototypeWindow.showCenter();
return _a3a;
},close:function(){
this.prototypeWindow.setCloseCallback(null);
this.prototypeWindow.close();
},cancel:function(){
this.prototypeWindow.setCloseCallback(null);
this.prototypeWindow.close();
},onCloseWindow:function(){
this.opener.cancelCommand().execute();
}});
MapBuzz.Window.WINDOW_IMPL=MapBuzz.Window.Prototype;
namespace("MapBuzz.Window");
MapBuzz.Window.Window=function MapBuzzWindow(_a3b){
this.windowImpl=new MapBuzz.Window.WINDOW_IMPL(this,_a3b);
this.opened=false;
};
Object.extend(MapBuzz.Window.Window.prototype,{open:function(_a3c){
this.openCommand().execute(_a3c);
return this;
},openAjax:function(uri,_a3e){
var _a3f=this.openAjaxCommand(uri,_a3e);
_a3f.execute();
},close:function(){
this.closeCommand().execute();
return this;
},cancel:function(){
this.cancelCommand().execute();
return this;
},isOpen:function(){
return this.opened;
},openCommand:function(){
if(!this.openCommand_){
var _a40=new MapBuzz.Command.Functor("Open",{execute:function(_a41){
this.opened=true;
return this.windowImpl.open(_a41);
}.bind(this)});
this.openCommand_=new MapBuzz.Command.Chain("Open Window",_a40);
}
return this.openCommand_;
},openAjaxCommand:function(uri,_a43){
if(!this.ajaxCommand_){
var _a44=new MapBuzz.Resource.Remote(uri);
this.ajaxCommand_=new MapBuzz.Command.Chain("Open Window",_a44.getCommand(_a43),this.openCommand());
}
return this.ajaxCommand_;
},closeCommand:function(){
if(!this.closeCommand_){
var _a45=new MapBuzz.Command.Functor("Close",{execute:function(){
this.windowImpl.close();
this.opened=false;
}.bind(this)});
this.closeCommand_=new MapBuzz.Command.Chain("Close Window",_a45);
}
return this.closeCommand_;
},cancelCommand:function(){
if(!this.cancelCommand_){
var _a46=new MapBuzz.Command.Functor("Cancel",{execute:function(){
if(this.opened){
this.windowImpl.cancel();
this.opened=false;
}
}.bind(this)});
this.cancelCommand_=new MapBuzz.Command.Chain("Cancel Window",_a46);
}
return this.cancelCommand_;
}});

