$(document).ready(function() {
	// easy toggle for categories
	$('#triggerCatID').click(function() {
		$(this).toggleClass('focus');
		$('#headerStrip').animate({ height: 'toggle', opacity: '100'}, 100);
		return false;
	});
	$('#triggerCatID2').click(function() {
		$(this).toggleClass('focus');
		$('#footerStrip').animate({ height: 'toggle', opacity: '100'}, 100);
		return false;
	});
	
	$(window).resize(function(){
  		adjustColumns();
	});
	
	// set all 3 columns to equal height
	var adjustColumns = function(){
		$('#mainColumn').height('100%');
		$('div.secondaryColumn').height('100%');
		$('div.thirdColumn').height('100%');
		var h1 = $('#mainColumn div.columnContent').height() + Number( $('#mainColumn div.columnContent').css('border-top-width').split('px')[0] );
		var h2 = $('div.secondaryColumn div.columnContent').height();
		var h3 = $('div.thirdColumn').height();
		var maxH = Math.max(Math.max(h1, h2), h3);
		h1 = maxH;
		h2 = maxH - Number( $('div.secondaryColumn').css('border-top-width').split('px')[0] );
		h3 = maxH - Number( $('div.thirdColumn').css('border-top-width').split('px')[0] );
		$('#mainColumn').height(h1);
		$('div.secondaryColumn').height(h2);
		$('div.thirdColumn').height(h3);
	};
	
	adjustColumns();
	
	// rollover/down states for submit button

		$('form').find("input[name='submit']").mouseover(function() {

			var src = $(this).attr("src");

			src = src.split("_out").join("_over");

			$(this).attr("src", src);

		});

		$('form').find("input[name='submit']").mouseout(function() {

			var src = $(this).attr("src");

			src = src.split("_over").join("_out");

			src = src.split("_down").join("_out");

			$(this).attr("src", src);

		});

		$('form').find("input[name='submit']").mousedown(function() {

			var src = $(this).attr("src");

			src = src.split("_over").join("_down");

			$(this).attr("src", src);

		});

		$('form').find("input[name='submit']").mouseup(function() {

			var src = $(this).attr("src");

			src = src.split("_down").join("_over");

			$(this).attr("src", src);

		});
		
		$('#commentform .contain *:first-child').css('background-color', '#FFFFFF');
		
		$('#commentform .contain *:first-child').focus( function() {
			$(this).css('background-color', '#FFFFC5');
		});
		
		$('#commentform .contain *:first-child').blur( function() {
			$(this).css('background-color', '#FFFFFF');
		});

});
