$(document).ready(function() {
	// Preload all rollovers
	$("a.rollover img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"-over.gif");
		$("<img>").attr("src", rollON);
	});
	// //
		
		
	// Navigation rollovers
	$("a.rollover").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/-over/);
		// don't do the rollover if state is already ON
		if (!matches) {
		imgsrcON = imgsrc.replace(/.gif$/ig,"-over.gif"); // strip off extension
		$(this).children("img").attr("src", imgsrcON);
	}
	});
	$("a.rollover").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	// //
	

/*	// Equal height columns
	var $els = $(".content, .nav1sub").equalizeCols();

	// requires jquery.onfontresize.js
	$(document).bind("fontresize", function () {
		$els.equalizeCols();
	});
*/
	//$(".nav1sub").css("height", $(".nav1sub").height() - 50);
	// //


	// Watch equal height columns lower that 300, set to 300
	$(".nav1sub").css("height", ($(".nav1sub").height() -300 ) );
	if ($(".nav1sub").height() < 300) {
		$(".nav1sub").css("height", 300);
	}
	// //

	// Alternating row colors for tables
	$('table.Fleet-tabell-strek tbody tr:odd').addClass('odd');
	$('table.Fleet-tabell-strek tbody tr:even').addClass('even');
	// END: Alternating row colors for tables


	// Create popupwindows for Print Page links
	$('A[rel="printpage"]').click( function() {
		window.open( $(this).attr('href'), 'Printwindow','width=640,height=800,location=no, menubar=no, resizable=no, status=no, toolbar=no, directories=no, scrollbars=yes' );
        return false;
    });
	// //


	// Add span+class to first word in Slogan
	var words = $('#slogan').text().split(' ');
    $('#slogan').html( '<span class="footer_firstword">'+words.shift()+'</span> '+words.join(' ') );
	// //
	
	// Add odd/even class to fleet elements
	$(".fleetGallery div:odd").addClass("odd");
	$(".fleetGallery div:even").addClass("even");
	
});

