<!--

//################################
var sSiteURL = "<%=link%>";
var	sLoc = "http://www.bedbathandbeyond.com/";
var	sTest = "BBBY";
if ( sTest == "BBI" )
	sLoc = "http://estore.bedbath.com/";
var cookieStoreNum = null;
if ( !( cookieStoreNum = GetCookie("store%5Fnumber") ) )
        cookieStoreNum = "";
var cookieKioskMode = null;
if ( !( cookieKioskMode = GetCookie("kiosk%5Fmode") ) )
        cookieKioskMode = 0;
var cookieAuth = null;
if ( !( cookieAuth = GetCookie("valid%5Fip") ) )
        cookieAuth = 0;
//################################

var sBT = null;
if ( GetCookie( "bridal" ) )
{
	sBT = GetCookie( "bt" );
	if ( !sBT )
		sBT = 0;
}

var sSubTotal = GetCookie( "subtotal" );
if ( !sSubTotal )
	sSubTotal = "<b>0</b>&nbsp;item(s)&nbsp;&nbsp;<br>sub-total:&nbsp;<b>$0.00</b>&nbsp;&nbsp;<br>excludes&nbsp;gift&nbsp;cards&nbsp;&nbsp;";



function GetCookie( name )
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;

	while (i < clen)
	{
		var j = i + alen;
		if ( document.cookie.substring( i, j ) == arg )
			return getCookieVal ( j );
		i = document.cookie.indexOf(" ", i ) + 1;
		if ( i == 0 )
			break;
	}

	return null;
}

function getCookieVal( offset )
{
	var endstr = document.cookie.indexOf ( ";", offset );

	if ( endstr == -1 )
		endstr = document.cookie.length;

	return unescape( document.cookie.substring( offset, endstr ) );
}

function getURLArgs()
{
	var bFoundOrder = false;
	var sArgs = "?";
	var sUrl = document.location.href;
	var sParts = sUrl.split( "?" );
	var sQuery = new Array();
	var sParam = new Array();
	var order_num, i;

	if ( sParts.length > 1 )
	{
		sQuery = sParts[1].split( "&" );
		i = 0;
		while( i < sQuery.length )
		{
			sParam = sQuery[i].split( "=" );
			if ( sParam[0] == "order_num" )
			{
				sArgs += "order_num=" + sParam[1] + "&";
				bFoundOrder = true;
			}
			if ( sParam[0].toUpperCase() == "BRN" )
				sArgs += "BRN=" + sParam[1] + "&";
			if ( sParam[0].toUpperCase() == "WRN" )
				sArgs += "WRN=" + sParam[1] + "&";
			if ( sParam[0].toUpperCase() == "MC" )
				sArgs += "MC=" + sParam[1] + "&";
			i++;
		}
		if ( !bFoundOrder )
			sArgs += "order_num=-1&";
	}
	else
		sArgs = "?order_num=-1&";

	return sArgs;
}

function go()
{
	var sSearchText = document.search_prod.search.value;

	if ( sSearchText == "enter keyword" || sSearchText == "" || sSearchText == " " )
		return false;

	var BTSmodeArgs = "";
	if ( document.search_prod.section.value == '3' )
		BTSmodeArgs = "BTSmode=true&";

	while ( sSearchText.substring( 0, 1 ) == ' ')
		sSearchText = sSearchText.substring( 1 );

	while ( sSearchText.substring( sSearchText.length-1, sSearchText.length ) == ' ' )
		sSearchText = sSearchText.substring( 0, sSearchText.length-1 );

	document.search_prod.search.value = sSearchText

	var len = sSearchText.length;
	var strOut = "";
	var i = 0;
	var j = 0;
	while (i < len)
	{
		j = sSearchText.indexOf( " ",i );
		if (j > i)
		{
			strOut += sSearchText.substring( i, j ) + "+";
			i = j + 1;
		}
		else
		{
			strOut += sSearchText.substring( i, len );
			i = len;
		}
	}
	window.location = "/searchSKU.asp" + getURLArgs() + "SSTR=" + strOut + "&" + BTSmodeArgs;

	return false;
}

function getHours(s)
{
	var sep1 = ', ';
	var sep2 = ': ';
	var sByDay = s.split(sep1);
	var sDay = '';
	var sHour = '';
	var sRows = '<table border=0 cellspacing=0 cellpadding=0>';
	for ( var i=0; i < sByDay.length; i++ )
	{
		sDay = sByDay[i].substring( 0, sByDay[i].indexOf(': ') + 2 );
		sHour = sByDay[i].substring( sByDay[i].indexOf(': ') + 2 );
		sRows = sRows + '<tr><td align=right><font face="Arial,Helvetica,Verdana sans-serif" size="-1">'+sDay+'&nbsp;</font></td><td align=left><font face="Arial,Helvetica,Verdana sans-serif" size="-1">' + sHour + '</font></td></tr>';
	}

	return sRows + '</table>';
}

function OpenViewWindow( sURL, width, height, scbar, tbar )
{
	if ( isNaN( width ) )
		width=390;
	if ( isNaN( height ) )
		height=427;
	if ( scbar != "yes" )
		scbar = "no";
	if ( tbar != "yes" )
		tbar = "no";

	var bars = "menubar=no,toolbar=no";
	if ( tbar == "yes" )
		bars = "menubar=yes,toolbar=yes";

	var strwindow = "toolbar=no,width=" + width + ",height=" + height + ",directories=no,status=no,scrollbars=" + scbar + "," + bars + ",resizable=yes";

	if ( navigator.appName == "Microsoft Internet Explorer" )
		strwindow = "toolbar=no,width=" + (width-10) + ",height=" + (height-5) + ",directories=no,status=no,scrollbars=" + scbar + "," + bars + ",resizable=yes";

	if ( window.screen )
	{
		var aw = screen.availWidth - 30;
		var ah = screen.availHeight - 50;
		var nwidth = width;
		var nheight = height;
		strwindow = "width=" + nwidth + ",height=" +nheight + strwindow;
		strwindow += ",left=" + ( ( aw - nwidth ) / 2);
		var nTop = ( ah - nheight ) / 2;
		if ( nTop < 0 )
			nTop = 0;
		strwindow += ",top=" + nTop;
	}

	var sWinName = "wwchild";

	if ( sURL == "http://bedbathandbeyond.custhelp.com" )
		sWinName = sWinName + "2";

	windowpic = window.open(sURL, sWinName, strwindow);
	windowpic.focus();
}

function OpenAboutWindow( sURL, width, height, scbar, tbar )
{
	if ( isNaN( width ) )
		width = 390;
	if ( isNaN( height ) )
		height = 427;
	if ( scbar != "yes" )
		scbar = "no";
	if ( tbar != "yes" )
		tbar = "no";

	var bars = "menubar=no,toolbar=no";
	if ( tbar == "yes" )
		bars = "menubar=yes,toolbar=yes";

	var strwindow = "toolbar=no,width=" + width + ",height=" + height + ",directories=no,status=no,scrollbars=" + scbar + "," + bars + ",resizable=yes";
	if ( navigator.appName == "Microsoft Internet Explorer" )
		strwindow = "toolbar=no,width=" + (width-10) + ",height=" + (height-5) + ",directories=no,status=no,scrollbars=" + scbar + "," + bars + ",resizable=yes";

	if ( window.screen )
	{
		var aw = screen.availWidth - 30;
		var ah = screen.availHeight - 50;
		var nwidth = width;
		var nheight = height;
		strwindow = "width=" + nwidth + ",height=" +nheight + strwindow;
		strwindow += ",left=" + ( ( aw - nwidth ) / 2);
		var nTop = ( ah - nheight ) / 2;
		if ( nTop < 0 )
			nTop = 0;
	        strwindow += ",top=" + nTop;
	}

	windowpic2 = window.open( sURL, "wwchild", strwindow );
	windowpic2.focus();
}

function submitNewChoice()
{
	this.location.href = document.forms["Form1"].nav.value + "&ipp=" + document.forms["Form1"].lstIPP2.value + "&brand=" + document.forms["Form1"].lstBrand2.value;
}
//-->