var scrolly;
function toggleMenu(){


	if($(this).hasClass('menuopen')){
		return false;
	}
	$('.menuopen')
	.removeClass('menuopen')
	.parent('div')
	.stop()
	.animate({width:"20px"});

	$(this)
	.addClass('menuopen')
	.parent('div')
	.stop()
	.animate({width:"140px"});


};

$(function(){
	$('.hassubnav a.navlink')
	.hover(
		toggleMenu
	);


	$('ul.subnav li a.subnavactive')
	.closest('div')
	.css({'width':'140px'});

	$('.navactive').addClass('menuopen');

	$('.menuopen')
	.parent('div')
	.css({width:"140px"});

	$('.navactive').each(function(){
		if(navigator.appName=='Microsoft Internet Explorer'){
			var bgy=$(this).css('background-position-y');
			$(this).css({'background-position-y':bgy+' -73px !important'});

		}else{
			var bgy=$(this).css('background-position').split(' ')[0];
			$(this).css({'background-position':bgy+' -73px !important'});
		}
	});



});
var x,api,makeArrows;
function makeArrows(){
	if($('#arrows').length == 0){
		if(api.getIsScrollableV()){
			$('.content').append('<div id="arrows"><span id="up"></span><span id="down"></span></div>');
		}
		$('#up').mousehold(200,function(){
			api.scrollByY(-100);
		});
		$('#down').mousehold(200,function(){
			api.scrollByY(100);
		});
		$('div.jspVerticalBar').hide();
		api.reinitialise();
	}
};
$(window).load(function(){
// 	$('.position').click(makeScroller);
    $('#logo').wrap('<a id="logowrap" href="/index.html" />');


	if($('#scrollcontent').jScrollPane){
		scrolly = $('#scrollcontent').jScrollPane({autoReinitialise:true, animateScroll:true});
		api=scrolly.data('jsp');

		makeArrows();
	}

	if($.uniform){
		$('input:text,, input:file, textarea, input:submit').uniform();
	}
// 	$('#scrollcontent').bind('mousewheel', function(event, delta){
// 		if(delta > 0){
// 			$('#scrollcontent').stop().scrollTo('-=120px',200);
// 
// 		}else{
// 			$('#scrollcontent').stop().scrollTo('+=120px', 200);
// 		}
// 	});
});



