jQuery(function($){
	jQuery.fn.ds_find_active_links = function(options) {
		settings = jQuery.extend({
		     match_by_base: false
		  }, options);

		var current_location = window.location.href;

		return this.each(function(){
			var href = this.href,
					$a = $(this);

			if (href != undefined) {

				if (settings.match_by_base) {
					find_base = /http:\/\/[A-Za-z0-9_\-\:\.]*\/([A-Za-z0-9_\-]*)/;
					url_base = current_location.match(find_base);
					link_base = href.match(find_base);
					if (url_base.length > 1 && link_base.length > 1) {
						if (url_base[1] == link_base[1]) {						
							$a.addClass("active");
						}
					}
				}

				else {
					contains_href = new RegExp(href);
					if(contains_href.test(current_location)) {
						$a.addClass("active");
					}					
				}
			}
		});
	};	
});