﻿// Sidekicks - A somewhat awkward script that controls the animated/static marker on the side navigation.
// if file are kept to the current naming convention, this script should continue to work properly.

var currentPage = document.location.href;
var sideNav_marker = document.getElementById('sideNav_marker');
var sideNav_marker_static = document.getElementById('sideNav_marker_static');

    //the first part takes care of the main areas and uses the animated marker
    if (currentPage.match("recipesHome.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '4px';
            sideNav_marker.style.left = '50px';  
    }else if (currentPage.match("dinner_planning.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '80px';
            sideNav_marker.style.left = '50px';         
    }else if (currentPage.match("family_dinner.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '157px';
            sideNav_marker.style.left = '50px';  
    }else if (currentPage.match("time_savers.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '230px';
            sideNav_marker.style.left = '50px';    
    }else if (currentPage.match("healthy_eating.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '305px';
            sideNav_marker.style.left = '50px';     
    }else if (currentPage.match("products.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '368px';
            sideNav_marker.style.left = '50px';  
    }else if (currentPage.match("news.aspx")) {
            sideNav_marker.style.display = 'block';
            sideNav_marker_static.style.display = 'none';
            sideNav_marker.style.top = '350px';
            sideNav_marker.style.left = '50px';  
            
    //the second part takes care of the sub-areas and uses a static marker     
    }else if (currentPage.match("product")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/products.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '368px'
            sideNav_marker_static.style.left = '50px'; 
    }else if (currentPage.match("planner")||currentPage.match("dinner_article")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/dinner_planning.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '80px';
            sideNav_marker_static.style.left = '50px';  
    }else if (currentPage.match("family")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/family_dinner.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '157px';
            sideNav_marker_static.style.left = '50px'; 
    }else if (currentPage.match("time")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/time_savers.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '230px';
            sideNav_marker_static.style.left = '50px';  
    }else if (currentPage.match("healthy")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/healthy_eating.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '305px';
            sideNav_marker_static.style.left = '50px'; 
    }else if (currentPage.match("recipes")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/recipesHome.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '4px';
            sideNav_marker_static.style.left = '50px';  
    }else if (currentPage.match("news")) {
            sideNav_marker_static.onclick = function(){
                location.href = "/news.aspx";
            };
            sideNav_marker.style.display = 'none';
            sideNav_marker_static.style.display = 'block';
            sideNav_marker_static.style.top = '350px'; 
    }else{
            sideNav_marker_static.style.display = 'none';  
            sideNav_marker.style.visibility = 'hidden';
            sideNav_marker.style.display = 'block'             
    }

