var iCountry;

var Validity = eval(stateParmStr);
if(Validity == 'invalid') { areParms = -1; }

if (areParms < 0)	// Top level Store page
{
	p("<table cols=3 rows=2 cellspacing=0 cellpadding=0 border=0>");
	p("<tr height=1><td width=6 rowspan=2></td><td width=340></td><td width=340></td></tr>");
	p("<tr height=386>");

	p("<td valign=top>");
      p("<img src=Images/InsideUsaStores274x27.jpg width=274 height=27>");

	p("<div align=left>");
	p("<b>");
	var iState;
	for(iState = 1; iState < USA.length; iState++)
	{
		var initState = 0;
		var State = USA[iState];
		if(State)
		{
			StateUC = State[0].toUpperCase();
			StateNoSpaces = State[0];
			StateNoSpaces = StateNoSpaces.replace('\ ', '');
			if(StateUC == 'ONLINE') p("<br>");
			p("<a STYLE='text-decoration:none' href=?S=" + StateNoSpaces + "><font face=arial color=red size=2>" + StateUC + "</font></a><br>");
		}
	}
	p("</b>");
	p("</div>");

      p("</td>");

	p("<td valign=top>");
	p("<img src=Images/OutsideUsaStores326x27.jpg width=326 height=27>");

	p("<div align=left>");
	p("<b>");
	var iState;
	for(iState = 1; iState < USA.length; iState++)
	{
		var initState = 0;
		var State = INTERNATIONAL[iState];
		if(State)
		{
			StateUC = State[0].toUpperCase();
			StateNoSpaces = State[0];
			StateNoSpaces = StateNoSpaces.replace('\ ', '');
			p("<a style='text-decoration:none;color:red' href=?S=" + StateNoSpaces + "><font face=arial size=2>" + StateUC + "</font></a><br><br>");
			//p("<a style='text-decoration:none' href=?S=" + StateNoSpaces + "><font face=arial color=red size=2>" + StateUC + "</font></a><br><br>");
		}
	}
	p("</b>");
	p("</div>");

      p("</td>");

	p("</tr>");
	p("</table>");

	p("<br>");
}

else	// Expand a particular state or foreign country
{
	p("<div align=left valign=top>");
	for(iCountry = 1; iCountry < Earth.length; iCountry++)
	{
		var initCountry = 0;
		var Country = Earth[iCountry];
		if(Country)
		{
			var iState;
			for(iState = 1; iState < Country.length; iState++)
			{
				var initState = 0;
				var State = Country[iState];
				StateNoSpaces = State[0];
				StateNoSpaces = StateNoSpaces.replace('\ ', '');

				// If it's the right state or foreign country, then expand it
				if(StateNoSpaces == stateParmStr || StateNoSpaces == stateParmStr.toUpperCase())
				{
					p("<b><font face=arial color=#6B2446 size=+0>"+State[0].toUpperCase()+"</font></b>");
					p("<hr color=#6B2446 size=1 width=650 align=left>");

					var LeftStr = '';
					var RightStr = '';
					var LeftCount = 0;
					var RightCount = 0;

					var iCity;
					for(iCity = 1; iCity < State.length; iCity++)
					{
						var TempStr = '';
						var TempCount = 0;
						var City = State[iCity];
						if(City)
						{
							var CityUC = City[0].toUpperCase();
							if(CityUC != ' ')
							{
								TempStr = "<b><font face=arial color=#A3063B size=2>"+CityUC+"</font></b><br><br>";
							}

							var iStore;
							for(iStore = 1; iStore < City.length; iStore++)
							{
								var Store = City[iStore];
								if(Store)
								{
									TempStr += "<font face=arial size=2>"+Store+"</font><br><br>";
									TempCount++;
								}
							}
						}
						if(LeftCount <= RightCount) { LeftStr += TempStr; LeftCount += TempCount; }
						else { RightStr += TempStr; RightCount += TempCount; }
					}
					p("<table cols=3 rows=1 cellspacing=0 cellpadding=0 border=0>");
					p("<tr><td width=300 valign=top>"+LeftStr+"</td><td width=25></td><td width=300 valign=top>"+RightStr+"</td></tr>");
					p("</table>");
				}
			}
		}
	}
	p("</div>");
}
