/********************************************************
  Custom Menu Image Change via Cookie Information for MBA
  Author: VanDamme Associates, Inc.
/*******************************************************/

//Initialize the cookie/header image on pageLoad
function HeaderInitialize(){
	_initCookie = GetCookie('menuSection');
	
	//If the cookie doesn't exist, use default image: else use correct image
	if(_initCookie == null){
		ImageChange('about_mba');
	}else{
		ImageChange(_initCookie);
	}
}

function SectionChange(sectionName){
	//The sectionName must be the same as the changing part of the image title
	//Set the cookie on menu rollover
	//Set the Default Cookie Expiration for 30 seconds
	var expireDate = new Date(today.getTime() + 1 * 24 * 60 * 60 * 1000);
	//Check to see if there is an old cookie
	_oldCookie = GetCookie('menuSection');
	//if _oldCookie exists, delete it
	if(_oldCookie != null){
		//Set expiration to a past date (1 day in the past)
		var expireOldDate = new Date(today.getTime() - 1 * 24 * 60 * 60 * 1000);
		SetCookie('menuSection',_oldCookie,expireOldDate,'/');
	}
	//Create new cookie
	SetCookie('menuSection',sectionName,expireDate,'/');
	_newCookie = GetCookie('menuSection');
}

function ImageChange(sectionName){
	//Change the header-image.gif based upon the section set in the cookie, if no cookie set use default
	var img = new Image();
	//The src of the image is the image with ID of headerImage
	var me = document.getElementById('headerImage');
	var src = new String(me.src);
	//Set the image source to be the name of the correct image
	img.src = "/vango/core/contentmanager/uploads/images/" + sectionName + "-header-image.gif";
	//show the new image
	me.src = img.src;
}

