﻿$(document).ready(function() {

    var zIndexNumber = 1000;
    $('div').each(function() {
        $(this).css('zIndex', zIndexNumber);
        zIndexNumber -= 10;
    });


    var projectType;

    //----------------------------
    // Navigation
    //----------------------------

    var path = location.pathname.substring(1);

    var check = path.substring(0, 12);
    if (check == "milesrisser/") {
        path = path.substring(12);
    }

    $(".inTheNewsSubMenu").hide("fast");

    if (path != "") {
        $('#mainmenu a[href="' + path + '"]').addClass('active');
        $('#subnav a[href="' + path + '"]').addClass('active');
    }
    if (path == "profile.aspx" || path == "history.aspx" || path == "teamapproach.aspx" || path == "clients.aspx") {
        $("#practiceLink").addClass('active');
        $(".submenu").hide("fast");
        $("#practiceSubMenu").show("fast");
        $('#practiceSubMenu a[href="' + path + '"]').addClass('active');
    }
    else if (path == "architecture.aspx" || path == "masterplanning.aspx" || path == "programming.aspx" || path == "projectmanagement.aspx"
            || path == "interiordesign.aspx" || path == "facilitiesassessment.aspx" || path == "digitalcommunication.aspx" || path == "developmentstrategies.aspx") {
        $("#practiceLink").addClass('active');
        $(".submenu").hide("fast");
        $("#practiceSubMenu").show("fast");
        $('#practiceSubMenu a[id="servicesLink"]').addClass('active');
    }
    else if (path == "clients-oklahomacity.aspx" || path == "clients-tulsa.aspx" || path == "clients-dallas.aspx" || path == "clients-houston.aspx") {
        $("#practiceLink").addClass('active');
        $(".submenu").hide("fast");
        $("#practiceSubMenu").show("fast");
        $('#practiceSubMenu a[id="clientsLink"]').addClass('active');
    }
    else if (path == "studio-dallas.aspx" || path == "studio-houston.aspx" || path == "studio-oklahomacity.aspx" || path == "studio-tulsa.aspx") {
        $("#studiosLink").addClass('active');
        $(".submenu").hide("fast");
    }
    else if (path == "career-detail.aspx") {
        $("#careersLink").addClass('active');
        $(".submenu").hide("fast");
    }
    else if (path == "arc-highereducation.aspx" || path == "arc-sciencetechnology.aspx" || path == "arc-ccc.aspx" || path == "arc-hc.aspx" || path == "arc-hos.aspx" ||
    path == "t-arc-ccc-conferencecenter.aspx" || path == "t-arc-ccc-respark.aspx" || path == "t-arc-hc-rehabunit.aspx" || path == "t-arc-highedu-stephensonb.aspx" ||
    path == "t-arc-scitech-ag.aspx" || path == "t-arc-scitech-noble.aspx" || path == "t-arc-scitech-uml.aspx" || path == "t-arc-scitechl-respark.aspx" || path == "t-arc-st-stephenson.aspx"
    ) {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#arcLink").addClass('active');
    }

    else if (path == "plan-corpcommciv.aspx" || path == "plan-hc.aspx" || path == "plan-he.aspx" || path == "plan-hos.aspx" || path == "plan-st.aspx" ||
    path == "t-plan-ccc-conferencecenter.aspx" || path == "t-plan-ccc-respark.aspx" || path == "t-plan-st-respark.aspx"
    ) {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#planLink").addClass('active');
    }
    else if (path == "int-ccc.aspx" || path == "int-hc.aspx" || path == "int-he.aspx" || path == "int-hos.aspx" || path == "int-st.aspx" ||
    path == "t-int-ccc-conferencecenter.aspx" || path == "t-int-ccc-respark.aspx" || path == "t-int-hc-rehabunit.aspx" ||
    path == "t-int-hc-stephenson.aspx" || path == "t-int-st-respark.aspx" || path == "t-int-st-stephenson.aspx"
    ) {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#interiorLink").addClass('active');
    }
    else if (path == "awards.aspx") {
        $("#inTheNewsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#inTheNewsSubMenu").show("fast");
        $("#awardsLink").addClass('active');
    }
    else if (path == "pressRelease.aspx") {
        $("#inTheNewsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#inTheNewsSubMenu").show("fast");
        $("#pressReleaseLink").addClass('active');
    }
    else if (path == "cc.aspx" || path == "cc-benttree.aspx" || path == "cc-cohl.aspx" || path == "cc-phf.aspx" || path == "cc-tccwell.aspx") {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#ccLink").addClass('active');
    }
    else if (path == "hc.aspx" || path == "mc-hc-ouchild.aspx" || path == "mc-hc-rehab.aspx" || path == "mc-hc-willowbrook.aspx") {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#hcLink").addClass('active');
    }
    else if (path == "mf.aspx" || path == "mf-utica.aspx" || path == "mf-loft.aspx") {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#mfLink").addClass('active');
    }
    else if (path == "res.aspx" || path == "res-eastus.aspx" || path == "res-petal.aspx" || path == "res-oak.aspx") {
        $("#projectsLink").addClass('active');
        $(".submenu").hide("fast");
        $("#projectsSubMenu").show("fast");
        $("#resLink").addClass('active');
    }
    else if (path == "ontheboards.aspx" || path == "otb-applehead.aspx") {
        $("#ontheboardsLink").addClass('active');
    }


    //----------------------------
    // Click functions
    //----------------------------
    $(".menuToggle").click(function() {
        $(".menuToggle").removeClass("active");
        $(this).addClass("active");
        $(".submenu").hide("fast");
        $("#" + $(this).attr("mysub")).show("fast");
    });

    $(".subMenuToggle").click(function() {
        $(".subMenuToggle").removeClass("active");
        $(this).addClass("active");
    });

    $(".footerMenuToggle").click(function() {
        $(this).addClass("active");
        $("#inTheNewsSubMenu").hide("fast");
        $("#inTheNewsSubMenu").show("fast");
    });

    //----------------------------
    // Scrolling
    //----------------------------    
    $("#btnDown").mousedown(function() {
        setTimeout(function() {
            scrollDown();
        }, 50);
    }).mouseup(function() {
        $("#container").stop();
    });

    $("#btnUp").mousedown(function() {
        setTimeout(function() {
            scrollUp();
        }, 50);
    }).mouseup(function() {
        $("#container").stop();
    });

    // Toggle feature removed Oct 29 2009
    //    $("#toggleButton").click(function() {
    //        $("#projectHolder").slideToggle("fast");
    //    });


    $('#contentPane').jScrollPane({ scrollbarWidth: 8, scrollbarMargin: 10, showArrows: false, scrollbarOnLeft: true });



    //----------------------------
    // Set column opacity to 80%
    //----------------------------
    $("#contentHolder").css("opacity", "0.85");
    $("#projectHolder").css("opacity", "0.85");
    $("#topWhiteBox").css("opacity", "0.50");
    $("#bottomWhiteBox").css("opacity", "0.50");
});



function scrollUp() {    
    $("#container").stop().animate({
        scrollTop: 0
    }, 1000);
}

function scrollDown() {    
    $("#container").stop().animate({
        scrollTop: $("#scrollContent").height()
    }, 3000);
}

