jQuery(document).ready(function(){

	jQuery(".niceCheck").mousedown(function() {
		changeCheck(jQuery(this));
	});

	jQuery(".niceCheck").each(function() {
		changeCheckStart(jQuery(this));
	});
	
	$('.button').live('mouseenter', function() {
		var img = $(this).attr('src');
		$(this).attr('src', img.split('.')[0] + '-blue.png');
	}).live('mouseleave', function() {
		var img = $(this).attr('src');
		$(this).attr('src', img.split('-blue.png')[0] + '.png');
	});
	
	$('#text-navigation').css('padding-top', (30 + $('div#text h1').height()) + 'px');
	
	$('#largeImage').load(function() {
		var height = $('#largeImage').height();
		if(height > 100) $('#panel').css('height', height + 'px');
	});	

});

function changeCheck(el){
	var el = el,
	input = el.find("input").eq(0);
	if(!input.attr("checked")) {
		el.css("background-position","0 -13px");
		input.attr("checked", true)
	} else {
		el.css("background-position","0 0");
		input.attr("checked", false)
	}
	return true;
}

function changeCheckStart(el) {
	var el = el,
	input = el.find("input").eq(0);
	if(input.attr("checked")) {
		el.css("background-position","0 -13px");
	}
	return true;
}
