/**
 * Dependency, jquery-1.2.6.js
 * Dependency, Framework.js
 * Not a class, but is the entry point for page specific javascript.
 */

/**
 * 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(){
	var EA = new Object();
	EA.framework = new Framework();
	EA.productFeatures = new TabView("productFeatures", 0);
	EA.productFeatures = new TabView("productDetails", 0);
	
	EA.framework.setupSearch();
	EA.framework.buildAccordions();
	
	buildFlashComponents();
	
	setupRating('#');
	
});

/**
 * Builds the main Flash components (video player gallery)
 */
function buildFlashComponents() {
	
	var min_flash_version		= '9.0.115';
	var expressInstall_swf		= 'swf/expressInstall.swf';
	
	// Video Demo
	var videodemo_swf			= 'swf/mediaplayer.swf';
	var videodemo_container		= 'videoDemoHolder';
	var videodemo_width			= '99';
	var videodemo_height		= '113';
	var videodemo_flashvars		= {mediaFile: config.videodemo, loopPlayback: 'true'};
	var videodemo_params		= {wmode: 'opaque', scale: 'noscale', salign: 'tl'};
	var videodemo_attributes	= {width: '99', height: '113'};
	
	// Video Gallery
	var videogallery_swf		= 'swf/videogallery.swf';
	var videogallery_container	= 'videoGalleryHolder';
	var videogallery_width		= '730';
	var videogallery_height		= '340';
	var videogallery_flashvars	= {configFile: config.videogallery};
	var videogallery_params		= {wmode: 'opaque'};
	var videogallery_attributes	= {};
	
	swfobject.embedSWF(videogallery_swf, videogallery_container, videogallery_width, videogallery_height, min_flash_version, expressInstall_swf, videogallery_flashvars, videogallery_params, videogallery_attributes);
	swfobject.embedSWF(videodemo_swf, videodemo_container, videodemo_width, videodemo_height, min_flash_version, expressInstall_swf, videodemo_flashvars, videodemo_params, videodemo_attributes);
	
}

/**
 * Sets up the interactive star rating. Set this url in the constructor to the url of the star rating api.
 */
function setupRating(url){
	$('#rate1').rating(url, {
		curvalue: config.stars,
		maxvalue: 5,
		increment: 1
	});
}
