Team:ATOMS-Turkiye/iGEM

var initiateNavigation = function(id){

   $("#"+id).addClass("current-top-nav");
   $(".nav-item.active").removeClass("active");
   $("#"+id).addClass("active");
   $("#sub-navigation > ul").hide();
   $("#" + id + "-sub").show();
   
   $.fn.xscrolly = function(options, key, value) {
     if (options === 'option') {
       this.data('xscrolly').option(key, value);
     } else {
       options.targets = this;
       this.data('xscrolly', new XScrollY(options));
     }
     return this;

};

};

window.onload = function(){

   //hoverIntent is used for predicting user mouse intentions
   $(".nav-item").hoverIntent(function(){
       $(".nav-item.active").removeClass("active");
       $(this).addClass("active");
       $("#sub-navigation > ul").hide();
       $("#" + this.id + "-sub").show();
   });
   var pathname = window.location.pathname.split("/").pop();

switch(pathname) {

   case "Tour":
       initiateNavigation("tour");
       break;
   case "Problems":
   case "Ulcer":
   case "Cancer_Switch":
   case "Modelling":
   case "Modeling":
   case "Safety":
   case "Future_Plan":
       initiateNavigation("project");
       break;
   case "Results":
       initiateNavigation("results");
       break;
   case "Virtual_Hospital":
   case "SynBio_Day":
   case "Outreach":
   case "Street_Interview":
   case "Video":
       initiateNavigation("pp");
       break;
   case "ATOMs":
   case "Attribitions":
   case "Collaboration":
   case "Official_Team_Profile":
   case "Acknowledgements":
       initiateNavigation("team");
       break;
   case "Notebook":
   case "Protocols":
   case "Achievements":
   case "Official_Part_Page":
       initiateNavigation("extras");
       break;

} };