var $j = jQuery.noConflict();

$j(document).ready(function(){

$j.extend($j.expr[':'],{
    height: function(a,i,m) {
        if(!m[3]||!(/^(<|>)\d+$/).test(m[3])) {return false;}
        return m[3].substr(0,1) === '>' ? 
                 $j(a).height() > m[3].substr(1) : $j(a).height() < m[3].substr(1);
    }
});



$j('#logo').prepend('<span class="grad"></span>');

function animateHeader(){
	$j('span.grad').css({ backgroundPosition: '0px 0px' }).animate({ backgroundPosition: '-160px 0px' }, 20000, 'linear', animateHeader);
}

animateHeader();


$j('#nav a').removeClass('nojs');

$j('#nav a').hover(function(){
	$j(this).stop(true,true).animate({backgroundColor:'#c0c0c0'},'fast').find('span').stop(true,true).animate({height:'show',opacity:'show'},'fast');
},function(){
	if ($j(this).parent('li').hasClass ('active')) {
		$j(this).stop(true,true).animate({backgroundColor:'#ffffff'},'fast').find('span').stop(true,true).animate({height:'hide',opacity:'hide'},'fast');
	} else {
		$j(this).stop(true,true).animate({backgroundColor:'#606060'},'fast').find('span').stop(true,true).animate({height:'hide',opacity:'hide'},'fast');
	}
});


$j('.status:height(>250)').height(200).addClass('collapse').append('<span class="fade" />');

$j('.collapse').hover(function(){
	$j(this).stop(true,false).animate({'height':$j(this).children('.statusContent').outerHeight(true)}, 1000).children('.fade').stop(true,false).fadeOut(1000);
},function(){
	$j(this).stop(true,false).fadeTo(1000, 1).animate({'height':200}, 500).children('.fade').stop(true,false).fadeTo(1000, 1).fadeIn(500);;
});


});


