(function($)
{
	var methods = 
	{
    	init : function(options) 
    	{  
    		$("ul.products").hide();
    		$("ul.category li a.category").bind('click.opleidingen',methods.open);
    		product_id = methods.getquery("product_id");
    		if(product_id!="")
    		{
    			tofind = "a#product-"+product_id;
    			$(tofind).css("color","#F78D02");
    			$(tofind).parents("ul.products").slideDown();  //show();
    		}
   		},
   		open : function(e)
   		{
   			e.preventDefault();
   			$("ul.products").slideUp(); //hide();
			$(this).siblings(".products").slideDown(); //show()
   		},
   		close : function(e)
   		{
   			
   		},
   		getquery : function(key, default_)
   		{
   			
			if (default_==null) default_=""; 
				key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
				var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
				var qs = regex.exec(window.location.href);
				if(qs == null)
					return default_;
				else
    				return qs[1];
			
   		}
 	};
 	 
 	$.fn.opleidingmenu = function(method) 
 	{
    	if (methods[method]) 
    	{
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		} 
		else if (typeof method === 'object' || ! method) 
		{
			return methods.init.apply(this, arguments);
		} 
		else 
		{
			$.error('Method ' +  method + ' does not exist on jQuery.litebox');
    	}    
  	};

})(jQuery);
