jQuery.expr[':'].containsIgnoreCase = function(a,i,m){  
	return (" "+jQuery(a).text()+" ").toUpperCase().indexOf(m[3].toUpperCase())>=0; 
	//       ^--------------------^--- need the spaces or IE doesn't find strings _beginning_ with search term???
};  


$(document).ready(function() {
	InitFindAService();
});

function InitFindAService(){
	// usage: add the class 'submit-on-enter' to any element
	$("input[type=text].dynamicSearchBox").keyup(function(ev) {
		var maxToShow = 10 ;
		$("#serviceFinderInnerTop ul, #serviceFinderInnerTop .limit-message").children().remove();
		if(this.value.length > 0)
		{
			var count = 0;
			$(".collapseResults li>a:containsIgnoreCase( "+this.value+")").each(function(i){
				count = i;
				if(count<maxToShow)
					$("#serviceFinderInnerTop ul").append("<li>"+$(this).parent().html()+"</li>");
			});      
			
			if(count>=maxToShow)
				$("#serviceFinderInnerTop .limit-message").append("<p>Showing first "+maxToShow+" only</p>");
		}
    });
}
