/** 
 * check for flash plugin initially 
 */
window.hasFlash = swfobject.hasFlashPlayerVersion("9.0.0");

/**
 * initialize spotlight and subnavigation dropdowns (suckerfish)
 * rewritten for use with prototype
 */
 
function suckerFish(target) {
    debug('suckerfish init: #' + target);
    var topNavElem = $$('#' + target + '>li');
    topNavElem.each( function (item,index) {
        debug('topNavElem', index, ' toString: ',item);
        item.observe('mouseover', function (event) {
            this.addClassName('over');
        });
        item.observe('mouseout', function (event) {
            this.removeClassName('over');
        });
    });
    debug('suckerfish init complete');
}

/**
 * add search tracking parameter
 */
function addWToss(form) {
    dcsMultiTrack("WT.oss", form.q.value);
    return true;
}

// set the focus on the search query field
document.observe('dom:loaded', function(){
    if ($('nav')) suckerFish('nav');
    if ($('nav2')) {
        suckerFish('nav2');
        $$('#nav2 li.last ul')[0].observe('mouseover', function(){
            $('q').focus();
        });
    }
    
    debug('before spotlightMovie init ', window.spotlightMovies);
    //return now, when no spotlightmovies are present.
    if (window.spotlightMovies.length === 0) { return; }

    //create SpotlightVideos
    spotlightMovies.each( initSpotLightVideo );
    // debug('after spotlightMovie init');

    function initSpotLightVideo( data, index ) {
            // debug('movie[' + index + ']', data);
            new SpotLightVideo(data);
    }
});

//get snippets of text for use in JavaScripts
function snippet(term) {
    return snippetArr[term];
}

//QUESTION: what's this for?
try {
    document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

