var onLoadFunctions = new Array();
var iloadFunction = 0;

function loadFlash() {
	// HERSHEY BRAND FOOTER
	if (document.getElementById('hershey-canada-brandbar') != null) {
        var flashvars = { bgColor: "0xffffff", xmlPath: "/en/general/xml/brandbar.xml", logoPath: "/en/general/swf/logos/", curr_pgName: null, inputDevAccount: "hersheyintcanadahersheydev,hersheyglobaldev", inputLiveAccount: "hersheyintcanadahershey,hersheyglobal" };
        var params = { wmode: "transparent" };
        var attributes = {};

		swfobject.embedSWF("/en/general/brandbar_wide.swf", "hershey-canada-brandbar", "920", "75", "9.0.0", "/en/general/swf/expressInstall.swf", flashvars, params, attributes);
	}
}

<!--
	
	function PopupPic(sPicURL) { 
		window.open("popup.html?"+sPicURL, "AdHistory", "resizable=1,HEIGHT=200,WIDTH=200");
	}
// -->


//--------SIMPLE POP UP WINDOWS-------------------

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function popUpWindow(cPopUrl, cPopName, iPopWidth, iPopHeight, bScrollBars) {
//cPopUrl = the name of url to call, bScrollBars = if 'no' or blank, no bars will appear.
	var iPopLeft, iPopTop;
	var oPopWindow = null;
	if (!oPopWindow || oPopWindow.closed){
		//Center popup window inside parent window.
		iPopLeft = (window.screen.width/2) - ((iPopWidth/2) + 10);
		iPopTop = (window.screen.height/2) - ((iPopHeight/2) + 50);
		//Open popup window
		oPopWindow=open(cPopUrl, cPopName,"height="+ iPopHeight +",width="+ iPopWidth +",left=" + iPopLeft + ",top=" + iPopTop + ",screenX=" + iPopLeft + ",screenY=" + iPopTop + ",scrollbars=" + bScrollBars + ", statusbar=no");
		oPopWindow.location.href = cPopUrl;
		oPopWindow.focus()
    }
	else {
    	oPopWindow.focus()
	}
}

// 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");

