$(document).ready(function() {

//reveal - hide authors About in sidebar

   $('.aboutCats').toggle(function(){
		$('#aboutCats').css("background-image", "url(http://sand.bizmology.com/wp-content/themes/Bizmology2009/images/whiteArrowUp.png)");
		$('#aboutCats').css("border-width", "5px 5px 0 5px");
		$('#aboutCats').css("padding-bottom", "8px");
    },function(){
		$('#aboutCats').css("background-image", "url(http://sand.bizmology.com/wp-content/themes/Bizmology2009/images/whiteArrowDown.png)");
		$('#aboutCats').css("border-width", "5px 5px 5px 5px");
		$('#aboutCats').css("padding-bottom", "6px");
    });
	$('.aboutCats').bind('click', function() {
	$('#hiddenCats').toggle(300); return false;
	});

//removes bottom border from next-to-last span in the authors listings
	var $curr = $('#authors li:last');
	if ($curr = $curr.prev('.even').children('span')) {
		$curr.css('border-bottom','1px solid #fff');
		}

//Validate Comment Forms
	$('form#commentform').submit(function() {
		$('form#commentform .error').remove();
		var hasError = false;
		$('.requiredField').each(function() {
			if(jQuery.trim($(this).val()) == '') {
				var labelText = $(this).prev('label').children().children('span.required').text();
				//var labelText = $(this).prev('label').text();
				$(this).parent().append('<span class="error">Error. The '+labelText+' field is required.</span>');
				hasError = true;
			}
		});
		if(hasError == true) {
			return false;
		} else {
			return true;
		}
	});

//Enhances the search field
	$("#s").focus(function() {
		if ($(this).val() == "Search this website...") {
			$(this).val("");
		}
	});

	$("#s").blur(function() {
		if ($(this).val() == "") {
			$(this).val("Search this website...");
		}
	});

});