// ********** Chris top menu plugin
// ********** Optimum-Web
(function($){
jQuery.fn.ch_top_menu = function(opt) {
	  return this.each(function() {        	
            new j_ch_top_menu_class(this, opt);
      });
}
var defaults = {	
	img_menu_id_start:'tm'
};

jQuery.ch_top_menu_class = function(el,opt){	
	var container = jQuery(el);
	var maxHeight = 0;
	var self = this;
    this.options = jQuery.extend({}, defaults, opt || {});
	this.extend = jQuery.fn.extend({
								    unselect_all:function(){										 
										 try{
										  var outsrc = jQuery("img[id^='"+self.options.img_menu_id_start+"']").attr('mout');
										  jQuery("img[id^='"+self.options.img_menu_id_start+"']").attr('src',outsrc);
										 } catch(e){}
									 },
									 select_this:function(id){
										 var url = window.location.pathname;										 
										 var href = jQuery(container).parent().attr("href");
										 if(href.length>1 && url.indexOf(href)!=-1){
											 var mover = jQuery(container).attr('mover');
												jQuery(container).attr('src',mover);
												jQuery(container).attr('mout',mover);
										 }
									 },
									 unselect_this:function(){
										 var outsrc = jQuery(container).attr('mout');
										 jQuery(container).attr('src',outsrc);
									 }
								   });
	self.extend.unselect_this();
	self.extend.select_this();
}
var j_ch_top_menu_class = jQuery.ch_top_menu_class;
})(jQuery);

