/**
 * forum/jumpbox.js
 * Functions beginning with an underscore are meant to be internal
 *
 * Dependencies
 * - YUI
 *
 * @author Karen <kziv@gaiaonline.com>
 **/ 
YAHOO.namespace('gaia.app.Forum');

YAHOO.gaia.app.Forum.Jumpbox = function() {}

YAHOO.gaia.app.Forum.Jumpbox.prototype.foo = function() {
    var value = document.jumpbox.f.value;
    var split_string = value.split(" ");
    var new_location = (value == "/") ? ("/forum") : ('/forum/'+split_string[1]+'/f.'+split_string[0]);
    window.location = new_location;
    //document.getElementById('jumpbox').submit();

}

// PAGE INITIALIZATION
YAHOO.util.Event.onDOMReady(init);
function init() {

    var jumper = new YAHOO.gaia.app.Forum.Jumpbox();
    
    // Add jumpbox listener
    if (document.getElementById('jumpbox')) {
        YAHOO.util.Event.addListener('jumpbox-picker', 'change', jumper.foo);
    }
  
}
