$(document).ready(function() {

		var queryhash = window.location.hash;
		switch (queryhash) {
			case "#about": 	
					seamlessNavigation("about", true);
			break;
			case "#projects":
					seamlessNavigation("projects", true);
			break;
			//case "#resume":
			//		seamlessNavigation("resume", true);
			//break;
			case "#contact":
					seamlessNavigation("contact", true);
			break;
			default:
					seamlessNavigation("about", true);
			break;
		} 


			$("#nav-about").click(function() {			
				return seamlessNavigation("about");
			});

			$("#nav-projects").click(function() {	
				return seamlessNavigation("projects");
			});			
			
			/*$("#nav-personal").click(function() {
				document.title = "jonathanhersh dot com → Personal";
				return seamlessNavigation("personal");
			})*/

			$("#nav-contact").click(function() {
				return seamlessNavigation("contact");
			});
			
			$("#nav-contact2").click(function() {
				//document.title = "jonathanhersh dot com → contact";
				//$("#topNavigation li a").removeClass('underlined');	
				//$("#contact").addClass('underlined');
				return seamlessNavigation("contact");
			});
			
			$("#nav-projects2").click(function() {
				//document.title = "jonathanhersh dot com → contact";
				//$("#topNavigation li a").removeClass('underlined');	
				//$("#contact").addClass('underlined');
				return seamlessNavigation("projects");
			});
			
			if (navigator.appVersion.indexOf("MSIE 7.0") == -1 && navigator.appVersion.indexOf("MSIE 8.0") == -1) {			
	        	$(document).pngFix(); 		
	        	
	        }
	        
	        
	        //setTimeout("taglineTimer();", 5000 );
});


function seamlessNavigation(id, initial){
					
				if (id == undefined) {
					id = "about";
				}
				
				if (initial == true) {
					$("div#about").hide();
				}
				
				
				
				if (!$("div#flyingWindow").hasClass(id)) {
				
					$("div#flyingWindow").removeClass();
					$("div#flyingWindow").addClass(id);
				
				//if( window.location.contains('calculator') != true ) {
					//$("div#content").slideUp(500);
					//$(".active").fadeOut(500);
					//setTimeout("$('.active').hide();", 500);	
					
					$('.active').hide();						
					
					$('.active').removeClass('active');
					$('div#'+id).addClass('active');
					
					
					
					$("div#"+id).fadeIn(175);
					//$("div#"+id).show();
					setFactoid();
					
					$("#project").hide(5000);
					
					//setTimeout("$('div#"+id+"').show();", 500); 				
					//$('#content').slideDown('500');
				//}
					
					$("#topNavigation li a").removeClass('underlined');
					$("#" + id).addClass('underlined');
					
					if( window.location.href.indexOf('calculator') != -1)
						document.title = 'jonathan her.sh → CMU QPA Calculator';
					else
						document.title = "jonathan her.sh → "+ id;
					
					//setTagline();
					
				} else {return false;};
				
				return true;
				
};