function Wowd() {

    this.curr = null;
    this.currView = '';

    this.run = function(view) {
        this.currView = view;
        if (this.currView == 'hot') {
            $("#menu_hotlist").addClass('menusel');
            this.curr = hot;
            hot.onShow();
        } else if (this.currView == 'search') {
            $("#menu_search").addClass('menusel');
            this.curr = search;
            search.onShow();
            search.run();
        } else if (this.currView == 'other') {
            $(".sortopt").hide();
        }
    }

    this.goToHotlist = function() {
        window.location = 'index.jsp';
    }

    this.goToSearch = function() {
        window.location = 'index.jsp?search';
    }

    this.runSearch = function() {
        search.runSearch();
        return false;
    }

    this.init = function() {
        hot.init();
        search.init();

        if (window.location.href.indexOf('?search') >= 0)
            wowd.run('search');
        else if (window.location.href.indexOf('index.jsp') >= 0 || window.location.href.indexOf('jsp') < 0)
            wowd.run('hot');
        else
            wowd.run('other');
    }
}

var wowd = new Wowd();

$(document).ready(function() {
    wowd.init();
});
