zul.wgt.Imagemap=zk.$extends(zul.wgt.Image,{$define:{width:function(b){var a=this.getImageNode();a&&(a.style.width=b)},height:function(b){var a=this.getImageNode();a&&(a.style.height=b)}},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")},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(b){var a=this.uuid+"-map",c=this.getImageNode();c.useMap=b?"#"+a:"";c.isMap=!b},contentAttrs_:function(){var b=this.$supers("contentAttrs_",arguments),a=this._width,c=this._height;if(a||c)b+=' style="',a&&(b+="width:"+a+";"),c&&(b+="height:"+c+";"),b+='"';return b+(this.firstChild?' usemap="#'+
this.uuid+'-map"':' ismap="ismap"')},fromPageCoord:function(b,a){var c=zk(this.getImageNode()).revisedOffset();return[b-c[0],a-c[1]]},_doneURI:function(){var b=zul.wgt.Imagemap,a=b._doneURI;return a?a:b._doneURI=zk.IMAGEMAP_DONE_URI?zk.IMAGEMAP_DONE_URI:zk.ajaxURI("/web/zul/html/imagemap-done.html",{desktop:this.desktop,au:!0})}},{onclick:function(b){if(!zul.wgt.Imagemap._toofast()){var a=b.indexOf("?");if(!(0>a)){var c=b.indexOf("?",++a);if(!(0>c)){a=b.substring(a,c);var d=zk.Widget.$(a);d&&(a=b.indexOf(",",
++c),0>a||d.fire("onClick",{x:zk.parseInt(b.substring(c,a)),y:zk.parseInt(b.substring(a+1))},{ctl:!0}))}}}},_toofast:function(){if(zk.gecko){var b=zul.wgt.Imagemap,a=jq.now();if(b._stamp&&800>a-b._stamp)return!0;b._stamp=a}return!1}});
