$(document).ready(function() { 	// Make the first column a label on forms	$("#main table td:even").addClass("label");		// Strip tables with class=stripe	$("#main table tr:even").addClass("even");		// Add the datepicker to date fields	$("input[class*=date]").datepicker();		// Put cursor into first field		$("input:visible:first").addClass("focusfield").focus();	// Highlight the fields on focus	$("input").focus(function() {		$(this).addClass("focusfield");	});		$("input").blur(function() {		$(this).removeClass("focusfield");	});		$("textarea").focus(function() {		$(this).addClass("focusfield");	});		$("textarea").blur(function() {		$(this).removeClass("focusfield");	});			// Handle the category drop down (multiple)	$("select[name='Category_Picker']").after("<div id='catlist'></div>");	BuildCategoryDescList();	$("select[name='Category_Picker']").change(function() {		if ($(this)[0].selectedIndex!=0) {			AddToCategoryList($(this).val());					}	 });	 }); function AddToCategoryList(category) { 	var categoryField = $("input[name='Categories']"); 	if (categoryField.val()=="") { 		categoryField.val(category); 	} else {	 	categoryField.val(categoryField.val() + "," + category); 	} 	BuildCategoryDescList(); 	$("select[name='Category_Picker']").subOption(category);  	$("select[name='Category_Picker']")[0].selectedIndex=0;}function BuildCategoryDescList() {	var catHTML="";	var catlist = $("input[name='Categories']").val().split(",");	if (catlist[0]!="") {		for (var j=0; j<catlist.length; j++) {			var trashcan = "&nbsp;<a href=\"\" onclick=\"RemoveFromCategoryList('"+catlist[j]+"');return false;\"><img src=\"" + GetDBPath() + "/trash_14x14.gif\" alt=\"remove repair description\" border=\"0\" width=\"14\" height=\"14\" \></a>";			catHTML += "<li>" + catlist[j] + trashcan + "</li>";		}		$("#catlist").html("<ul>" + catHTML + "</ul>");	} else {		$("#catlist").html("");	}}function RemoveFromCategoryList(cat) {	var catArray = $("input[name='Categories']").val().split(",");	var catString="";	for (var j=0; j<catArray.length; j++) {		if (cat!=catArray[j]) {			if (catString==""){				catString=catArray[j];			} else {				catString += "," + catArray[j];			}		}	}	$("select[name='Category_Picker']").addOption(cat); 	$("input[name='Categories']").val(catString);	BuildCategoryDescList();}function GetDBPath() {	var path = window.location.pathname;	nsfLoc = path.toLowerCase().indexOf(".nsf");	return path.substr(0,nsfLoc) + ".nsf";}
