// JavaScript Document


$(document).ready(function (){
	
							
	if(isLoadAbout()){
		 $("#aboutBar").hide();
		$("#changeBarBlue").show();
		$("#changeBarGrey").hide();
		$("#changeBarPink").hide();
		$("#changeBarYellow").hide();
	}
	 if(isLoadResume()){
		 $("#changeBarPink").show();
		 $("#aboutBar").hide();
		 $("#resumeBar").hide();
		$("#changeBarBlue").hide();
		$("#changeBarGrey").hide();
		$("#changeBarYellow").hide();
	}
	if(isLoadContact()){
		$("#changeBarBlue").hide();
		$("#changeBarGrey").hide();
		$("#changeBarPink").show();
	}
  
  if(isLoadWork()){
		 $("#aboutBar").show();
		$("#changeBarBlue").hide();
		$("#changeBarGrey").show();
		$("#changeBarPink").hide();
		$("#changeBarYellow").hide();
	}
});




function isLoadAbout() {
  var url = document.location.hash;
  var aboutUrl = "#aboutLink"
  return (url >= aboutUrl);
}

function isLoadResume() {
  var url2 = document.location.hash;
  var resumeUrl = "#resumeLink"
  return (url2 >= resumeUrl);
}

function isLoadContact() {
  var url3 = document.location.hash;
  var contactUrl = "#contactLink"
  return (url3 >= contactUrl);
}
function isLoadWork() {
  var url4 = document.location.hash;
  var workUrl = "#workLink"
  return (url4 >= workUrl);
}

$(window).scroll(function(){
  if(isScrollAbout()){
    $("#aboutBar").hide();
	$("#changeBarBlue").show();
	$("#changeBarGrey").hide();
	$("#changeBarPink").hide();
	$("#changeBarYellow").hide();
}
  else if(isScrollAboutBack()){
    $("#aboutBar").show();
	$("#changeBarBlue").hide();
	$("#changeBarGrey").show();
	$("#changeBarPink").hide();
	$("#changeBarYellow").hide();
}

 if(isScrollResume()){
	 $("#changeBarPink").show();
	 $("#aboutBar").hide();
	 $("#resumeBar").hide();
	$("#changeBarBlue").hide();
	$("#changeBarGrey").hide();
	$("#changeBarYellow").hide();
}

 else if(isScrollResumeBack()){
	 $("#changeBarPink").hide();
	 $("#resumeBar").show();
	$("#changeBarBlue").show();
	$("#changeBarYellow").hide();
}

 if(isScrollContact()){
	 $("#changeBarYellow").show();
	 $("#contactBar").hide();
	$("#changeBarBlue").hide();
	$("#changeBarGrey").hide();
	$("#changeBarPink").hide();
}

 else if(isScrollContactBack()){
	 $("#changeBarYellow").hide();
	 $("#contactBar").show();
	$("#changeBarPink").show();
		
}
  
  
});


function isScrollAbout() {
  var documentHeight = $(document).height();
  var scrollPosition = $(window).scrollTop();
	documentHeight = documentHeight*.79;
  return (documentHeight <= scrollPosition);

}

function isScrollAboutBack() {
 var documentHeight = $(document).height();
  var scrollPosition = $(window).scrollTop();
	documentHeight = documentHeight*.79;
  return (documentHeight >= scrollPosition);
}

function isScrollResume() {
  var documentHeight2= $(document).height();
  var scrollPosition2 = $(window).scrollTop();
	documentHeight2 = documentHeight2*.849;
  return (documentHeight2 <= scrollPosition2);

}


function isScrollResumeBack() {
  var documentHeight2= $(document).height();
  var scrollPosition2 = $(window).scrollTop();
	documentHeight2 = documentHeight2*.849;
  return (documentHeight2 >= scrollPosition2);

}


function isScrollContact() {
  var documentHeight2= $(document).height();
  var scrollPosition2 = $(window).scrollTop();
	documentHeight2 = documentHeight2*.927;
  return (documentHeight2 <= scrollPosition2);

}


function isScrollContactBack() {
  var documentHeight2= $(document).height();
  var scrollPosition2 = $(window).scrollTop();
	documentHeight2 = documentHeight2*.927;
  return (documentHeight2 >= scrollPosition2);

}