jQuery(document).ready(function( $ ) {

	if (window.globalStorage && window.postMessage) {
		$('body').addClass('firefox');
	}
	
	var winWidth = $(window).width();
	if (screen.width<=320) {
		$('body').addClass('smart-portrait');
	}
	if ((winWidth>=321) && (winWidth<=480)) {
		$('body').addClass('smart-landscape');
	}
	if(winWidth>=481) {
		$('body').addClass('lg-screen');
	}
	
	$('#platinum').bxSlider({
	    mode: 'fade',
	    auto: true,
	    pager: true,
	    controls: false,
	    pause: 5000
	  });
	  
	 $('#gold').bxSlider({
	     mode: 'fade',
	     auto: true,
	     pager: true,
	     controls: false,
	     pause: 5000
	   })
	   
	 $('#silver').bxSlider({
	     mode: 'fade',
	     auto: true,
	     pager: true,
	     controls: false,
	     pause: 5000
	   })
	   
	   
	 /* ---- Scroll Nav ----- */
	 
	 $('a[href*=#]').bind('click',function(event){
	 		var $anchor = $(this);
	 		
	 		var href =$anchor.attr('href');
	 		
	 		if(href == '#top') {
		 		$('html, body').stop().animate({
		 			scrollTop: 0
		 		}, 1000);
	 		} else {
		 		$('html, body').stop().animate({
		 			scrollTop: $($anchor.attr('href')).offset().top
		 		}, 1000);
	 		}
	 		
	 		event.preventDefault();
	 	});
	   	   
	 var scroll = null;
	 $(window).scroll(function() {
	 	scroll = $(window).scrollTop();
	 	console.log(scroll);
	 	
	 	if(scroll >= 740) {
	 		$('.lg-screen .back-nav').fadeIn(500, function() {
	 			$(this).addClass('side-active');
	 		});
	 	} else {
	 		$('.lg-screen .back-nav').fadeOut(500, function() {
	 			$(this).removeClass('side-active');
	 		});
	 	}
	 	
	 	if(scroll >= 450 && scroll <= 740) {
	 		$('.lg-screen .sponsor-nav').fadeIn(500, function() {
	 			$(this).addClass('side-active');
	 		});
	 	} else {
	 		$('.lg-screen .sponsor-nav').fadeOut(500, function() {
	 			$(this).removeClass('side-active');
	 		});
	 	}
	 	
	 	if(scroll >= 740) {
	 		$('.lg-screen .register-nav').fadeIn(500, function() {
	 			$(this).addClass('side-active');
	 		});
	 	} else {
	 		$('.lg-screen .register-nav').fadeOut(500, function() {
	 			$(this).removeClass('side-active');
	 		});
	 	}
		 
		 if(scroll >= 1380) {
		 	$('.lg-screen .about-nav').fadeIn(500, function() {
		 		$(this).addClass('side-active');
		 	});
		 } else {
		 	$('.lg-screen .about-nav').fadeOut(500, function() {
		 		$(this).removeClass('side-active');
		 	});
		 }
		 
		 /* Smartphone Portrait */
		 
		 if(scroll >= 578) {
		 	$('.smart-portrait #scroll-nav').fadeIn();
		 	$('.smart-portrait .back-nav').fadeIn(500, function() {
		 		$(this).addClass('side-active');
		 	});
		 } else {
		 	$('.smart-portrait #scroll-nav').fadeOut();
		 	$('.smart-portrait .back-nav').fadeOut(500, function() {
		 		$(this).removeClass('side-active');
		 	});
		 }
		 
		 if(scroll >= 578 && scroll <= 2395) {
		 	$('.smart-portrait .sponsor-nav').fadeIn(500, function() {
		 		$(this).addClass('side-active');
		 	});
		 } else {
		 	$('.smart-portrait .sponsor-nav').fadeOut(500, function() {
		 		$(this).removeClass('side-active');
		 	});
		 }
		 
		 if(scroll >= 910) {
		 	$('.smart-portrait .register-nav').fadeIn(500, function() {
		 		$(this).addClass('side-active');
		 	});
		 } else {
		 	$('.smart-portrait .register-nav').fadeOut(500, function() {
		 		$(this).removeClass('side-active');
		 	});
		 }
		 
		 if(scroll >= 2075) {
		 	$('.smart-portrait .about-nav').fadeIn(500, function() {
		 		$(this).addClass('side-active').text('About');
		 		$('.smart-portrait .back-nav').text('Top');
		 	});
		 } else {
		 	$('.smart-portrait .about-nav').fadeOut(500, function() {
		 		$(this).removeClass('side-active');
		 		$('.smart-portrait .back-nav').text('Back to Top');
		 	});
		 }
		 
	 });
	 
	 
	
});
