
(function($){$.fn.ZImageTopMenu=function(userConfig){function methods(){}
methods.prototype.root=null;methods.prototype.props={root:null,selectedMenuItemClass:'selected',menuItemHeight:45,menuItemWidth:132,menuBackgroundImageURL:'images/main-menu.png'}
methods.prototype.init=function(root,userConfig){this.root=root;this.props=$.extend(this.props,userConfig);this.initBG();this.initHover();};methods.prototype.initBG=function(){$(this.root).css('background-image','url('+this.props.menuBackgroundImageURL+')');$(this.root).css('background-repeat','no-repeat');var selected=$(' > ul > li.'+this.props.selectedMenuItemClass,this.root);var list=$(' > ul > li',this.root);var index=list.index(selected);var left=-(this.props.menuItemWidth*index)+'px';var top=-(this.props.menuItemHeight*2)+'px';$('>a',selected).css('background-image','url('+this.props.menuBackgroundImageURL+')');$('>a',selected).css('background-repeat','no-repeat');$('>a',selected).css('background-position',left+' '+top);};methods.prototype.initHover=function(){var _this=this;$(' > ul > li',this.root).hover(function(){if(!$(this).hasClass(_this.props.selectedMenuItemClass)){$('>a',this).css('background-image','url('+_this.props.menuBackgroundImageURL+')');$('>a',this).css('background-repeat','no-repeat');var list=$(' > ul > li',_this.root);var index=list.index(this);var left=-(_this.props.menuItemWidth*index)+'px';var top=-(_this.props.menuItemHeight)+'px';$('>a',this).css('background-position',left+' '+top);}
$(this).find('ul').show();},function(){$(this).find('ul').hide();if(!$(this).hasClass(_this.props.selectedMenuItemClass)){$('>a',this).css('background','none');}});}
return this.each(function(){var $m=new methods();$m.init(this,userConfig);});}})(jQuery);
