/**
 * Dependency, jquery-1.2.6.js
 * Dependency, Framework.js
 * Not a class, but is the entry point for page specific javascript.
 */
var EA = new Object();

/**
 * DOM ready function. This function will fire when the DOM has been loaded. This function
 * is normally fired before all images have been loaded.
 */
$(function(){
	
	EA.framework = new Framework();
	EA.topPicksTabs = new TabView("topPicks", 0);
	EA.topPicksLists = new TopPicksList("topPicksList", "test_feeds", config.feeds);
	
	EA.framework.setupSearch();
	EA.framework.buildAccordions();
	
	buildFlashComponents();
	
	//preload topPicksLists JSON after all other critical JS has executed.
	EA.topPicksLists.preloadJSON();
	
	
	
});

/**
 * Builds the two main Flash components on the homepage (EP and Carousel)
 */
function buildFlashComponents() {
	
	var min_flash_version	= '9.0.115';
	var expressInstall_swf	= 'swf/expressInstall.swf';
	
	// Features
	var feature_swf			= 'swf/editorial.swf';
	var feature_container	= 'featureHolder';
	var feature_width		= '740';
	var feature_height		= '350';
	var feature_flashvars	= {configFile: config.featureConfig, slideDelay:6000};
	var feature_params		= {wmode: 'opaque'};
	var feature_attributes	= {};
	
	// Carousel
	var carousel_swf		= 'swf/carousel.swf';
	var carousel_container	= 'carouselHolder';
	var carousel_width		= '710';
	var carousel_height		= '165';
	var carousel_flashvars	= {configFile: config.carouselConfig};
	var carousel_params		= {wmode: 'opaque'};
	var carousel_attributes	= {};
	
	swfobject.embedSWF(feature_swf, feature_container, feature_width, feature_height, min_flash_version, expressInstall_swf, feature_flashvars, feature_params, feature_attributes);
	
	// Apply slight delay to ensure that EP is drawn into view before carousel
	setTimeout(function() {
		swfobject.embedSWF(carousel_swf, carousel_container, carousel_width, carousel_height, min_flash_version, expressInstall_swf, carousel_flashvars, carousel_params, carousel_attributes);
	}, 1500)
	
}