//-- TRACKING CODE-------------------------------------------------------------
//-- TRACKING CODE-------------------------------------------------------------
//-- TRACKING CODE-------------------------------------------------------------

var debug = false;
var bNewWindow = false;

var wtl_loc = document.URL.indexOf('https:')==0?'https://a248.e.akamai.net/v/248/2120/1d/download.akamai.com/crs/lgsitewise.js':'http://crs.akamai.com/crs/lgsitewise.js';

var wtl_TagVer = 6;
var wtl_FWD = 0;
//var wtl_url = document.URL;
var wtl_url = "http://www.coca-cola.com/";
var wtl_title = document.title;
var wtl_TagID = 104655;
var wtl_SID = "005-01-9-20-233860-104655";
var wtl_Offset = "-500";
WTL_TAG = new Image;
WTL_TAG.ID = "WTL_TAG";

var ORDER= "";
var SERVER= "";
var INVOICE= "";
var CARTVIEW= "";
var CARTADD= "";
var CARTREMOVE= "";
var CHECKOUT= "";
var CARTBUY= "";
var ADCAMPAIGN= "";

var skipnav_counter=1;

// These variables can be set by calling modules to override the popup window properties.
var newWindowProps = "";
var newWindowName = "";

var sContentGroup = "Corporate";

function navigate (sUrl, bNewWindow, sSubContentGruop, targetWin) {
if (debug == true)  alert( "Navigate : '" + sUrl + "'," + bNewWindow + ",");
				
if ( targetWin == null ) targetWin = top;

// First do the navigation
if (sUrl.length > 0) {
	if (bNewWindow == true || bNewWindow == "true") {
		window.open(sUrl, "popup", "width=740,height=520,status=yes,toolbar=yes,menubar=yes,scrollbars=yes,directories=yes,location=yes,resizable=yes");
	} else {
		targetWin.location = sUrl;
	}
}

doTracking (sSubContentGruop, targetWin);

}

function doTracking (sSubContentGruop) {
	
if (debug == true)  alert( "Tracking : " + sContentGroup + "," + sSubContentGruop );
				
// then call the wtl_Tag6 
wtl_Tag6(wtl_TagID, wtl_SID, wtl_url, wtl_title, sContentGroup + "," + sSubContentGruop);
//wtl_Tag6(wtl_TagID,wtl_SID,wtl_url,wtl_title);

}

function popupSiteMap() {
	var newWindowProps1 = "width=790,height=479,status=no,toolbar=no,menubar=no,scrollbars=1,resizable=no";
	var newWindowName1 = "SiteMap";
	var sUrl = "/sitemap/index.html";
	parent.open (sUrl, newWindowName1, newWindowProps1);
	doTracking ("Site Map");
}

function store() {	
	var newWindowProps1 = "width=780,height=480,status=yes,menubar=yes,toolbar=yes,resizable=yes,scrollbars=yes,location=yes";
	var newWindowName1 = "store";
	var sUrl = "http://www.coca-colastore.com";
	parent.open (sUrl, newWindowName1, newWindowProps1);
	doTracking ("Store");
}

function navigateBack() {
	history.back();
	doTracking ("Corporate", "Back");
}



//-- ROLLOVER CODE-------------------------------------------------------------
//-- ROLLOVER CODE-------------------------------------------------------------
//-- ROLLOVER CODE-------------------------------------------------------------

var pageRollOvers = [];
var rollOverCounter = 0;

/**
 * Called by document.onLoad to create the rollover objects
 * Createing a rollover object cause it's on image to be
 * preloaded
 * 
 * @param rollOverArray - an array of rollovers records in the form:
 *		  [0] = the name/id of the image object as is in the img tag
 *		  [1] = the off rollover image href
 *	      [2] = the on rollover image href
 */
function createRollOvers(rollOverArray)
{
	for (var i=0; i<rollOverArray.length; i++)
		addRollOver(new RollOver(rollOverArray[i][0], rollOverArray[i][1], rollOverArray[i][2]));
}
/** 
 * helper for createRollOvers
 */
function addRollOver(rollOver){  pageRollOvers[rollOverCounter++] = rollOver;}


/**
 * used by the anchor tags onMouseOver and onMouseOut calls
 * to retrieve the RollOver object that you can call rollOn()
 * or rollOff on
 *
 * @param rolloverName - the name/id of the img href associate
 * 	      with a rollover
 *
 * @return a RollOver object
 */
function getRollOver(rollOverName)
{
	for (var i=0; i<rollOverCounter; i++)
	{
		if (pageRollOvers[i].imageObject == rollOverName)
			return pageRollOvers[i];
	}
	return null;
}

/**
 * RollOver object, a simple object that can toggle
 * the src of an ImageObject
 * 
 * @param imgObject - the name/id of the image as it
 *		  appears in the img tag
 * @param offImageSrc - the href of the off state image
 * @param onImageSrc - the href of the on state image
 */
function RollOver(imgObject, offImageSrc, onImageSrc)
{
	//preload rollover images
	this.preLoadOnImg     = new Image();
	this.preLoadOnImg.src = onImageSrc;

	//object properties	
	this.imageObject = imgObject;
	this.offImageSrc = offImageSrc;
	this.onImageSrc  = onImageSrc;

	//object methods	
	this.rollOn = RollOver_rollOn;
	this.rollOff = RollOver_rollOff;
}

function RollOver_rollOn(){  var img =  DOMGetElement(this.imageObject); if (img)img.src=this.onImageSrc;}
function RollOver_rollOff(){ var img =  DOMGetElement(this.imageObject); if (img)img.src=this.offImageSrc;}





//--MENU CODE -----------------------------------------------------------------
//--MENU CODE -----------------------------------------------------------------
//--MENU CODE -----------------------------------------------------------------



/**
 * Menu Data Structures
 *
 *  Menu Record
 * [0] = arbitrary, unique, identifier of the menu state.  This 
 *	     determines which menu element is "active" and which sub
 *		 menus are displayed
 * [1] = OPTIONAL(if this is a text menu): Image name and id as 
 *		 designated in the img tag
 * [2] = OPTIONAL(if this is a text menu): image width
 * [3] = OPTIONAL(if this is a text menu): image height
 * [4] = OPTIONAL(if this is a text menu): href to the image 
 *		 minus the naming convention extensions such as '_dn'
 * 		 and the file type.  The default menu printing functions 
 *		 will create RollOver obejcts according to the '_dn' & '_ro'
 *		 naming convention.  All menu graphics are assumed to be gifs.
 * [5] = The 'alt' value of an img tag if this is a graphic menu or the 
 *		 menu text if this is a text menu
 * [6] = The link for this menu option to link to 
 * [7] = OPTIONAL: An array of nested menu elements.  This is used to create
 *       a single level of nesting on the left nav but it could
 *       be used to create create tree menus of arbitrary depth		 
 */

/**
 * Menu Object, prints out a menu based on the above menu data structure.
 * The menus were done in an object oriented way to maximize flexibility
 * and reusability of functions.  LeftNavMenu modifies the behavior
 * of Menu by using a different printMenuOption method
 * 
 * @param inMenuOptions = an array of menu options.  Each array 
 *		  element is a 7 element list as outlined above 
 * @param choice = an indicator of the current page.  The 
 *        choice will be compared against the first element
 * 		  of each menu option record.
 * @returns an initialized menu object that can print a menu
 */
function Menu(inMenuOptions, choice)
{
	//Object Properties
	this.menuOptions  = inMenuOptions
	this.choice       = choice;
	
	//Object Functions
	this.print           	= Menu_Print;
	this.printMenuOption    = Menu_PrintMenuOption;
	this.optionSelected  	= Menu_optionSelected;
}

/**
 * Used by menu objects to loop over an array of menu 
 * option arrays...to loop over each menu choice and 
 * have a replaceable helper function print out the 
 * menu line item.  A helper function does the printing
 * so that the object can switch out the function to 
 * print differet types of menus
 */
function Menu_Print()
{
	document.write('<span><a href=\"#skip_group_'+ skipnav_counter + '\" title=\"skip navigation links\"> </a></span>');
	
	for (var i=0; i<this.menuOptions.length; i++)
		this.printMenuOption(this.menuOptions[i], this.choice1);

	document.write('<span><a name=\"skip_group_'+ skipnav_counter +'\"> </a></span>');

	skipnav_counter++;
}

/**
 * Seaches a menuOption and it's sub menus (contained in an 
 * array in item [7], for a menu option that has matches
 * this objects currently selected option.  The function 
 * is recursive and work for an menu structure of 
 * arbitrary depth.
 *
 * @param the record to search fro this.choice
 */
function Menu_optionSelected(menuOption)
{
	if (menuOption[0] == this.choice)
		return true;
	else if (menuOption[7]!=null)
		for (var i=0; i<menuOption[7].length; i++)
			if (this.optionSelected(menuOption[7][i]))
				return true;
	return false;
}

/**
 * This method is designed to print out each
 * option in a graphical horizontal menu
 */
function Menu_PrintMenuOption(menuOption)
{
	if (this.optionSelected(menuOption))
	{
		if (NS4)
		{
			document.write('<td><a href="'+menuOption[6]+'">');
			document.write('<img src="'+menuOption[4]+'_dn.gif" width="'+menuOption[2]+'" height="'+menuOption[3]+'" border="0" name="' + menuOption[1] + '" id="' + menuOption[1] + '" alt="'+ menuOption[5]+'"></a></td>');
		}
		else
		{
		document.write('<td><a href="javascript:navigate(\'' + menuOption[6] + '\', false, \'' + menuOption[1] + '\', top)" onMouseOver="'+menuOption[1]+'_am.hideSubMenu(); '+menuOption[1]+'_am.show(); '+menuOption[1]+'_am.activeColor(); selectHide();" onMouseOut="'+menuOption[1]+'_am.menubar.startTimer(); '+menuOption[1]+'_am.normalColor(); selectShow();">');
		document.write('<img src="'+menuOption[4]+'_dn.gif" width="'+menuOption[2]+'" height="'+menuOption[3]+'" border="0" name="' + menuOption[1] + '" id="' + menuOption[1] + '" alt="'+ menuOption[5]+'"></a></td>');
		}
	}
	else
	{
		if (NS4)
		{
			addRollOver(new RollOver(menuOption[1], menuOption[4]+'.gif', menuOption[4]+'_ro.gif'));
			document.write('<td><a href="'+menuOption[6]+'" onMouseOut="getRollOver(\'' + menuOption[1] + '\').rollOff(); selectShow();" onMouseOver="getRollOver(\'' + menuOption[1] + '\').rollOn(); selectHide();">');
			document.write('<img src="'+menuOption[4]+'.gif" width="'+menuOption[2]+'" height="'+menuOption[3]+'" border="0" name="' + menuOption[1] + '" id="' + menuOption[1] + '" alt="'+ menuOption[5]+'"></a></td>');
		}
		else
		{	
		addRollOver(new RollOver(menuOption[1], menuOption[4]+'.gif', menuOption[4]+'_ro.gif'));
		document.write('<td><a href="javascript:navigate(\'' + menuOption[6] + '\', false, \'' + menuOption[1] + '\', top)" onMouseOut="getRollOver(\'' + menuOption[1] + '\').rollOff(); '+menuOption[1]+'_am.menubar.startTimer(); '+menuOption[1]+'_am.normalColor(); selectShow();" onMouseOver="getRollOver(\'' + menuOption[1] + '\').rollOn(); '+menuOption[1]+'_am.hideSubMenu(); '+menuOption[1]+'_am.show(); '+menuOption[1]+'_am.activeColor(); selectHide();">');
		document.write('<img src="'+menuOption[4]+'.gif" width="'+menuOption[2]+'" height="'+menuOption[3]+'" border="0" name="' + menuOption[1] + '" id="' + menuOption[1] + '" alt="'+ menuOption[5]+'"></a></td>');
		}
	}
}

/** 
 * A specialization of the Menu object that replaces
 * the printmenuOptions method with one that is 
 * designed to print out a vertical text based menu
 * 
 * @param inMenuOptions = an array of menu options.  Eacy array 
 *		  element is a 7 element list as outlined above 
 * @param choice = an indicator of the current page.  The 
 *        choice will be compared against the first element
 * 		  of each menu option record.
 * @returns an initialized menu object that can print a menu
 */
function LeftNavMenu(inMenuOptions, choice)
{
	//data
	this.menuOptions  = inMenuOptions
	this.choice       = choice;
	
	//functions
	this.print           = Menu_Print;
	this.optionSelected     = Menu_optionSelected;
	this.printMenuOption    = LeftNavMenu_printMenuOption;
	this.printSubOptions = LeftNavMenu_printSubOptions;

}

/**
 * Prints a vertical text tree menu.  
 *
 * TODO-make the output routine and table structure 
 * support arbitrary nesting depths
 */
function LeftNavMenu_printMenuOption(menuOption)
{
	if (this.optionSelected(menuOption))
	{
		
		if (   menuOption[   7])
		{
			document.write('<tr><td valign="top" width="8%"><img src="/images/navtree_arrow_dn.gif" width="11" height="12"></td><td class="copy-navtree" width="92%"><a href="'+menuOption[6]+'" class="copy-navtree-on">'+menuOption[5]+'</a></td></tr>');
			document.write('<tr><td>&nbsp;</td><td><table border=0 cellspacing=0 cellpadding=0>');
			this.printSubOptions(menuOption);
			document.write('</table></td></tr>');
		}
		else
			document.write('<tr><td valign="top" width="8%"><img src="/images/navtree_arrow_active.gif" width="12" height="11"></td><td class="copy-navtree" width="92%"><a href="'+menuOption[6]+'" class="copy-navtree-on">'+menuOption[5]+'</a></td></tr>');
	}
	else
	{
		document.write('<tr><td valign="top" width="8%"><img src="/images/navtree_arrow.gif" width="12" height="11"></td>');
		document.write('<td class="copy-navtree" width="92%"><a href="'+menuOption[6]+'" class="copy-navtree">'+menuOption[5]+'</a></td></tr>');
	}     
}

function LeftNavMenu_printSubOptions(menuOption)
{
	for (var i=0; i<menuOption[7].length; i++)
	{
		//debug(menuOption[7][i]);
		if (this.optionSelected(menuOption[7][i]))
		{
			document.write('<tr><td class="copy-navtree-on" valign="top" width="10%"><b>&#155;</b> </td>');
			document.write('<td class="copy-navtree-on" valign="middle" width="90%"><a href="'+menuOption[7][i][6]+'" class="copy-navtree-on"> '+menuOption[7][i][5]+'</a></td></tr>');
		}
		else
		{
			document.write('<tr><td class="copy-navtree" width="10%" valign="top"><b>&#183;</b> </td>');
			document.write('<td class="copy-navtree" width="90%"><a href="'+menuOption[7][i][6]+'" class="copy-navtree">'+menuOption[7][i][5]+'</a></td></tr>');
		}
	}
}
//This will bury error messages so the users cannot see them

window.onerror = null;

/**
 * Menu printing functions. 
 * Call each function where the menu should be printed out.
 * the identifier of the current page should be passed into the call
 *
 * The data that drives the menus and sets up the page identifiers
 * should b passed in in the menu_data.js file
 */
function printLevel1Menu(currentPage){new Menu(level1MenuOptionsArray, currentPage).print();}
function printLevel2Menu(currentPage){new Menu(level2MenuOptionsArray, currentPage).print();}
function printLevel3Menu(currentPage){new LeftNavMenu(level3MenuOptionsArray, currentPage).print();}

function sitemap()
{
	var url = '/sitemap/index.html';
	openPopup(url, 'sitemap', 'width=770,height=480,status=no,menubar=no,toolbar=no,resizable=no,scrollbars=no,location=no');
}

/*
function print(url)
{
	openPopup(url,'print','width=520,height=400,status=no,menubar=yes,toolbar=yes,resizable=yes,scrollbars=yes,location=no');
}
*/
function openPopup(url, name, style) 
{
/*
toolbar[=yes|no]|[=1|0]  location[=yes|no]|[=1|0]  directories[=yes|no]|[=1|0]  status[=yes|no]|[=1|0]  menubar[=yes|no]|[=1|0]  scrollbars[=yes|no]|[=1|0]  resizable[=yes|no]|[=1|0]  width=pixels  height=pixels
*/	
//so each window can be unique
if (!name)	name = new Date().getTime() + '';
if (!style)
	style = 'width=520,height=400,status=yes,menubar=no,toolbar=no,resizable=no,scrollbars=yes,location=no';
	var popupWindow = window.open(url,name,style);
	popupWindow.focus();
}
function popupPolicy(url, name, style) 
{
/*
toolbar[=yes|no]|[=1|0]  location[=yes|no]|[=1|0]  directories[=yes|no]|[=1|0]  status[=yes|no]|[=1|0]  menubar[=yes|no]|[=1|0]  scrollbars[=yes|no]|[=1|0]  resizable[=yes|no]|[=1|0]  width=pixels  height=pixels
*/	
//so each window can be unique
if (!name)	name = new Date().getTime() + '';
if (!style)
	style = 'width=650,height=400,status=yes,menubar=no,toolbar=no,resizable=no,scrollbars=yes,location=no';
	var popupWindow = window.open(url,name,style);
	popupWindow.focus();
}
function gothere() {
  window.location=document.sel.edu.options[document.sel.edu.selectedIndex].value
}

function gothereNewWindow() { 
			if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="")
				return false;
			if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_inthemovies.html") 
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_ontv.html") 
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_hilltop.html") 
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_newcoke.html") 
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_polarbears.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_santa.html") 
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_spriteboy.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_spriteboy.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_spriteboy.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_spriteboy.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_spriteboy.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/heritage/cokelore_spriteboy.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/citizenship/community_news.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/citizenship/environmental_news.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/citizenship/marketplace_news.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/citizenship/workplace_news.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/ourcompany/h&w_news.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else if(document.sel.edu.options[document.sel.edu.selectedIndex].value=="/investors/index.html")
			{
				location.href = document.sel.edu.options[document.sel.edu.selectedIndex].value;
			}
			else
				window.open(document.sel.edu.options[document.sel.edu.selectedIndex].value);
} 
function gothereNew(){
	var index = document.sdg.sdgsel.selectedIndex;
	var value = document.sdg.sdgsel.options[index].value;
	window.open(value);
}

function timeline(val) {  var timelineWin = window.open(val, 'timeline', 'width=790,height=500,toolbar=no,scrollbars=no,menubar=no,left=30,top=30,resizable=no,directories=no'); }
function popupVPT(val) {  var popupVPT = window.open(val, 'popupVPT', 'width=727,height=597,toolbar=no,scrollbars=no,menubar=no,left=30,top=30,resizable=no,directories=no'); }
function youth(val) { var youthWin = window.open(val, 'youth', 'width=810,height=620,toolbar=1,scrollbars=1,menubar=1,location=1,status=1,copyhistory=1,left=30,top=30,resizable=1,directories=1'); }
function askcokepopup() { var askpopupWin = window.open('http://questions.coca-cola.com', 'askcoke', 'width=520,height=400,toolbar=no,scrollbars=yes,menubar=no,left=30,top=30,resizable=no'); }
function popup(val) {  var popupWin = window.open(val, 'popup','width=520,height=400,scrollbars=yes,menubar=yes,left=30,top=30,resizable=no'); }
function popupAT(val) {  var popupAT = window.open(val, 'popupAT','width=727,height=557,scrollbars=no,menubar=no,left=30,top=30,resizable=no'); }
function popupENV(val) { var popupENV = window.open(val, 'popupENV', 'left=30,top=30,width=775,height=541,toolbar=0,resizable=0,menubar=0,toolbar=0'); }
function popupMEDC(val) { var popupMEDC = window.open(val, 'popupMEDC', 'width=1024,height=768,toolbar=1,scrollbars=1,menubar=1,location=1,status=1,copyhistory=1,left=30,top=30,resizable=1,directories=1'); }
function popupENV2(val) { var popupENV = window.open(val, 'popupENV2', 'left=30,top=30,width=805,height=541,toolbar=0,resizable=0,menubar=0,toolbar=0'); }

function popupOrgChart(val) { var popupENV = window.open(val, 'popupOrg', 'left=50,top=50,width=752,height=451,toolbar=0,resizable=0,menubar=0,toolbar=0'); }

function popupShareOwnerForm(val) {  var popupWin = window.open(val, 'popup','width=660,height=575,scrollbars=yes,menubar=yes,left=30,top=30,resizable=no'); }