//class handles all button and thumbnail functions
var flashSlideShow;  //global object holder for flash slideshow
var arrAutomate = {
		subMenuLeft : 378,
		subMenuSpacing : 12,
		subMenu: [
			{
				title : "Wi-Fi",
				thumbnails : [ 
				],
				heros : [
				],
				contentDiv : "",
				elWidth : 40,
				clickHandler : "loadFlashDetail('1', 'SW_wifi2', 28400);",
				elLeft : 0 //remains blank
			},
			{
				title : "Web",
				thumbnails : [ 
				],
				heros : [
				],
				contentDiv : "",
				elWidth : 35,
				clickHandler : "loadFlashDetail('2', 'SW_web_search', 47500);",
				elLeft : 0 //remains blank
			},
			{
				title : "Correo de voz",
				thumbnails : [ 
				],
				heros : [
				],
				contentDiv : "",
				elWidth : 80,
				clickHandler : "loadFlashDetail('3', 'SW_blink', 36000);",
				elLeft : 0 //remains blank
			},
			{
				title : "Calendario y correo electr&oacute;nico",
				thumbnails : [ 
				],
				heros : [
				],
				contentDiv : "",
				elWidth: 185,
				clickHandler : "loadFlashDetail('4', 'SW_cal_email', 31000);",
				elLeft : 0
			},
			{
				title : "Silenciar sonidos",
				thumbnails : [ 
				],
				heros : [
				],
				contentDiv : "",
				elWidth: 105,
				clickHandler : "loadFlashDetail('5', 'SW_ringer', 43000);",
				elLeft : 0
			}
		]
		
}
/***************************************************************************************************
Slideshow for marketing pages
	Usage:
	objVariable = new slideShow(); //initializes the class
	objVariable.run(); //begin's slideshow
	objVariable.halt(); //stops the slideshow
**************************************************************************************************/
secondaryMenuSlideShow = function(targetMenu) {
	this.slideshowScreenNumber = targetMenu;
	this.autoSlideshow = true;
	this.objSlideShowTimer;
	this.elementCount = arrAutomate.subMenu.length;
}
secondaryMenuSlideShow.prototype.run = function() {
	if(this.autoSlideshow) {
//		console.log(testFlash.IsPlaying());
//		console.log(testFlash.TotalFrames());
		this.slideshowScreenNumber++; //increment to next screen
		if(this.slideshowScreenNumber > this.elementCount) {
			this.slideshowScreenNumber = 1; //reset slide show	
		}
		renderSubmenuScreen(this.slideshowScreenNumber);
	} 
}
secondaryMenuSlideShow.prototype.halt = function() {
	clearTimeout(this.objSlideShowTimer);	
	this.autoSlideshow = false;
	this.slideshowScreenNumber = 1;
}
/******end slideshow stuff******/

var mainFlash;
var testFlash;
loadFlashDetail = function(menuNumber, flashFileName, slideshowDelay) {
	if(Browser.Plugins.Flash.version > 6) {
		mainFlash = new Swiff('flash/'+flashFileName+'.swf', {
			id: 'flashMain',
			width: 475,
			height: 325,
			container : 'heroOverviewLeft',
			params: {
				wmode: 'transparent'
			}
		});	
	} else {
		$('heroOverviewLeft').style.background = 'url(flash/'+flashFileName+'.gif) no-repeat transparent';
	}
	$('textWrapper').innerHTML = $('menu' + menuNumber + 'text').innerHTML;
	if($defined(flashSlideShow)) {
		flashSlideShow.halt();
	}
	flashSlideShow = new secondaryMenuSlideShow(menuNumber);
	flashSlideShow.objSlideShowTimer = window.setTimeout(function(){flashSlideShow.run();}, slideshowDelay);
}

