/* 
========================================================================================================= CREDITS
Copyright 	: Copyright (c) 2009 JPL & The Hershey Company, Inc. All Rights Reserved.
Author(s) 	: Larry Daughenbaugh - ldaugh@jplcreative.com
Date      	: 4/20/2009
Notes     	: JavaScript file for handling various events ... onLoad, onClick, etc
========================================================================================================= CHANGE LOG
Date		Name			Desc
---			---				---
========================================================================================================= BEGIN JAVASCRIPT
*/
/* ====================================================================================================== MULTIPLE ONLOAD HANDLER */
var onLoadFunctions = new Array();
var iloadFunction = 0;

// Pass each function that needs to load
function addOnLoad(func) {
    onLoadFunctions[iloadFunction] = func;
    iloadFunction++;
}
// Loops through all of the functions that were added
function loadAllFunctions() {
    for(i=0; i < onLoadFunctions.length; i++) {
        eval(onLoadFunctions[i]+"()");
    }
}
// Load all of the functions that you've set
window.onload = loadAllFunctions;

/* CALL EACH FUNCTION TO LOAD */
addOnLoad("loadFlash");

/* ====================================================================================================== DROPDOWN JUMP MENU */
function jumpMenu(targ,selObj,restore){
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
}

/* ====================================================================================================== POP UP WINDOWS */

	function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* ====================================================================================================== LOAD FLASH FILES */
function loadFlash() {
	// HERSHEY BLISS DESERVE HOME PAGE
	if (document.getElementById('flash-home') != null) {
        var flashvars = {};
        var params = { wmode: "transparent", base: "." };
        var attributes = {};

		swfobject.embedSWF("/latino/kitchen-with-kisses/lib/swf/preloader.swf", "flash-home", "960", "598", "9.0.0", "/latino/kitchen-with-kisses/lib/swf/expressInstall.swf", flashvars, params, attributes);
		if (document.getElementById('flash-home-alt') != null) {
			document.getElementById('flash-home-alt').style.visibility = "visible";
		}
	}
	// HERSHEY BLISS DESERVE QUIZ
	if (document.getElementById('flash-quiz') != null) {
        var flashvars = {};
        var params = { base: "." };
        var attributes = {};

		swfobject.embedSWF("/latino/kitchen-with-kisses/lib/swf/QuizPreloader.swf", "flash-quiz", "725", "929", "9.0.0", "/latino/kitchen-with-kisses/lib/swf/expressInstall.swf", flashvars, params, attributes);
		if (document.getElementById('flash-home-alt') != null) {
			document.getElementById('flash-home-alt').style.visibility = "visible";
		}
	}
	// HERSHEY BRAND FOOTER
	if (document.getElementById('brand-footer') != null) {
        var flashvars = { bgColor: "0xFFFFFF", xmlPath: "/general/xml/brandbar.xml", logoPath: "/general/swf/logos/" };
        var params = { wmode: "transparent" };
        var attributes = {};

		swfobject.embedSWF("/general/swf/brandbar.swf", "brand-footer", "920", "75", "9.0.0", "/latino/kitchen-with-kisses/lib/swf/expressInstall.swf", flashvars, params, attributes);
		if (document.getElementById('brand-footer-alt') != null) {
			document.getElementById('brand-footer-alt').style.visibility = "visible";
		}
	}
}