$(function () {
		
		var currentURL = new String();
		if(jQuery.url.segment(0) == null){
			currentURL = 'index';
		}
		else{
			currentURL = jQuery.url.segment(0);
		}
		$('.'+currentURL+'').addClass('selected');
		$('#header').addClass('color-'+currentURL+'');
		$('#logobg').addClass('color-'+currentURL+'');

	        var img = new Image();
        $(img).load(function () {
            //$(this).css('display', 'none'); // .hide() doesn't work in Safari when the element isn't on the DOM already
            $(this).hide();
            $('#img-3col').removeClass('loading').append(this);
			$('#img-2col').removeClass('loading').append(this);
            $(this).fadeIn();
        }).attr('src', '/theme/Rapid2010/img/'+currentURL+'img_01.png').addClass('img-'+currentURL)
		
    });

$(function() {
$('#nav ul li')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -127px)"}, {duration:150})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:150})
		})
});

$(function() {
$('.selected')
		.css( {backgroundPosition: "0 -127px"} )
		
		.animate({marginTop: "-5px"}, 100)
		
		.mouseover(function(){
			$(this).stop().animate({marginTop: "-5px"}, 100)
		})
		.mouseout(function(){
			$(this).stop().animate({marginTop: "-5px"}, 100)
		})
});
