<!--

//****************************************************************************************  
//**************************  UTILITY FUNCTIONS *******************************************

  function IsNumeric( strString )
  {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
  }


  function formatDecimal(argvalue, addzero, decimaln) 
  {
    var numOfDecimal = (decimaln == null) ? 2 : decimaln;
    var number = 1;

    number = Math.pow(10, numOfDecimal);

    argvalue = Math.round(parseFloat(argvalue) * number) / number;
    // If you're using IE3.x, you will get error with the following line.
    // argvalue = argvalue.toString();
    // It works fine in IE4.
    argvalue = "" + argvalue;

    if (argvalue.indexOf(".") == 0)
      argvalue = "0" + argvalue;

    if (addzero == true) {
      if (argvalue.indexOf(".") == -1)
        argvalue = argvalue + ".";

      while ((argvalue.indexOf(".") + 1) > (argvalue.length - numOfDecimal))
        argvalue = argvalue + "0";
    }
    return argvalue;
  }
  

  function getRadioValue( radio )
  {
   for (var i = 0; i < radio.length; i++)
    {   
      if (radio[i].checked) { break }
    }
    if( i == radio.length )
      return -1;
    else
      return radio[i].value;
  }
  

  function openWindow(url, w, h) {
      var options = "width=" + w + ",height=" + h + ",";
      options += "resizable=no,scrollbars=no,status=no,";
      options += "menubar=no,toolbar=no,left=0,top=0,directories=no";
      var newWin = window.open(url, 'newWin', options);
      newWin.focus();
    }

  function openWindowScroll(url, w, h) {
      var options = "width=" + w + ",height=" + h + ",";
      options += "resizable=no,scrollbars=yes,status=no,";
      options += "menubar=no,toolbar=no,left=0,top=0,directories=no";
      var newWin = window.open(url, 'newWin', options);
      newWin.focus();
    }

//****************************************************************************************  






//****************************************************************************************  
//**************************  PRODUCT FUNCTIONS *******************************************

  function ConfirmDelete( )
  {
    if( confirm("Are you sure you wish to delete this entry?") )
      return true;
    else
      return false;
  }

  function ConfirmRemove( )
  {
    if( confirm("Are you sure you wish to remove this item from your cart?") )
      return true;
    else
      return false;
  }


  function CheckStepTwoCD( )
  {
    var intGroup   = document.steptwo.intGroup.value;
    var typeID     = document.steptwo.typeID.value;    
    var intProdQty = document.steptwo.intProdQty.value;
    
    if( typeID == 0 ) 
    {
      alert("You must select a disc type.");
      return false;
    }
    if( intProdQty == 0 ) 
    {
      alert("You must select a quantity.");
      return false;
    }    
    return true;
  }  


  function CheckStepThreeCD( )
  {
    var intGroup   = document.stepthree.intGroup.value;
    var typeID     = document.stepthree.typeID.value;    
    var intProdQty = document.stepthree.intProdQty.value;
    var dpID       = getRadioValue( document.stepthree.dpID );
    if( dpID == -1 ) 
    {
      alert("You must choose a disc printing option.");
      return false;
    }

    return true;
  }     


  function CheckStepFourCD( )
  {
    var intGroup    = document.stepfour.intGroup.value;
    var typeID      = document.stepfour.typeID.value;    
    var intProdQty  = document.stepfour.intProdQty.value;
    var dpID        = document.stepfour.dpID.value;  
    var packID      = getRadioValue( document.stepfour.packID );
    
    if( packID == -1 ) 
    {
      alert("You must choose a packaging option.");
      return false;
    }

    return true;
  }   


  function CheckStepFiveCD( )
  {
    var intGroup    = document.stepfive.intGroup.value;
    var typeID      = document.stepfive.typeID.value;    
    var intProdQty  = document.stepfive.intProdQty.value;
    var dpID        = document.stepfive.dpID.value;  
    var packID      = document.stepfive.packID.value;      
    var inoptID     = getRadioValue( document.stepfive.inoptID );
    
    if( inoptID == -1 ) 
    {
      alert("You must choose an insert option.");
      return false;
    }

    return true;
  }      
  
//****************************************************************************************  


//****************************************************************************************  
//**************************  SHOPPING CART FUNCTIONS ************************************


  function CheckLogin( )
  {
    if( document.accountlogin.strEmail.value == "" || document.accountlogin.strEmail.value.search("@") == -1  || document.accountlogin.strEmail.value.indexOf(".") == -1 ) 
    {
      alert("You must enter a valid email address.");
      return false;
    }
    if( document.accountlogin.strPass.value == "" )
    {
      alert("You must enter a password.");
      return false;
    }
    return true;
  } 


  function CheckAdminLogin( )
  {
    if( document.loginform.strUser.value == "" ) 
    {
      alert("You must enter your username.");
      return false;
    }
    if( document.loginform.strPass.value == "" )
    {
      alert("You must enter your password.");
      return false;
    }
    return true;
  } 

  function CheckPassword( )
  {
    if( document.lostpassword.strEmail.value == "" || document.lostpassword.strEmail.value.search("@") == -1  || document.lostpassword.strEmail.value.indexOf(".") == -1 ) 
    {
      alert("You must enter a valid email address.");
      return false;
    }    
  }


  function CheckPOBox( )
  {
    var sAdd = new Array(4);
    sAdd[0] = document.forms[0].strAddress1.value;
    sAdd[1] = document.forms[0].strAddress2.value;    
    sAdd[2] = document.forms[0].strSAddress1.value;
    sAdd[3] = document.forms[0].strSAddress2.value;

    for( var i=0; i < 4; i++ )
    {
      if( sAdd[i].indexOf("PO ") == 0 || sAdd[i].indexOf("P.O.") == 0 ||  sAdd[i].indexOf("po ") == 0 || sAdd[i].indexOf("p.o.") == 0 )
      {

        if( document.forms[0].intDeliver[1].checked && ( sAdd[i].indexOf("PO ") == -1 && sAdd[i].indexOf("P.O.") == -1 && sAdd[i].indexOf("po ") == -1 && sAdd[i].indexOf("p.o.") == -1) )
          return true;
        else
          if( !confirm("UPS does not deliver to PO Box addresses.\n\nIf your billing information is a PO Box, please also enter a 2nd address in the bottom form using a street address.\n\nClick OK to ignore and go to the next step.\nClick CANCEL to edit your address.") )
            return false;         
      }
    }
    return true;
  }


  function CheckAccount( )
  {
    if( document.contact.strEmail.value == "" || document.contact.strEmail.value.search("@") == -1  || document.contact.strEmail.value.indexOf(".") == -1 ) 
    {
      alert("You must enter an e-mail address."); 
      return false;
    }
    if( document.contact.strPassword ) 
    {
      if( document.contact.strPassword.value == ""  ||  document.contact.strPassword2.value == "" ) 
      {
        alert("You must enter a password, and then re-type it.");
        return false;
      }
      if( document.contact.strPassword.value != document.contact.strPassword2.value ) 
      {
        alert("Your passwords don't match.");
        return false;
      }
    }
    if( document.contact.strFname.value == "" ) 
    {
      alert("You must enter a first name for billing."); 
      return false;
    }
    if( document.contact.strLname.value == "" ) 
    {
      alert("You must enter a last name for billing."); 
      return false;
    }
    if( document.contact.strAddress1.value == "" ) 
    {
      alert("You must enter an address for billing."); 
      return false;
    }
    if( document.contact.strCity.value == "" ) 
    {
      alert("You must enter a city for billing."); 
      return false;
    }
    var i = document.contact.strCountry.selectedIndex 
    if( document.contact.strCountry.options[i].value != "US" )
    {
      if( document.contact.strProvince.value == "" ) 
      {
        alert("You must enter a province for billing.");
        return false;
      }
      if( document.contact.strZip.value == "" ) 
      {
        alert("You must enter a ZIP for billing."); 
        return false;
      }
    }
    else
    {
      if( document.contact.strState.value == "" ) 
      {
        alert("You must enter a state for billing."); 
        return false;
      }     
    }
    if( document.contact.strDphone.value == "" ) 
    {
      alert("You must enter a daytime phone number for billing."); 
      return false;
    }
    if( document.contact.intDeliver[1].checked )
    {
      if( document.contact.strSFname.value == "" ) 
      {
        alert("You must enter a first name for shipping."); 
        return false;
      }
      if( document.contact.strSLname.value == "" ) 
      {
        alert("You must enter a last name for shipping."); 
        return false;
      }
      if( document.contact.strSAddress1.value == "" ) 
      {
        alert("You must enter an address for shipping."); 
        return false;
      }
      if( document.contact.strSCity.value == "" ) 
      {
        alert("You must enter a city for shipping."); 
        return false;
      }

      var j = document.contact.strSCountry.selectedIndex 
      if( document.contact.strSCountry.options[j].value != "US" )
      {
        if( document.contact.strSProvince.value == "" ) 
        {
          alert("You must enter a province for shipping.");
          return false;
        }
        if( document.contact.strSZip.value == "" ) 
        {
          alert("You must enter a ZIP for shipping."); 
          return false;
        }
      }
      else
      {
        if( document.contact.strSState.value == "" ) 
        {
          alert("You must enter a state for shipping."); 
          return false;
        }     
      }
      if( document.contact.strSDphone.value == "" ) 
      {
        alert("You must enter a daytime phone number for shipping."); 
        return false;
      }
    }
    if( !CheckPOBox() )
      return false;
    return true;
  }



  function CheckAddress( )
  {
    if( document.billaddress.strFname.value == "" ) 
    {
      alert("You must enter a first name for billing."); 
      return false;
    }
    if( document.billaddress.strLname.value == "" ) 
    {
      alert("You must enter a last name for billing."); 
      return false;
    }
    if( document.billaddress.strAddress1.value == "" ) 
    {
      alert("You must enter an address for billing."); 
      return false;
    }
    if( document.billaddress.strCity.value == "" ) 
    {
      alert("You must enter a city for billing."); 
      return false;
    }
    if( document.billaddress.strDphone.value == "" ) 
    {
      alert("You must enter a daytime phone number for billing."); 
      return false;
    }
    if( document.billaddress.strEmail.value == "" || document.billaddress.strEmail.value.search("@") == -1  || document.billaddress.strEmail.value.indexOf(".") == -1 ) 
    {
      alert("You must enter an e-mail address."); 
      return false;
    }
    if( document.billaddress.intDeliver[1].checked )
    {
      if( document.billaddress.strSFname.value == "" ) 
      {
        alert("You must enter a first name for shipping."); 
        return false;
      }
      if( document.billaddress.strSLname.value == "" ) 
      {
        alert("You must enter a last name for shipping."); 
        return false;
      }
      if( document.billaddress.strSAddress1.value == "" ) 
      {
        alert("You must enter an address for shipping."); 
        return false;
      }
      if( document.billaddress.strSCity.value == "" ) 
      {
        alert("You must enter a city for shipping."); 
        return false;
      }
      if( document.billaddress.strSDphone.value == "" ) 
      {
        alert("You must enter a daytime phone number for shipping."); 
        return false;
      }
    }
    if( !CheckPOBox() )
      return false;
    return true;
  }


//****************************************************************************************  
// -->