(function(n){var t=function(n){this.init(n)};t.prototype={init:function(t){var i={id:"",title:{text:"",classname:""},content:[],point:{lng:"",lat:""},level:15,icon:""};this.opts=n.extend({},i,t);this.rendermap()},rendermap:function(){var n=this.opts;var t=n.id;var i=n.level||15;var o=this.map=new bmap.map(t);var a=this.point=new bmap.point(n.point.lng,n.point.lat);if(!t){throw"id"}o.centerandzoom(a,i);this.addcontrol();this.createmarker();this.renderinfowindow()},addcontrol:function(){var n=this.map;var t=this.opts.type;n.addcontrol(new bmap.navigationcontrol);n.addcontrol(new bmap.scalecontrol);n.addcontrol(new bmap.overviewmapcontrol);if(t){n.addcontrol(new bmap.maptypecontrol)}},createmarker:function(){var n=this;var t=this.map;var i=this.point;var o=new bmap.marker(i);var a=this.opts.icon;var e=a.url;if(e){o=new bmap.marker(i,{icon:new bmap.icon(e,new bmap.size(a.width,a.height))})}t.addoverlay(o);o.addeventlistener("click",function(){n.openinfowindow()})},renderinfowindow:function(){var t=this.map;var i=this.point;var o=this.opts;var a=o.content.text;var e="";if(a.length>0){n.each(a,function(n,t){e+='
'+t+"
"})}var r=this.infowindow=new bmap.infowindow(e,{width:o.width||0,height:o.height||0,title:'
'+o.title.text+"
"});this.openinfowindow()},openinfowindow:function(){var n=this.map;var t=this.point;var i=this.infowindow;if(!i.isopen()){n.openinfowindow(i,t)}}};window.baidumap=t})(jquery);