	var jsUID;
	tempURL = location.href;
	theURL = tempURL.split('/');
	realURL = theURL[2];
	if(realURL == "mms.greyinteractive.com"){
		var localDomain = "http://mms.greyinteractive.com";
	}
	else if(realURL == "192.168.0.100:2160"){
		var localDomain = "http://192.168.0.100:2160";
	}
	else if(realURL == "www.mms.com"){
		var localDomain = "http://www.mms.com";
	}
	else if(realURL == "www1.mms.com"){
		var localDomain = "http://www1.mms.com";
	}
	else if(realURL == "www2.mms.com"){
		var localDomain = "http://www2.mms.com";
	}
	//23122k4: added by Himanshu of Flashfx 
	else if(realURL == "global.mms.com"){
		var localDomain = "http://global.mms.com";
	}	
	else{
	//24122k4: Replaced from us.mms.com to global.mms.com by Himanshu of Flashfx
		var localDomain = "http://global.mms.com";
	}
	localDomain = "http://www.m-ms.com.au";
	
	HM_NS4 = (document.layers) ? true : false;

	var pageLoad = false;
	var URL = location.href;
	var keepOn;
	var subKeepThis;
	if(URL.indexOf('home.asp')!= -1){
		var offset = 55;
		var topSet = 91;
	}
	else{
		var offset = 177;
		var topSet = 70;
	}
	navImgs = 7 //Himanshu: 6 to 7, Andy: 7 back to 6
	var lastOn;
	imgSizes = new Array();
	
	// set an array for the top level global nav - on every page.  Should be set to an aboslute URL so script will work on extrurnal sites.
	 	nav = mmsNav = new Array(localDomain + '/',localDomain + '/about/',localDomain + '/fungames/',localDomain + '/baking/',localDomain + '/about/characters/',localDomain + '/ecards/',localDomain + '/news/','javascript:;');
	
	//#####################################################################################################
	//###########       SET ARRAY FOR SUB NAV.													###########
	//###########	There are 4 diffrent arrays for each section.								###########
	//###########	1. content - the text that shows up and is clickable.						###########
	//###########	2. link - the URL of the text that is being clicked.						###########
	//###########	3. linkColor - the color of the link when the user mouses over the text		###########
	//###########	4. offSet - the number of pixals from the left of the main conetent area. 	###########
	//###########																				###########
	//#####################################################################################################
	content = new Array();
	links = new Array();
	linkColor = new Array();
	offSet = new Array();
	
	//#### ABOUT ####
	content[1] = new Array();
	links[1] = new Array(); 
	linkColor[1] = "#33B44A";
	offSet[1] = 0;
	content[1][0] = "About M&amp;M's&reg; Home";		links[1][0] = localDomain + "/about/";
	content[1][1] = "History";							links[1][1] = localDomain + "/about/history/";
	content[1][2] = "Products";							links[1][2] = localDomain + "/about/products/";
	//content[1][3] = "Trivia Game";						links[1][3] = localDomain + "/about/trivia/";
	content[1][3] = "Characters";						links[1][3] = localDomain + "/about/characters/";
	
	//#### FUN AND GAMES ####
	content[2] = new Array();
	links[2] = new Array(); 
	linkColor[2] = "#008ED5";
	offSet[2] = 0;
	content[2][0] = "Fun Stuff";				links[2][0] = localDomain + "/funstuff/";
//	content[2][1] = "Games";							links[2][1] = localDomain + "/fungames/games/";
//	content[2][1] = "TV Commercials";					links[2][1] = "/fungames/tvcommercials/";
	content[2][1] = "Downloads";						links[2][1] = localDomain + "/fungames/downloads/";
	
	//#### BAKING ####
	content[3] = new Array();
	links[3] = new Array(); 
	linkColor[3] = "#944719";
	offSet[3] = 0;
	content[3][0] = "Baking &amp; Ideas Home";			links[3][0] = localDomain + "/baking/";
	content[3][1] = "Cookies";							links[3][1] = localDomain + "/baking/recipes/cookies_1.html";
	content[3][2] = "Brownies";							links[3][2] = localDomain + "/baking/recipes/browniesbars_1.html";
	content[3][3] = "Cakes";							links[3][3] = localDomain + "/baking/recipes/cakes_1.html";
	content[3][4] = "Kids Favourites";					links[3][4] = localDomain + "/baking/recipes/kidsfavorites_1.html";
	content[3][5] = "Baking Tips";						links[3][5] = localDomain + "/baking/bakingtips/";	

	//#### E-CARDS ####

	content[5] = new Array();
	links[5] = new Array(); 
	linkColor[5] = "#FE6B15";
	offSet[5] = 0;
	content[5][0] = "E-Cards Home";						links[5][0] = localDomain + "/ecards/";
	//content[5][1] = "Birthday";							links[5][1] = localDomain + "/ecards/birthdaycards/";
	//content[5][2] = "Congratulations";					links[5][2] = localDomain + "/ecards/congratulations/";
	//content[5][3] = "Get Well Soon";					links[5][3] = localDomain + "/ecards/getwellsoon/";
	//content[5][4] = "Send Your Love";					links[5][4] = localDomain + "/ecards/sendyourlove/";
	//content[5][5] = "Thank You";						links[5][5] = localDomain + "/ecards/thankyou/";
	
		
	//#### NEWS AND PROMOTIONS ####
	content[6] = new Array();
	links[6] = new Array(); 
	linkColor[6] = "#F7CF0D";
	offSet[6] = 0;
	content[6][0] = "News & Promotions Home";						links[6][0] = localDomain + "/news/";
	
	//Himanshu: removed http://au.mms.com
	//define the on and off states for the global nav
	for(var i=0;i<=navImgs;i++){
		eval('nav'+ i +'_off = new Image();');
		eval('nav'+ i +'_off.src = "/update/images/nav'+i+'_off.gif"')
		eval('nav'+ i +'_on = new Image();');
		eval('nav'+ i +'_on.src = "/update/images/nav'+i+'_on.gif"')
	}
	//function that turns on and off the global nav images.
	function doRoll(imgName, mouseDir){
		//checks if the direction is on
		if(mouseDir == 'in'){
			//turns all images off
			for(var i=0;i<=navImgs;i++){
				offName = "nav"+i;
				//if(keepOn != offName){
					document.images[offName].src = eval(offName+"_off.src");
				//}
				
			}
			//checks to see if theTimeout is set and if so it clears it.
			if(this.theTimeout){
				window.clearTimeout(this.theTimeout);
			}
			// turns the image that should be on - on
			document.images[imgName].src = eval(imgName+"_on.src");
		}
		//checks if the direction is off
		else if(mouseDir == 'out' && keepOn != imgName){
			window.setTimeout("document.images[imgName].src = eval(imgName+'_off.src')", 100);
			this.theTimeout = window.setTimeout("clearDrop()", 100);
		}
	}
	
	//var reEnter = -1;
	//var NeedImgs = -1;
	
	//#############################################################################
	//###########		Function that creates the sub nav				###########
	//#############################################################################
	function makeDrop(sIDValue){
		if(pageLoad && sIDValue != 0){ // check to see if the page has loaded and check to see if its trying to write a nav on the homepage
			var theContent = "";
			MakeHidden = "ChangeThisDiv"; // assigns the id that will be changed
			whichElement = document.getElementById(MakeHidden);
				// get all the conent for the section that is passed in with the sIDValue variable
				for(var c=0; c<content[sIDValue].length;c++){
					if(c == (content[sIDValue].length)-1){ // check to see if item is last in the array and do not draw line on right side
						if(URL.indexOf(links[sIDValue][c])!= -1){
							theContent = theContent + '<a href="'+links[sIDValue][c]+'" onMouseOver="keepActive();doRoll(\'nav'+sIDValue+'\',\'in\');" onmouseout="clearAll();" id="subnav'+c+'" style="color:'+linkColor[sIDValue]+';">' + content[sIDValue][c] +'</a>';
							subNavOn = c;
						}
						else{
							theContent = theContent + '<a href="'+links[sIDValue][c]+'" onMouseOver="keepActive();doRoll(\'nav'+sIDValue+'\',\'in\');changeBack('+sIDValue+',\'subnav'+c+'\', \'in\');" onmouseout="clearAll();changeBack('+sIDValue+',\'subnav'+c+'\', \'out\');" id="subnav'+c+'">' + content[sIDValue][c] +'</a>';
						}
					}
					// Himanshu: replaced || subKeepThis == c with && c != 0
					else if(URL.indexOf(links[sIDValue][c])!= -1 && c != 0){// check to see if is the on state.  use if the don't want the home page section lit(&& c != 0)
						//alert("ok3" + subKeepThis + "," + c);
						theContent = theContent + '<a href="'+links[sIDValue][c]+'" onMouseOver="keepActive();doRoll(\'nav'+sIDValue+'\',\'in\');" onmouseout="clearAll();" id="subnav'+c+'" style="color:'+linkColor[sIDValue]+';">' + content[sIDValue][c] +'</a><div style="display:inline;background-color:'+linkColor[sIDValue]+'"><img src="/update/images/nav_back.gif" alt="" width="1" height="13" border="0"></div>';
						subNavOn = c;
					}
					else{// write out the nav
						theContent = theContent + '<a href="'+links[sIDValue][c]+'" onMouseOver="keepActive();doRoll(\'nav'+sIDValue+'\',\'in\');changeBack('+sIDValue+',\'subnav'+c+'\', \'in\');" onmouseout="clearAll();changeBack('+sIDValue+',\'subnav'+c+'\', \'out\');" id="subnav'+c+'">' + content[sIDValue][c] +'</a><div style="display:inline;background-color:'+linkColor[sIDValue]+'"><img src="/updatea/images/nav_back.gif" alt="" width="1" height="13" border="0"></div>';
					}				
				}// end of for
				whichElement.innerHTML = theContent // write the content to the div
				whichElement.style.top = topSet; // off set it from the top
				whichElement.style.paddingLeft = 0;// set/reset the amount moved from the lest to zero
				whichElement.style.width = 750; // set/reset the width to 750
				//if(sIDValue != keepThis){
					whichElement.style.paddingLeft = offSet[sIDValue];// adjust how far left the item should b
					// check to see if netscape and if it is srink the size of the of the layer to not show white
					if(navigator.appName.indexOf('Netscape')!= -1 ){
						newsize = 750-offSet[sIDValue];
						whichElement.style.width = newsize;				
					}
				//}
				whichElement.style.visibility = "visible"; // set to visible
				whichElement.style.display = "inline";  // make it display
				
				
		}
		else{// if page is not loaded do nothing.
			return;
		}
	}
	var theTimeout;
	
	// function to change the link color on mouse over.
	function changeBack(colorChange,theid,moveDir){
		if(moveDir == "in"){
			document.getElementById(theid).style.color = linkColor[colorChange];
		}
		if(moveDir == "out"){
			document.getElementById(theid).style.color = "#323232";
		}
		
	}
	//function to clear all after 
	function clearAll(){
		this.theTimeout = window.setTimeout("clearDrop()", 500);
	}
	// kill the timeout
	function keepActive(){
		if(this.theTimeout) window.clearTimeout(this.theTimeout);
	}
	// clear the dropdown.
	function clearDrop(dropOnly){
		whichElement = document.getElementById("ChangeThisDiv");
		whichElement.style.visibility = "hidden";
		whichElement.style.display = "none";
		if(keepThis){
			makeDrop(keepThis);
		}
		if(!dropOnly){
			for (var i=1;i<=navImgs;i++){
				imgName = "nav"+i;
				if(imgName != keepOn){
					document.images[imgName].src = eval(imgName+"_off.src");
				}
				else{
					document.images[imgName].src = eval(imgName+"_on.src");
				}
			}
		}
	}
	var keepThis = 0;
	var imgName = "nav0";
	function getImageSize(passedOn,subPassedOn){
		for(var i=0;i<=navImgs;i++){
			sIDValue = "nav"+i
			imgSizes[imgSizes.length]= document.getElementById(sIDValue).width;
			if(URL.indexOf(nav[i])!= -1 && i != 0){
				imgName = "nav"+i;
				keepThis = i;
				keepOn = imgName;
				document.images[imgName].src = eval(imgName+"_on.src");
			}
		}
		if(document.body.offsetWidth <= 752){
			checkReSize();
		}
		if(passedOn){
			keepThis = passedOn;
			imgName = "nav"+passedOn;
			keepOn = imgName;
			document.images[imgName].src = eval(imgName+"_on.src");
		}
		if(subPassedOn){
			subKeepThis = subPassedOn;
		}
		pageLoad = true;
		makeDrop(keepThis);
	}
	
	function checkReSize(){
		if(document.body.offsetWidth <= 752){
			if(document.getElementById('promo1')){
				document.getElementById('promo1').style.left = "375";
			}
			if(document.getElementById('promo2')){
				document.getElementById('promo2').style.left = "375";
			}
			if(document.getElementById('ChangeThisDiv')){
				document.getElementById('ChangeThisDiv').style.left = "375";
			}
		}
		else{
			if(document.getElementById('promo1')){
				document.getElementById('promo1').style.left = "50%";
			}
			if(document.getElementById('promo2')){
				document.getElementById('promo2').style.left = "50%";
			}
			if(document.getElementById('ChangeThisDiv')){
				document.getElementById('ChangeThisDiv').style.left = "50%";
			}
		}
	}
	
function popup(URL, width, height){
	winInfo = "height="+height+",width="+width+",resizable=yes,scrollbars=yes";
	window.open(URL, "popup", winInfo);
}
