<!--//
var topnavNames = ["home", "products", "mailing_list", "clickspinwin", "rewards", "innercircle", "heritage", "savenow"];
var maxTopnav = topnavNames.length;
var topnavOn = new Array(maxTopnav);
var topnavOff = new Array(maxTopnav);
var topnavPath = "/images/";
var topnavPrefix = "nav_";
var topnavType = ".gif";
var currTopnav = 0;

if (document.images){
	for (var i = 0; i < maxTopnav; i++){
		topnavOn[i] = new Image();
		topnavOn[i].src = topnavPath + topnavPrefix + topnavNames[i] + "_over" + topnavType;
		topnavOff[i] = new Image();
		topnavOff[i].src = topnavPath + topnavPrefix + topnavNames[i] + topnavType;
	}
}
	
function light(imgNum){
	if (document.images && (imgNum != 0)){
		document.images["tnav" + imgNum].src = topnavOn[imgNum - 1].src;
	}
}
	
function dim(imgNum){
	if (document.images && (currTopnav != imgNum)){
		document.images["tnav" + imgNum].src = topnavOff[imgNum - 1].src;
	}
}

function lightCurrent(){
	if (currTopnav != 0){
		light(currTopnav);
	}
}

function setCurrent(imgNum){
	if (imgNum != currTopnav){
		var temp = currTopnav;
		currTopnav = imgNum;
		light(currTopnav);
		dim(temp);
	}
}

window.onload = lightCurrent;

//Flash Communication
function flashTalk(directive){
	var mainSWF = window.document.swfcontainer;
	switch(directive){
		case 'home':
			setCurrent(1);
			break;
		case 'products':
			setCurrent(2);
			break;
		case 'heritage':
			setCurrent(7);
			break;
	}
	mainSWF.TGotoLabel('/container_mc/HTMLdirector_mc', directive);
}

//Cross Browser Object Retrieval
function getObject(objectID){
	if (document.all!=null){
		return document.all[objectID];
	} else if (document.getElementById){
		return document.getElementById(objectID);
	}
}


//Floating Warning Label Setup
whereY = 305;

function showDIV(divID){
	var divPop = getObject(divID);
	divPop.style.display = "block";
}

function hideDIV(divID){
	var divPop = getObject(divID);
	divPop.style.display = "none";
}

/*Popup Window Functions*/
var popUpWin;
var popDefWidth = 570;
var popDefHeight = 400;
var lastWidth;
var lastHeight;

//Open URL in new window with fixed dimensions
function openWin(url, pixWidth, pixHeight, canScroll){
	var winFeatures = "width=" + pixWidth + ",height=" + pixHeight + "," + getCentered(pixWidth,pixHeight) + ",resizable=no,scrollbars=";
	if (canScroll){
		winFeatures += "yes";
	} else {
		winFeatures += "no";
	}
	if (popUpWin != null){
		if (popUpWin.closed){
			popUpWin = window.open(url, "popwin", winFeatures);
			popUpWin.focus();
		} else if ((lastWidth == pixWidth) && (lastHeight == pixHeight)){
			popUpWin.location.href = url;
			popUpWin.focus();
		} else {
			popUpWin.close();
			var timeDelay = 0;
			if (navigator.userAgent.indexOf("Safari") != -1){
				timeDelay = 1000;
			}
			var winWait = window.setTimeout('popUpWin = window.open("' + url + '", "popwin", "' + winFeatures + '");popUpWin.focus();', timeDelay);
		}	
	} else {
		popUpWin = window.open(url, "popwin", winFeatures);
		popUpWin.focus();
	}
	lastWidth = pixWidth;
	lastHeight = pixHeight;
}

//Get coordinates for centering window
function getCentered(popupWidth, popupHeight){
	var indentNetscapeWidth = 'screenX=' + getIndent(popupWidth, false);
	var indentNetscapeHeight = 'screenY=' + getIndent(popupHeight, true);
	var indentMSIEWidth = 'left=' + getIndent(popupWidth, false);
	var indentMSIEHeight = 'top=' + getIndent(popupHeight, true);
	var centerCoordinates = indentNetscapeWidth + ',' + indentNetscapeHeight + ',' + indentMSIEWidth + ',' + indentMSIEHeight;
	return centerCoordinates;
}

//Determine top and left margins for window
function getIndent (popupDimension, isHeight){
	if (isHeight){
		return ((screen.availHeight - popupDimension) / 2);
	} else {
		return ((screen.availWidth - popupDimension) / 2);
	}
}

function confirmNavigation() {    
    return confirm('You have requested to leave FreshCope.com to visit another website. Continue?');
}

function goExt() {    
    var urlInfo = document.getElementById("linkToPG").value    
    if (confirmNavigation()) {        
        window.location=urlInfo;
    } 
}

function newSite(url) {    
    if (confirmNavigation()) {        
        window.open(url , 'newWindow', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1');
    } 
}

//-->
