$(document).ready(function(){

	$("ul").each(function() {
		$(this).children("li:last").addClass('last');
	});

	$("li").hover(function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); });


	$("#topnav > ul > li.active_section").each(function() {
		marker = $("<div />").addClass('active_section_marker').width($(this).width());
		$(this).append(marker);
	});

	$("#home_bottom_blocks .block:even").each(function() {
		$(this).addClass('left');
	});

	$(".minheight").each(function() {
		if ($(this).height() < $(this).css('min-height').replace('px', '')) {
			$(this).height($(this).css('min-height'));
		}
	});

	$(".autofill").focus(function() {
		if ($(this).val() == $(this).attr('title')) { $(this).val(''); }
	}).blur(function() {
		if ($(this).val() == '') { $(this).val($(this).attr('title')); }
	});


	home_block_height = Math.max($("#home_blocks .content:first").height(), $("#home_blocks .content:last").height());
	$("#home_blocks .content").height(home_block_height);


	query = location.search.substring(1);
	if (query.length) {
		$("ul.tabs a").each(function() {
			$(this).attr('href', $(this).attr('href') + '?' + query);
		});
	}
});
