		
		//Global variable to store the background name
		//used by Flash
		var colorBackgroundName;
		
		/*
		* Facade function. helps the CMS author make sense of the function to use for
		* loading flash content on Crystal Light.
		*/
		function loadFlashFile(movie, width, height, bgcolor, paramstring){
			//delegate control
			loadBackgroundColor(movie, width, height, bgcolor, paramstring)
		}
		
		
		
		/*
		* Helps load a flash file and set the right background color to hosting page.
		*/
		function loadBackgroundColor(movie, width, height, bgcolor, paramstring){

			//declare background color
			var selectedBGColor;
			var bgColor = new Array(); 
			bgColor[0] = "#66141F"; //red for home1
			bgColor[1] = "#013D84"; //blue for home2
			bgColor[2] = "#FE7C00"; //orange for home3
			bgColor[3] = "#85B02D"; //green for home4

			//check action to take
			var isIntro = movie.indexOf("intro");
			var isHome = movie.indexOf("home");

			if(isIntro != -1){
				//select random color
				var bgColorsToIterate = 3;
				var rnNumberToSelect = Math.round(Math.random() * bgColorsToIterate) ;
				//set the right intro Flash file number to load
				movie = movie.replace("intro", "intro" + (rnNumberToSelect + 1) + ".swf");				
				//set background color only applies to homeX.swf and interior page files
				//selectedBGColor = bgColor[rnNumberToSelect];
				//setBackgroundColor(selectedBGColor);
			}else if(isHome != -1){
				//get the home number being called
				var isHomeLastIndex = movie.lastIndexOf("home");
				var strHomeNumber = movie.substr((isHomeLastIndex + "home".length), 1);
				//get the background color for this home Flash file
				var colorNumToSet = Number(strHomeNumber) - 1
				selectedBGColor = bgColor[colorNumToSet];
				//set background color
				setBackgroundColor(selectedBGColor, colorNumToSet);
			}else{
				//get page name
				var pageNameStart = movie.lastIndexOf("/");
				var interiorPage = movie.substring(pageNameStart + 1, movie.length);
				//get background color
				var colorNumToSet = getInteriorPageBGColor(interiorPage);
				// set background color
				//change this if color is different to the 4 on the array.
				selectedBGColor = bgColor[colorNumToSet];
				//set background color
				setBackgroundColor(selectedBGColor, colorNumToSet);			
			}
			
			//load Flash file
			writeFlashTag(movie, width, height, bgcolor, paramstring);
			
		}

		/*
		* Gets the background color of interior pages based on 
		* the Flash file name.
		*/
		function getInteriorPageBGColor(interiorPage){
			var colorNumber;
			switch(interiorPage){
			case "enhanced.swf":
				colorNumber = 0
				break;
			case "flavorwheel.swf":
				colorNumber = 1
				break;
			case "invigorate.swf":
				colorNumber = 2
				break;
			case "motivate.swf":
				colorNumber = 1
				break;
			case "participate.swf":
				colorNumber = 0
				break;
			case "refresh.swf":
				colorNumber = 1
				break;
			case "stepup.swf":
				colorNumber = 2 //change?
				break;
			case "sunrise.swf":
				colorNumber = 2 //change?
				break;
			case "tea.swf":
				colorNumber = 3
				break;
			case "varieties.swf":
				colorNumber = 1
				break;
			case "whatsnew.swf":
				colorNumber = 1
				break;
			}
			
			return colorNumber;
		}

		/*
		* Set a document background color. 
		*/
		function setBackgroundColor(backgroundColor, colorNumber){
			
			//set background color
			document.bgColor = backgroundColor;
			//set the color name for Flash
			switch(colorNumber){
			case 0:
				colorBackgroundName = "red"
				break;
			case 1:
				colorBackgroundName = "blue"
				break;
			case 2:
				colorBackgroundName = "orange"
				break;
			case 3:
				colorBackgroundName = "green"
				break;
			}
			
			if (colorBackgroundName == "blue") {
				document.body.style.background = "#013D84 url('/crystallight/images/bg-blue.gif') repeat-x fixed top";
			} else if (colorBackgroundName == "green") {
				document.body.style.background = "#85B02D url('/crystallight/images/bg-green.gif') repeat-x fixed top";
			} else if (colorBackgroundName == "orange") {
				document.body.style.background = "#FE7C00 url('/crystallight/images/bg-orange.gif') repeat-x fixed top";
			} else if (colorBackgroundName == "red") {
				document.body.style.background = "#66141F url('/crystallight/images/bg-red.gif') repeat-x fixed top";
			} else {
				document.body.style.background = "#013D84 url('/crystallight/images/bg-blue.gif') repeat-x fixed top";
			}
		}
		
		/*
		* Provides the background color name for Flash
		*/
		function getBackgroundColorName(){
			
			//set background color
			return colorBackgroundName;
			//alert(document.getElementById("bc"));
			
		}