// Global variable "page_data_json" contains all of the data needed to drive these functions.
// include jQuery first.
jQuery.namespace = function() {
    var a=arguments, o=null, i, j, d;
    for (i=0; i<a.length; i=i+1) {
        d=a[i].split(".");
        o=window;
        for (j=0; j<d.length; j=j+1) {
            o[d[j]]=o[d[j]] || {};
            o=o[d[j]];
        }
    }
    return o;
};

$(document).ready(function() {
    PBS.homepage.setup_famed_tabs();
    PBS.homepage.setup_engage_tabs();
    PBS.homepage.submit_shop_form();
});

jQuery.namespace('PBS.homepage');

PBS.homepage.setup_famed_tabs = function(){
   $("#fam_ed_container > ul").tabs();
   $(".fam_ed_property_heading").addClass('hidden');
};

PBS.homepage.setup_engage_tabs = function(){
   $("#audience_feature > ul").tabs();
   $("#audience_feature .ui-tabs-panel > h3").addClass('hidden');
};

PBS.homepage.submit_shop_form = function(){
    $('#shopform').submit(function(){
        window.location = $(".select option:selected").val();
        return false;
    });
};

/* Enable homepage carousel */
if($("div.carousel ul").size() > 0){
    $("div.carousel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        btnGo: $("a.goto"),
        hoverE: "div.carousel,div.carouselnav",
        circular: true,
        visible: 1,
        speed: 900,
        auto: null,
        autoTimer: false,
        start: 0,
        carouselDiv: "div.carousel ul li.panel"
    });
}

