﻿function VidBG(vid) {
    switch (vid) {
        case "col":
            $().ready(function () {
                $('body').tubular('9XOCTWqLD48', 'BGWrapper'); // where someYTid is the YouTube ID and wrapper is your containing DIV.
            });
            break;

        case "gen":
            $().ready(function () {
                $('body').tubular('1yrIx1ARbGE', 'BGWrapper'); // where someYTid is the YouTube ID and wrapper is your containing DIV.
            });
            break;
        default:
    }

}

var NavState = "out"
function ToggleNav() {

    switch (NavState) {
        case "out":
            $('#NavWrapper').animate({
                opacity: 0.25,
                left: '+=-200'
            }, 1000, function () {
                // Animation complete.
            });

            $('.GRAV80Lines').animate({
                left: '+=100'
            }, 1000, function () {
                // Animation complete.
            });

            $('.GRAV80LinesAlt').animate({
                right: '+=200'
            }, 1000, function () {
                // Animation complete.
            });

            NavState = "in"
            break;
        case "in":
            $('#NavWrapper').animate({
                opacity: 1,
                left: '+=200'
            }, 1000, function () {
                // Animation complete.
            });

            $('.GRAV80Lines').animate({
                left: '+=-100'
            }, 1000, function () {
                // Animation complete.
            });

            $('.GRAV80LinesAlt').animate({
                right: '+=-200'
            }, 1000, function () {
                // Animation complete.
            });

            NavState = "out"
            setTimeout("CloseNav();", 15000);
            break;
    }
}

function CloseNav() {
    $(document).ready(function () {
        if (NavState == "out")
            setTimeout("ToggleNav();", 5000);
    });
}

$(document).ready(function () {
    if (NavState == "out")
        CloseNav();
});
