 
$(document).ready(function() {

	var duration = 300;
	var easing = 'swing';
 
	var last_img = $('#frontpage_content_top .col:last IMG');

	$('#frontpage_content_top')
		.css('width', '970px')
		.css('overflow', 'hidden')
		.css('background', 'url('+ last_img.attr('src') +') top right no-repeat');
 
	$('#frontpage_content_top .col').mouseover(
		function() {
			$(this.parentNode).children('.col').stop();
			var other = $(this).siblings();
			other.animate({ 'width': '220px' }, { duration: duration, easing: easing });
			$(this).animate({ 'width': '300px' }, { duration: duration, easing: easing });
		}
	);
 
	$('#frontpage_content_top').mouseout(
		function() {
			var all = $(this).children('.col');
			all.stop();
			all.animate({ 'width': '240px' }, { duration: duration, easing: easing });
		}
	);
 
	$('.bytes-human').each(function() {
		var bytes = parseInt($(this).text());
		if (bytes > 999999)
			$(this).text(Math.round(bytes/1000000) + ' Mt');
		else if (bytes > 999)
			$(this).text(Math.round(bytes/1000) + ' kt');
		else
			$(this).text(bytes + ' t');
	});

	$('.initial-focus').focus();
	
	/* Edustukset navigation */
	if ($("#breadcrumb a").length > 1 && $("#breadcrumb a")[1].toString().indexOf("edustukset") > 0) {
		$("#navi_2nd_level li").hover(function(){
			$(this).children("ul:first").slideDown("fast");
		},function(){
			$(this).children("ul:first").slideUp("fast");
		});
	}

	/* Add CSS pseudo selector classes */
	
	$('TABLE TR:first-child, TABLE TD:first-child, TABLE TH:first-child').addClass('first-child');
	$('TABLE TR:last-child, TABLE TD:last-child, TABLE TH:last-child').addClass('last-child');
	$('TABLE TR:even, TABLE TD:even, TABLE TH:even').addClass('nth-child-even');
	$('TABLE TR:odd, TABLE TD:odd, TABLE TH:odd').addClass('nth-child-odd');
 
});