/*** homenav control ***/
af.home = new (function(){
	this.homenav = {
			
		navbtns : null,
		views : null,
		lastView : null,
		nextView : null,
		
		init : function(){
			this.navbtns = $af('.homenav a');
			this.views = $af('.home-view');
			this.lastView = this.views[0];
			
			$af(this.navbtns).each(function(index){
				$af(this).click(function(e){
					e.preventDefault();
					this.nextView = af.home.homenav.views[index];
					$af(af.home.homenav.lastView).hide();
					var navbtns = af.home.homenav.navbtns;
					for(var i=0; i<navbtns.length; i++){
						$af(navbtns[i]).parent().removeClass('homenav-on');
					};
					$af(this).parent().addClass('homenav-on');
					if(document.all){
						$af(this.nextView).show();
						af.home.homenav.lastView = this.nextView;
					} else {
						$af(this.nextView).delay('fast').fadeTo('fast', 1, function(){
							af.home.homenav.lastView = this;
						});
					}
				});
			});
			
		}
	};
	
});

$af(document).ready(function(){
	af.home.homenav.init();
});
