$(document).ready(function () {
	var msie6 = $.browser == 'msie' && $.browser.version < 7;
	
	if (!msie6){
		var top = $('#subNav').offset().top - parseFloat($('#subNav').css('margin-top').replace(/auto/,0));
		$(window).scroll(function() {
			//y position of the scroll
			var y =$(window).scrollTop();
	
			//below the subNav?
			if (y >= top){
				$('#subNav').addClass('fixed');
			} else {
				$('#subNav').removeClass('fixed');
			}
		})
	}
})

function prepareSubNav(){
// get all subNav links
	$links = $('#subNav a');

// click function
	// break by # to abstract the name
	// hide all star divs
	// show only the clicked star div

	$("#subNav a").click(function(){
		
		var imagePath = $('#content #mainWindow').attr('src');
		var imageNumber= imagePath.split('_')[1].split('.')[0];
		if (imageNumber == 4){
			var nextNumber = 1;
		} else {
			var nextNumber = Number(imageNumber)+1;
		}
		$("#content #mainWindow").attr({
			src: "/images/home/home_" + nextNumber + ".jpg",
			alt: ""
		});
		return false;
	});
	
}
