//----------Init----------//
$(document).ready(function() {
	//nav animation
	if(!$.browser.msie) setTimeout("$('#header .nav').css('opacity', 0).animate({top: 0, opacity: 1}, aniSpeed.slow);", 500);
	else $('#header .nav').animate({top: 0}, aniSpeed.slow, 'easeOutExpo');
	//top banner animation
	$('#topBanner').animate({opacity: 1}, aniSpeed.slow);
	
	topBanner.init();
});

var topBanner = {
	pos: 0,
	max: 2,
	timeout: 7000,
	width: 840,
	cNode: null,
	timer: null,
	init: function() {
		this.cNode = $('#topBanner .roll');
		$('#topBanner .l, #topBanner .r').click(function(){topBanner.move($(this).hasClass('l') ? -1 : 1);});
		topBanner.timer = setTimeout('topBanner.move(1)', topBanner.timeout);
	},
	move: function(pos) {
		clearTimeout(topBanner.timer);
		if(pos > 0) topBanner.pos++;
		else topBanner.pos--;
		if(topBanner.pos < 0) topBanner.pos = topBanner.max;
		else if(topBanner.pos > topBanner.max) topBanner.pos = 0;
		var left = 0 - topBanner.pos * topBanner.width;
		topBanner.cNode.stop().animate({left: left+'px'}, aniSpeed.med, 'easeOutExpo');
		topBanner.timer = setTimeout('topBanner.move(1)', topBanner.timeout);
	}
};

