function DisplayHeader(num)
{

   var colors = new Array(10);
   var i;
   for (i=0; i<10; i++) {
      colors[i] = "#6080C0";
   }
   
   colors[num] = "#88AACC ID='idSelected'";

   document.write("<table width='100%' cellpadding='0' cellspacing='0' border='0'>");
   document.write("<td height='80' width='100' rowspan='1'><img src='/images/nwlogo.gif' height='80' width='100' border='0' alt='Northwest Software Systems,Inc.'></td>");
   document.write("<td valign='top' nowrap colspan='1' colspan='1' CLASS='HeaderTable' width='90%'>");
   document.write("<table cellpadding='0' height='40' cellspacing='0' border='0' width=100%>");
   document.write("<th bgcolor=#6080C0 height='40'> ....... </th>");
   document.write("<td bgcolor=" + colors[0] + " align='middle'> <a href='http://www.handepos.com'> Home </a></td>");
   document.write("<td bgcolor=" + colors[1] + " align='middle'> <a href='http://www.handepos.com/products/'> Products </a></td>");
   document.write("<td bgcolor=" + colors[2] + " align='middle'> <a href='http://www.handepos.com/solutions/'> Solutions </a></td>");
   document.write("<td bgcolor=" + colors[3] + " align='middle'> <a href='http://www.handepos.com/sales/'> Sales </a></td>");
   document.write("<td bgcolor=" + colors[4] + " align='middle'> <a href='http://www.handepos.com/support/'> Support </a></td>");
   document.write("<td bgcolor=" + colors[5] + " align='middle'> <a href='http://www.handepos.com/company/'> Company </a></td>");
   document.write("<th bgcolor=#6080C0> ....... </th>");
   document.write("<tr>");
   document.write("<th height='40' colspan='3' align='left' valign='bottom'> <font size=1 face='arial'> Northwest Software Systems,Inc. </font></th>");
   document.write("</table>");
   document.write("</td>");
   document.write("</table>");

}

function DisplaySolutionsLeftBar()
{
   document.write("<td width='20%' valign='top'>\n");
   document.write("	<table width='80%' cellpadding='7' cellspacing='0' border='1' bgcolor=#6080C0>\n");
//   document.write("	<table width='80%' cellpadding='2' cellspacing='0' border='0' bgcolor=#D0D0D0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader'> Solutions </td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/wireless.html'> Go Wireless! </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/small.html'> Small Restaurants </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/large.html'> Large Restaurants</a> </td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/fastfood.html'> Fast Food </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/hotels.html'> Hotels </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/cruiseships.html'> Cruise Ships </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/stadiums.html'> Stadiums </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/backoffice.html'> Back Office </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/solutions/internetorders.html'> Internet Ordering </a></td>\n");
//   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	</table>\n");
   document.write("</td>\n");

}

function DisplayProductsLeftBar(num)
{
   document.write("<td width='20%' valign='top'>\n");
   document.write("	<table width='80%' cellpadding='7' cellspacing='0' border='1' bgcolor=#6080C0>\n");
//   document.write("	<table width='80%' cellpadding='2' cellspacing='0' border='0' bgcolor=#D0D0D0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader' align='center'> Products </td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0><a href='http://www.northwestsoftware.com/products/menumaker.html'> HAND<font face='Brushscript'><i>e</i></font>-Menu<sup>TM</sup></a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0><a href='http://www.northwestsoftware.com/products/restaurantserverplus.html'>HAND<font face='Brushscript'><i>e</i></font>-Base<sup>TM</sup></a> </td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0><a href='http://www.northwestsoftware.com/products/wirelesspospro.html'> HAND<font face='Brushscript'><i>e</i></font>-Wireless<sup>TM</sup></a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0><a href='http://www.northwestsoftware.com/solutions/internetorders.html'> HAND<font face='Brushscript'><i>e</i></font>-Net<sup>TM</sup></a></td>\n");
//   document.write("	<tr>\n");
   document.write("	</table>\n");
   
   document.write("<br>\n");

   if (num == 0)
   {
   document.write("	<table width='80%' cellpadding='2' cellspacing='0' border='1' bgcolor=#D0D0D0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader2' align='center'> Specs </td>\n");
   document.write("	<tr>\n");
   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;OS Windows 2000/NT/XP</td>\n");
   document.write("	<tr>\n");
   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	</table>\n");
   }
   else if (num == 1)
   {
   document.write("	<table width='80%' cellpadding='6' cellspacing='0' border='1' bgcolor=#D0D0D0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader2' align='center'> Specs </td>\n");
   document.write("	<tr>\n");
   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;OS Windows 2000/NT/XP</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;Min 128 Meg RAM</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;15\" or larger VGA monitor with resolution of at least 1024x768</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;Windows 2000/NT/XP compatible touchscreen or mouse</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;OPOS receipt printer or standard windows printer</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;Standard Ethernet LAN card</td>\n");
   document.write("	<tr>\n");
   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	</table>\n");
   }
   else if (num == 2)
   {
   document.write("	<table width='80%' cellpadding='6' cellspacing='0' border='1' bgcolor=#D0D0D0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader2' align='center'> Specs </td>\n");
   document.write("	<tr>\n");
   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;Microsoft Pocket PC version 3.0 or higher</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;802.11b compatible wirless (WLAN) CompactFlash card</td>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItemText'>&#149;802.11b compatible wireless router or access point(s)</td>\n");
   document.write("	<tr>\n");
   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	</table>\n");
   }
   
   
   document.write("</td>\n");

}

function DisplaySupportLeftBar()
{
   document.write("<td width='20%' valign='top'>\n");
   document.write("	<table width='80%' cellpadding='7' cellspacing='0' border='1' bgcolor=#6080C0>\n");
//   document.write("	<table width='80%' cellpadding='2' cellspacing='0' border='0' bgcolor=#D0D0D0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader'> Support </td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/sales/moreinfo.html'> Request More Info. </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/support/joinusers.html'> Join Our User Group</a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
//   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/support/faq.html'> Frequently Asked Questions</a> </td>\n");
//   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0> <a href='http://www.northwestsoftware.com/support/bugreport.html'> Bug/Feature Report </a></td>\n");
//   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
//   document.write("	<td class='LeftMenuItem'> <a href='http://www.northwestsoftware.com/support/onlinedocs.html'> Documentation </a></td>\n");
//   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	</table>\n");
   document.write("</td>\n");

}

function DisplaySalesLeftBar()
{
   document.write("<td width='20%' valign='top'>\n");
   document.write("	<table width='80%' cellpadding='7' cellspacing='1' border='1' bgcolor=#6080C0>\n");
   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuHeader'> Sales </td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0 width='90%'> <a href='http://www.northwestsoftware.com/sales/moreinfo.html'> Request More Info. </a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0 width='90%'> <a href='http://www.northwestsoftware.com/sales/quote.html'> Request a Quote</a></td>\n");
   document.write("	<tr>\n");
//   document.write("	<th> <hr width='50%' size='1' align='left' NOSHADE></th>\n");
//   document.write("	<tr>\n");
   document.write("	<td class='LeftMenuItem' bgcolor=#D0D0D0 width='90%'> <a href='http://www.northwestsoftware.com/sales/pricing.html'> Pricing </a> </td>\n");
//   document.write("	<tr>\n");
//   document.write("	<th> <hr width='100%' size='2' align='left' NOSHADE></th>\n");
   document.write("	</table>\n");
   document.write("</td>\n");

}

  function isEmail(string) {

     if (!string) return false;
     var iChars = "*|,\":<>[]{}`\';()&$#%";

     for (var i = 0; i < string.length; i++) {
        if (iChars.indexOf(string.charAt(i)) != -1)
           return false;
     }
     return true;
  }
  function isProper(string) {

     if (!string) return false;
     var iChars = "*|,\":<>[]{}`\';()@&$#%";

     for (var i = 0; i < string.length; i++) {
        if (iChars.indexOf(string.charAt(i)) != -1)
           return false;
     }
     return true;
  }


function ValidateUserLogin(myForm)
{

// both fields must be filled out before continuing...
   if (myForm.UserName.value == "" ||
       myForm.password.value == "")
   {
      window.location.href = "/support/userloginerror.html";
   }
   else
   {
      myForm.submit();
   }
}

function ValidateMoreInfo(myForm)
{
   var submit=1;
   if (myForm.realname.value == "")
   {
      submit=0;
      alert("You must fill out the Name parameter");
   }
   if (isProper(myForm.realname.value) == false) {
      submit=0;
      alert("Please enter a valid username.");
      myForm.realname.focus();
   }

   if (myForm.ContactPreference.selectedIndex == 0)
   {
      submit=0;
      alert("You must tell us how to contact you.");
   }
   else if (myForm.ContactPreference.selectedIndex == 1) // contact by phone -- need a number
   {
      if (myForm.Phone.value == "")
      {
        submit=0;
        alert("Please give us a phone number to contact.");
      }
   }
   else if (myForm.ContactPreference.selectedIndex == 2) // contact by email -- need an email
   {
      if (myForm.email.value == "")
      {
        submit=0;
        alert("Please give us an e-mail address to contact.");
      }
      else if (isEmail(myForm.email.value) == false) {
          submit=0;
          alert("Please enter a valid email address.");
          myForm.email.focus();
      }
   }
   else if (myForm.ContactPreference.selectedIndex == 3) // contact by mail -- need an address
   {
      if (myForm.StreetAddress.value == "" || myForm.City.value == "" || myForm.State.value == "" || myForm.Zip.value == "")
      {
        submit=0;
        alert("Please give us a complete address to contact.");
      }
   }
   if (myForm.Specialty.selectedIndex == 0)
   {
      submit=0;
      alert("Please tell us what field you are in.");
   }
   if (submit)
   {
      myForm.submit();
   }
}

function ValidateQuote(myForm)
{
   var submit=1;
   if (myForm.realname.value == "")
   {
      submit=0;
      alert("You must fill out the Name parameter");
   }
   else if (isProper(myForm.realname.value) == false) {
      submit=0;
      alert("Please enter a valid username.");
      myForm.realname.focus();
   }

   if (myForm.ContactPreference.selectedIndex == 0)
   {
      submit=0;
      alert("You must tell us how to contact you.");
   }
   else if (myForm.ContactPreference.selectedIndex == 1) // contact by phone -- need a number
   {
      if (myForm.Phone.value == "")
      {
        submit=0;
        alert("Please give us a phone number to contact.");
      }
   }
   else if (myForm.ContactPreference.selectedIndex == 2) // contact by email -- need an email
   {
      if (myForm.email.value == "")
      {
        submit=0;
        alert("Please give us an e-mail address to contact.");
      }
      else if (isEmail(myForm.email.value) == false) {
          submit=0;
          alert("Please enter a valid email address.");
          myForm.email.focus();
      }
   }
   if (myForm.Specialty.selectedIndex == 0)
   {
      submit=0;
      alert("Please tell us what field you are in.");
   }
   if (myForm.ServerHardware.value == "" || myForm.ClientHardware.value == "" || myForm.NumWireless.value == "" 
      || myForm.ReceiptHardware.value == "" || myForm.RegisterHardware.value == "")
   {
      submit=0;
      alert("Please fill out all fields in red.");
   }
   if (submit)
   {
      myForm.submit();
   }
}

function ValidateJoinUsers(myForm)
{

// email must be filled in...
   if (myForm.email.value == "")
   {
      alert("You must enter an e-mail address.");
   }
   else if (isEmail(myForm.email.value) == false) {
       submit=0;
       alert("Please enter a valid email address.");
       myForm.email.focus();
   }
   else
   {
      myForm.submit();
   }
}
