$ = jQuery; // give the dolla' back to jay Q!

// PDF links open in new windows
//$('a[href*=.pdf]').attr('target','_blank'); // stopped working for some reason

var they_have_children = $('.sublinks li .children').parent();
they_have_children.addClass('haschildren');
they_have_children.find('a:not(li li a)').addClass('parent');

// fix flash z-index
$("object[type='application/x-shockwave-flash']").append('<param name="wMode" value="transparent"/>');


$('.gallery a[href$=".jpg"]').attr('rel','gallery');
// Enable Lighbox on all links to jpg and png files.
$('a[href$=".jpg"]').lightbox();
$('a[href$=".png"]').lightbox();

// Fade out images on hover
$('a img').not('#news-thumbs img, .side-thumb img').hover(
	function(){
		$(this).stop().animate({opacity:0.8},300);
	},
	function(){
		$(this).stop().animate({opacity:1},100);
	}
);


// Tables that have forms should have a bigger font size
$('form table').css('font-size','12px');

// Clicking on a table row should focus its textfield (if it has one)
$('.post-body table tr').click(function(){
	var form_elements = $(this).find('input, textarea, select');
	$(this).find('input, textarea, select').focus();
	// var checkboxes = $(this).find('input[type="checkbox"]');
	// if ( checkboxes[0] && !checkboxes[1]) {
	// 	if ( checkboxes[0].checked ) {
	// 		checkboxes[0].checked = false;
	// 	} else {
	// 		checkboxes[0].checked = true;
	// 	}
	// }

	if (form_elements[0]) {
		$('.post-body table tr').removeClass('active-row');
		$(this).addClass('active-row');
	}
});

$('.post-body table tr').find('input, textarea, select').click(function(e) {
    //e.stopPropagation();
});

