<!-- 
var ns4 = (document.layers) ? true : false
var ie4 = (document.all) ? true : false
var ns6 = (document.getElementById) ? true : false
var mac = ( navigator.userAgent.indexOf('Mac') > 0 ) ? true : false
var currentMainMenu = 0;
var currentSubMenu = 0;
var IsSearching = false;
//suggestion related variables.
var ssearchterm="";
var sactiontype="";
var smappedtext="";
var smasktext="";
var slist="";
var sframeName="";
var searchpagerendered=false;

/* variable to hold primary menu state */
var PrimaryMenuState

/* Constants for Primary Menu State */

var STATE_NONE, STATE_SHOP_HOME, STATE_CORPORATE_HOME
STATE_NONE = "NONE"
STATE_SHOP_HOME = "SHOP_HOME"
STATE_CORPORATE_HOME = "CORPORATE_HOME"
PrimaryMenuState = STATE_NONE
CHECKOUT_NAV_PAGE = '/superstore/topbar/defaulttopchkbar.asp'


if (document.images) {
	b1off=new Image(); b1off.src="/si/topnav/shop_off.gif";
	b1on=new Image(); b1on.src="/si/topnav/shop.gif";
	b2off=new Image(); b2off.src="/si/topnav/shopstores_off.gif";
	b2on=new Image(); b2on.src="/si/topnav/shopstores.gif";
	b3off=new Image(); b3off.src="/si/topnav/wellness_center_off.gif";
	b3on=new Image(); b3on.src="/si/topnav/wellness_center.gif";
	b4off=new Image(); b4off.src="/si/topnav/recipe_center_off.gif";
	b4on=new Image(); b4on.src="/si/topnav/recipe_center.gif";
	b5off=new Image(); b5off.src="/si/topnav/shop_off.gif";
	b5on=new Image(); b5on.src="/si/topnav/shop.gif";
	b6off=new Image(); b6off.src="/si/topnav/shopstores_off.gif";
	b6on=new Image(); b6on.src="/si/topnav/shopstores.gif";
	
}

function act (bn) {
	if (document.images) {
		loc = "b" + bn;
		document[loc].src = eval(loc + "on.src");
	}
}

function inact (bn) {
	if (document.images) {
		loc = "b" + bn;
		document[loc].src = eval(loc + "off.src");
	}
}

function active1 (show) {
	if (document.images) {
		if (ns6) document.getElementById(show).style.visibility='hidden'
		else if (ns4) document.layers[show].visibility='hide'
		else {
	 		var divisions = document.all.tags("div")
	 		divisions[show].style.visibility='hidden'
		}	 
	}
}

function active2 (show) {
	if(document.images){
		if (ns6) document.getElementById(show).style.visibility='visible'
		else if (ns4) document.layers[show].visibility='show'
		else {
	 		var divisions = document.all.tags("div")
	 		divisions[show].style.visibility='visible'
		}
	}
}

function view (show,h1,h2,h3) {
	if (document.images) {
		if (ns6) {
			document.getElementById(show).style.visibility='visible';
			document.getElementById(h1).style.visibility='hidden';
			document.getElementById(h2).style.visibility='hidden';
			document.getElementById(h3).style.visibility='hidden';
		}
		else if (ns4) {
			document.layers[show].visibility='show';
			document.layers[h1].visibility='hide';
			document.layers[h2].visibility='hide';
			document.layers[h3].visibility='hide';
		}
		else if ( ie4 || mac ){
		    var divisions = document.all.tags("div")
			divisions[show].style.visibility='visible';
			divisions[h1].style.visibility='hidden';
			divisions[h2].style.visibility='hidden';
			divisions[h3].style.visibility='hidden';
		}
	}
}

function setHighlight (subMenuNumber) {
	var SubMenuArray = new Array( "SubMenu11", "SubMenu12", "SubMenu13", "SubMenu14", "SubMenu15", "SubMenu16", "SubMenu17", "SubMenu21", "SubMenu22", "SubMenu23", "SubMenu24", "SubMenu25", "SubMenu26", "SubMenu27","SubMenu28", "SubMenu31", "SubMenu32", "SubMenu33", "SubMenu34");
	for ( var sm=0; sm < SubMenuArray.length; sm++ ) {
		if ( subMenuNumber != null ) document.getElementById( SubMenuArray[sm] ).className = 
			( SubMenuArray[sm].toLowerCase() != subMenuNumber.toLowerCase() ) ? "nav" : "highlighted";
	}
}

function setPrimaryNav (nav, subnav) {
	switch (nav) {
		
		case 'corphome' :
			act('2');
			inact('1');
			inact('3');
			inact('4');
			setHighlight(null);
			PrimaryMenuState = STATE_CORPORATE_HOME; 
			currentMainMenu=2;
			view('save','shop','wellness','recipe');
			document.getElementById('New_Tabs').style.visibility='hidden';
			document.getElementById('Tabs').style.visibility='visible';
		
		break;
		
		case  'shop' :	
			act('5');
			inact('2');
			inact('3');
			inact('4');
			currentMainMenu=1;
			view('shop','save','wellness','recipe');
			inact('6');
			if (subnav != '') 
				{setHighlight(subnav);
				}
			if (top.frames['topbar'].PrimaryMenuState != STATE_SHOP_HOME){
				document.getElementById('Tabs').style.visibility='hidden';
				document.getElementById('New_Tabs').style.visibility='visible';
			}		
			PrimaryMenuState = STATE_SHOP_HOME;
			
			
		break;

		case 'save' :
			act('2');
			inact('1');
			inact('3');
			inact('4');
			if (subnav != '') setHighlight(subnav)
			currentMainMenu=2;
			view('save','shop','wellness','recipe');
			
			
		break;

		case 'wellness' :
			act('3');
			inact('1');
			inact('2');
			inact('4');
			if (subnav != '') setHighlight(subnav)
			currentMainMenu=3;
			view('wellness','shop','save','recipe');
		break;

		case 'recipe' :
			act('4');
			inact('1');
			inact('2');
			inact('3');
		//	if (subnav != '') setHighlight(subnav)
			currentMainMenu=4;
			view('recipe','shop','save','wellness');
		break;

		default:
		//	document.getElementById('New_Tabs').style.visibility='hidden';
			document.getElementById('Tabs').style.visibility='visible';
		break;
	}
}

function DisplayCheckoutNav(page){
			

	
		top.frames['checkout'].location = CHECKOUT_NAV_PAGE + '?page='+page ;
	
		}


function loadframesetpages (lefturl, mainurl, framecount, corpurl, page) {

	var corpsite;
	if (corpurl != '') mainurl = corpurl + mainurl;

		
	if (framecount == 7){framecount = 4;}
	if (framecount == 6){framecount = 3;}

	

	var curframecount = top.frames.length;

		if (curframecount != framecount) {
	
		if (framecount == 0) top.location.href = mainurl
		else {
			if (framecount == 4 ) {
				top.location.href = (page != '')
					? '/superstore/default.asp?page='+page
					: '/superstore/default.asp?mainurl='+ mainurl +'&navurl='+lefturl;
			} else if (framecount == 3) {
				top.location.href = (page != '')
					? '/superstore/sixframeset.asp?page='+page
					: '/superstore/sixframeset.asp?mainurl='+ mainurl;
			}
		}
	} else {
		if (framecount == 4 ) {
		
			if (mainurl != '') top.frames['main'].location.href = mainurl;
			if (lefturl != '') top.frames['navbar'].location.href = lefturl;
			}else if (framecount == 3) {
				if (mainurl != '') top.frames['main'].location.href = mainurl;
			}

	}
	
}

function loadnewsite(siteurl, corpurl, winName) {
	if (corpurl != '') siteurl = corpurl + siteurl;
	chatWin=window.open(siteurl,winName);
}

function remoteSearch() {
	document.forms['form1'].search.value=top.frames['main'].document.forms['form1'].search.value;
	top.frames['main'].document.findbutton2.src='/si/bu_find_an.gif';
	DoSearch();
}

function DoSearch()
{

	var searchTerm=document.forms['form1'].search.value.replace(/^\s*|\s*$/g,"");
	
	if(parent.frames.length!=3)
	{
		document.forms['form1'].search.value="";
	}
	searchTerm=searchTerm.replace(/,/g,"");
	if (searchTerm=='')
	{ 
		alert('To search, type something into the search box and click go');
		return false;
	} 
	else if (IsSearching==false)
	{
    	IsSearching=true;
		//document.findbutton.src='/si/bu_find_an.gif';
		//document.findbutton.src='/si/topnav/go_ico.gif';
		var curframecount = parent.frames.length ;
		if (curframecount == 3 )
		{
			document.forms['form1'].action = '/superstore/default.asp?page=g';
			document.forms['form1'].corpsearch.value = '';
			document.forms['form1'].target = '_top';
		}
		else
		{
			/*if (document.forms['form1'].soption.value == 2) {
			
				top.frames['navbar'].location.href = '/superstore/leftbar/lft_Save.asp';
				top.frames['main'].location.href = document.forms['form1'].corpsearch.value + searchTerm;
				document.findbutton.src='/si/topnav/go_ico.gif';
				IsSearching=false;
				ssearchterm="";
				sactiontype="";
				smappedtext="";
				smasktext="";
				slist="";
				sframeName="";
				searchpagerendered=false;
				return false;
			}
			else
			{*/
				ssearchterm="";
				sactiontype="";
				smappedtext="";
				smasktext="";
				slist="";
				sframeName="";
				searchpagerendered=false;
				
				
				
				top.frames['navbar'].location.href = '/Dnet/Search.aspx?search=' + escape(searchTerm);
			
				top.frames['main'].location.href = '/superstore/Search.asp?search='+ escape(searchTerm);
					
			
				return false;
			//}
		}
		isExpressShopper='no';
		document.form1.submit();
		return false;
	}
}

function ReturnFromSearch() {
	IsSearching=false;
	//document.findbutton.src='/si/topnav/go_ico.gif';
	document.forms['form1'].search.focus;
}

function selectText(o) { o.select() }






function highLite(btnName){

	switch (btnName){
		case 'shop_by_aisle_btn' :
		document.getElementById("shop_by_aisle_btn").className="shop_by_aisle_img_sel";
		
		document.getElementById("express_list_btn").className="express_list_img";
		document.getElementById("shopping_history_btn").className="shopping_history_img";
		document.getElementById("online_savings_btn").className="online_savings_img";
		//document.getElementById("gift_cards_btn").className="gift_cards_img";
		//document.getElementById("photo_btn").className="photo_delivered_img";
		document.getElementById("bus_delivery_btn").className="business_delivery_img";
	
			
		break;
		
		
		case 'express_list_btn':
		document.getElementById("express_list_btn").className="express_list_img_sel";
		
		document.getElementById("shop_by_aisle_btn").className="shop_by_aisle_img";
		document.getElementById("shopping_history_btn").className="shopping_history_img";
		document.getElementById("online_savings_btn").className="online_savings_img";
		//document.getElementById("gift_cards_btn").className="gift_cards_img";
		//document.getElementById("photo_btn").className="photo_delivered_img";
		document.getElementById("bus_delivery_btn").className="business_delivery_img";
			
		break;
		
		case 'shopping_history_btn':
		document.getElementById("shopping_history_btn").className="shopping_history_img_sel";
		
		document.getElementById("express_list_btn").className="express_list_img";
		document.getElementById("shop_by_aisle_btn").className="shop_by_aisle_img";
		document.getElementById("online_savings_btn").className="online_savings_img";
		//document.getElementById("gift_cards_btn").className="gift_cards_img";
		//document.getElementById("photo_btn").className="photo_delivered_img";
		document.getElementById("bus_delivery_btn").className="business_delivery_img";
	
		
		break;
		
		
		case  'online_savings_btn':
		document.getElementById("online_savings_btn").className="online_savings_img_sel";
		
		document.getElementById("shopping_history_btn").className="shopping_history_img";	
		document.getElementById("express_list_btn").className="express_list_img";
		document.getElementById("shop_by_aisle_btn").className="shop_by_aisle_img";
		//document.getElementById("gift_cards_btn").className="gift_cards_img";
		//document.getElementById("photo_btn").className="photo_delivered_img";
		document.getElementById("bus_delivery_btn").className="business_delivery_img";
		
		break;

	
		/*case  'photo_btn':
		document.getElementById("photo_btn").className="photo_delivered_img_sel";
		
		document.getElementById("gift_cards_btn").className="gift_cards_img";	
		document.getElementById("online_savings_btn").className="online_savings_img";	
		document.getElementById("shopping_history_btn").className="shopping_history_img";	
		document.getElementById("express_list_btn").className="express_list_img";
		document.getElementById("shop_by_aisle_btn").className="shop_by_aisle_img";
		document.getElementById("bus_delivery_btn").className="business_delivery_img";
	
		
		break;*/
		
		
		case  'bus_delivery_btn':
		document.getElementById("bus_delivery_btn").className="business_delivery_img_sel";
		
		//document.getElementById("gift_cards_btn").className="gift_cards_img";	
		document.getElementById("online_savings_btn").className="online_savings_img";	
		document.getElementById("shopping_history_btn").className="shopping_history_img";	
		document.getElementById("express_list_btn").className="express_list_img";
		document.getElementById("shop_by_aisle_btn").className="shop_by_aisle_img";
		//document.getElementById("photo_btn").className="photo_delivered_img";
	
		
		break;
	
	
	
	}
	

}


