function BoxShift() {
    // controlling the containers
    // requires jquery (obviously)
    var self = this;
    this.doAction = new DoAction();

    
    // about, location, home, menu, love
    this.curr_view = "home";
    var curr = $('#home');
    
    var siteOrder = new Array("about", "location", "home", "menu", "love");
    
    var currLocNum = 2; 	// since we're starting off at home
    
    var shifting = new Boolean(false);    
    
    this.show = function() {
        
        $(curr).stop(true, true).animate({ opacity: 1 }, 800, function() {
            curr.appendTo('#focus');
        });

    }

    this.scrollSection = function (p_scrollSection) {
        // If there actually is a section of the given id...
        var section = p_scrollSection.split('/')[0];
        // track a spotlight analytics event for the page view
        var spotlight = new Spotlight();
        spotlight.track(section.replace('#',''));

        if ($(section).length) {
            wasInnerSection = true;
            // this gets passed an ID with the # symbol
            // $('html,body').animate({ scrollTop: $(section).offset().top - 125 }, 500);
            $('html,body').animate({ scrollTop: $(section).offset().top - 125 }, 500, function () {

            });

            //run do action after animation is complete
            var action = p_scrollSection.split('/')[1];
            if (action !== null) {
                setTimeout(function () {self.doAction.execute(p_scrollSection.replace('#', ''));}, 500);
            };

        }
    }

    this.shift = function (p_dir, p_steps, p_scrollSection) {
        var next_view;
        var pixel_shift;
       
        if (p_dir == 'left') {
            next_view = view_handler(self.curr_view, 'left', p_steps);
            pixel_shift = '+=' + (920 * p_steps);
        }

        if (p_dir == 'right') {
            next_view = view_handler(self.curr_view, 'right', p_steps);
            pixel_shift = '-=' + (920 * p_steps);
        }



        if (next_view.string != self.curr_view) {

            var j = $(curr).queue("fx");
            var r = $(next_view.obj).queue("fx");
            var n = $('#wide_container').queue("fx");

            try {
                var total_queue = j.length + r.length + n.length;
            } catch (err) {
                var total_queue = 0;
            }


            // is there anything in the fx queue?
            if (total_queue == 0 && shifting == false) {

                shifting = true;

                // version 2.0 rewrite
                $('html, body').animate({ scrollTop: 0 }, 500);
                
                // hide the top nav menu
                $('#focus_container .topNavigation').animate({ opacity: 0 }, 500);
                $('#wide_container .topNavigation').animate({ opacity: 0 }, 10);
                
                $(curr).animate({ opacity: 0.50 }, 800, function () {
                    $(this).appendTo('#wide_container');

                    $('#wide_container').animate({ left: pixel_shift }, 700, function () {
                        $(next_view.obj).delay(100).animate({ opacity: 1 }, 500, function () {
                            $(this).appendTo('#focus');
                            
                            self.curr_view = next_view.string;
                            curr = next_view.obj;
                            currLocNum = siteOrder.findIndex(self.curr_view);

                            // track a spotlight analytics event for the page view
                            var spotlight = new Spotlight();
                            spotlight.track(self.curr_view);

                            // If the passed url is for the about or menu sections, and has a second 
                            // parameter, don't reset the location bar url.
                            // if (-1 != window.location.hash.indexOf('about/')) {
                            //     showModalContent(window.location.hash.substr(8), '/about');
                            // }
                            if (-1 != window.location.hash.indexOf('menu/')) {
                                showMenuContent(window.location.hash.substr(7));
                            }

                            //if the url has a second parameter use it
                            if (p_scrollSection != null) {
                                window.location.hash = '/' + self.curr_view + '/' + p_scrollSection.replace("#", ""); 
                            } else {
                                window.location.hash = '/' + self.curr_view;
                            }
                            
                            // show the top nav menu
                            $('#focus_container .topNavigation').animate({ opacity: 1 }, 500);

                            // everything is done, we can animate again if we want
                            shifting = false;

                            // do we then want to scroll down to a specific section?
                            if (p_scrollSection != null) {

                                p_scrollSection = p_scrollSection.indexOf('#') == -1 ? '#' + p_scrollSection : p_scrollSection;

                                self.scrollSection(p_scrollSection);
                            }

                            // make any change to the map iframe so that it shows again in IE - this is really wierd.
                            $('#iframeMap').css('this_attribute', 'fixes_everything_in_ie');

                        });

                    });

                    // Make the current navigation item 'active'
                    $('#navMenu .active, #mainFootLinks .active').removeClass('active');

                    // Track a google analytics pageview
                    _gaq.push(['_trackPageview', '/#/' + next_view.string]);

                    switch (next_view.string) {
                        case 'about':
                            $('#aboutClick, #mainFootLinks .about').addClass('active');
                            break;

                        case 'location':
                            $('#restaurantClick, #mainFootLinks .restaurant').addClass('active');
                            break;

                        case 'home':
                            $('#homeClick,  #mainFootLinks .home').addClass('active');
                            break;

                        case 'menu':
                            $('#menuClick, #mainFootLinks .menu').addClass('active');
                            break;

                        case 'love':
                            $('#moreClick,  #mainFootLinks .more').addClass('active');
                            break;
                    }
                });

            } // end total_queue
        }



    }

    view_handler = function (p_view, p_shift, p_steps) {
        // p_view is the current view
        // send this function which way it is shifting (ex. p_shift == 'left')
        // and it will return what the new view will be (ex. menu)
        //alert('view handler: ' + p_view + '  ' + p_shift + ' ' + p_steps);
        var new_view;
        var new_html;

        if (p_shift == 'right') {
            // check to see if we'll be off the edge
            if ((siteOrder.findIndex(p_view) + p_steps) >= siteOrder.length) {
                new_view = p_view;
            } else {
                new_view = siteOrder[siteOrder.findIndex(p_view) + p_steps];
            }
        }

        if (p_shift == 'left') {
            // check to see if we'll be off the edge
            if ((siteOrder.findIndex(p_view) - p_steps) < 0) {
                new_view = p_view;
            } else {
                new_view = siteOrder[siteOrder.findIndex(p_view) - p_steps];
            }
        }


        // When a box gets shifted, stop all of the sliders. Don't worry, they get started again
        // below once we figure out what page we're going to.
        if (typeof (homeSlider) === 'object') {
            homeSlider.stop();
        }

        if (typeof (menuPromoSliderObj) === 'object') {
            menuPromoSliderObj.stop();
        }

        if (typeof (dumbSliderObj) === 'object') {
            dumbSliderObj.stop();
        }

        $('#clickBlockRight').css('display', 'block');
        $('#clickBlockLeft').css('display', 'block');


        switch (new_view) {

            case 'home':
                // We only start this home page slider because it gets loaded by when the site loads
                homeSlider.start();
                new_html = $('#home');
                break;

            case 'location':
                new_html = $('#location');
                break;

            case 'menu':
                new_html = $('#menu');

                // Load/start the slider when the page is navigated to
                if (typeof (menuPromoSliderObj) === 'undefined') {
                    menuPromoSliderObj = new MakeSlider('menuPromoSlider');
                } else {
                    menuPromoSliderObj.start();
                }
                break;

            case 'about':
                new_html = $('#about');
                $('#clickBlockLeft').fadeOut(500, function () {
                    $('#clickBlockLeft').css('display', 'none');
                });

                break;

            case 'love':
                new_html = $('#love');
                $('#clickBlockRight').fadeOut(500, function () {
                    $('#clickBlockRight').css('display', 'none');
                });

                // Load/start the slider when the page is navigated to
                if (typeof (dumbSliderObj) === 'undefined') {
                    dumbSliderObj = new MakeSlider('dumbSlider');
                } else {
                    dumbSliderObj.start();
                }
                break;
        }

        return { 'string': new_view, 'obj': new_html };

    }
    
    this.jump_calc = function(p_section) {

    	// p_section is the name of the section we want to go to,
    	// this will calculate how many jumps we need to go in, and what direction
    	var direction = 'none';
    	
    	new_section_pos = siteOrder.findIndex(p_section);
    	num_steps = new_section_pos - currLocNum;
    	
    	if(num_steps > 0) {
    		direction = 'right';
    		num_steps = Math.abs(num_steps);
    	} else {
    		direction = 'left';
    		num_steps = Math.abs(num_steps);
    	}
    	
    	return { 'dir': direction, 'steps': num_steps };
    }    
    
}
