zul.wgt.Imagemap=zk.$extends(zul.wgt.Image,{$define:{width:function(a){var b=this.getImageNode();b&&(b.style.width=a)},height:function(a){var b=this.getImageNode();b&&(b.style.height=a)}},bind_:function(){this.$supers(zul.wgt.Imagemap,"bind_",arguments);jq("#zk_hfr_")[0]||jq.newFrame("zk_hfr_",null,zk.webkit?"position:absolute;top:-1000px;left:-1000px;width:0;height:0;display:inline":null)},getImageNode:function(){return this.$n("real")},getCaveNode:function(){return this.$n("map")},doClick_:function(a){},
onChildAdded_:function(){this.$supers("onChildAdded_",arguments);this.desktop&&this.firstChild==this.lastChild&&this._fixchd(!0)},onChildRemoved_:function(){this.$supers("onChildRemoved_",arguments);this.desktop&&!this.firstChild&&this._fixchd(!1)},_fixchd:function(a){var b=this.uuid+"-map",c=this.getImageNode();c.useMap=a?"#"+b:"";c.isMap=!a},contentAttrs_:function(){var a=this.$supers("contentAttrs_",arguments),b=this._width,c=this._height;if(b||c)a+=' style="',b&&(a+="width:"+b+";"),c&&(a+="height:"+
c+";"),a+='"';return a+(this.firstChild?' usemap="#'+this.uuid+'-map"':' ismap="ismap"')},fromPageCoord:function(a,b){var c=zk(this.getImageNode()).revisedOffset();return[a-c[0],b-c[1]]},_doneURI:function(){var a=zul.wgt.Imagemap,b=a._doneURI;return b?b:a._doneURI=zk.IMAGEMAP_DONE_URI?zk.IMAGEMAP_DONE_URI:zk.ajaxURI("/web/zul/html/imagemap-done.html",{desktop:this.desktop,au:!0})}},{onclick:function(a){if(!zul.wgt.Imagemap._toofast()){var b=a.indexOf("?");if(!(0>b)){var c=a.indexOf("?",++b);if(!(0>
c)){b=a.substring(b,c);var d=zk.Widget.$(b);d&&(b=a.indexOf(",",++c),0>b||d.fire("onClick",{x:zk.parseInt(a.substring(c,b)),y:zk.parseInt(a.substring(b+1))},{ctl:!0}))}}}},_toofast:function(){if(zk.gecko){var a=zul.wgt.Imagemap,b=jq.now();if(a._stamp&&800>b-a._stamp)return!0;a._stamp=b}return!1}});
