//<!-- 
  
  function CheckLogin( )
  {
    if (document.forms[0].strUsername.value == "") 
    {
      alert("You must enter your username.");
      return false;
    }
    if (document.forms[0].strPassword.value == "")
    {
      alert("You must enter a password.");
      return false;
    }
    return true;
  } 
  

  function CheckEmail( strEmail )
  {
	  if( strEmail == "" || (strEmail.search("@") == -1  || strEmail.indexOf(".") == -1) ) 
	  {
	    alert("You must enter your valid e-mail address.");
	    return false;
	  }
    else
      return true;
  }


  function getRadioValue( radio )
  {
    if( 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=yes,scrollbars=yes,status=no,";
    options += "menubar=no,toolbar=no,left=0,top=0,directories=no";
    var newWin = window.open(url, 'newWin', options);
    newWin.focus();
  }

  function openWindowMenubar(url, w, h) {
    var options = "width=" + w + ",height=" + h + ",";
    options += "resizable=yes,scrollbars=yes,status=no,";
    options += "menubar=yes,toolbar=no,left=0,top=0,directories=no";
    var newWin = window.open(url, 'newWin', options);
    newWin.focus();
  }

  function CheckProfile( )
  {
    if( document.forms[0].bDecline )
    {
      if( !document.forms[0].bDecline.checked )
      {    
          if( document.forms[0].strEmail  &&  document.forms[0].strConfirm )
          {
            var strEmail    = document.forms[0].strEmail.value;
            var strConfirm  = document.forms[0].strConfirm.value;
            if( strEmail == "" ) 
            {
              alert("You must enter email address.");
              return false;
            }
            if( strConfirm == "" ) 
            {
              alert("You must confirm your email address.");
              return false;
            }    
            if( strEmail != strConfirm )
            {
              alert("Your email address entries do not match.");
              return false;
            }
            else
            {
              CheckEmail( strEmail );
              CheckEmail( strConfirm );            
            }      
          }   
          
          if( document.forms[0].strEmail  &&  !document.forms[0].strConfirm )
          {
            var strEmail2 = document.forms[0].strEmail.value;
            if( strEmail2 == "" ) 
            {
              alert("You must enter email address.");
              return false;
            }
            if( !CheckEmail( strEmail2 ) )
              return false;
          }     
        
        
          if( document.forms[0].strFname.value == "" ) 
          {
            alert("You must enter your first name.");
            return false;
          }
          if( document.forms[0].strLname.value == "" ) 
          {
            alert("You must enter your last name.");
            return false;
          } 
          if( document.forms[0].strAddress1.value == "" ) 
          {
            alert("You must enter your address.");
            return false;
          }
          if( document.forms[0].strCity.value == "" ) 
          {
            alert("You must enter your city.");
            return false;
          }
          if( document.forms[0].strCountry )
          {
            if( document.forms[0].strCountry.value != "US" ) 
            {
              if( document.forms[0].strProvince.value == "" ) 
              {
                alert("You must enter your province.");
                return false;
              }
            }
          }
          if( document.forms[0].strState )
          {
            if( document.forms[0].strState.value == "" ) 
            {
              alert("You must enter your state.");
              return false;
            }        
          }
          if( document.forms[0].strZip.value == "" ) 
          {
            alert("You must enter your ZIP/Postal code.");
            return false;
          }
          if( document.forms[0].strCountry.value == "" ) 
          {
            alert("You must enter your country.");
            return false;
          }
      }    
    }
    return true;
  }
  


  function CheckProfileIntercept( )
  {
      if( !document.forms[0].bDecline.checked )
      {    
        if( document.forms[0].strEmail  &&  document.forms[0].strConfirm )
        {
          var strEmail    = document.forms[0].strEmail.value;
          var strConfirm  = document.forms[0].strConfirm.value;
          if( strEmail == "" ) 
          {
            alert("You must enter email address.");
            return false;
          }
          if( strConfirm == "" ) 
          {
            alert("You must confirm your email address.");
            return false;
          }    
          if( strEmail != strConfirm )
          {
            alert("Your email address entries do not match.");
            return false;
          }
          else
          {
            CheckEmail( strEmail );
            CheckEmail( strConfirm );            
          }      
        }   
        
        if( document.forms[0].strEmail  &&  !document.forms[0].strConfirm )
        {
          var strEmail2 = document.forms[0].strEmail.value;
          if( strEmail2 == "" ) 
          {
            alert("You must enter email address.");
            return false;
          }
          if( !CheckEmail( strEmail2 ) )
            return false;
        }     
        
        if( document.forms[0].strFname && document.forms[0].strLname )
        {
          if( document.forms[0].strFname.value == "" ) 
          {
            alert("You must enter your first name.");
            return false;
          }  
          if( document.forms[0].strLname.value == "" ) 
          {
            alert("You must enter your last name.");
            return false;
          }                 
        }
    }
    return true;
  }
  
  


  function CheckDate( tmp )
  {
    var re = /\-/gi
    tmp = tmp.replace(re, "/");

    var re2 = /^\d{1,2}\/\d{1,2}\/\d{2,4}/
    if( re2.exec( tmp ) ) 
    {
       return true;
    }
    return false;
  }

  
  function isValidDate(dateStr, format) {
     if (format == null) { format = "MDY"; }
     format = format.toUpperCase();
     if (format.length != 3) { format = "MDY"; }
     if ( (format.indexOf("M") == -1) || (format.indexOf("D") == -1) ||  (format.indexOf("Y") == -1) ) { format = "MDY"; }
     if (format.substring(0, 1) == "Y") { // If the year is first
        var reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
        var reg2 = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/
     } else if (format.substring(1, 2) == "Y") { // If the year is second
        var reg1 = /^\d{1,2}(\-|\/|\.)\d{2}\1\d{1,2}$/
        var reg2 = /^\d{1,2}(\-|\/|\.)\d{4}\1\d{1,2}$/
     } else { // The year must be third
        var reg1 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{2}$/
        var reg2 = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
     }
     // If it doesn't conform to the right format (with either a 2 digit year or 4 digit year), fail
     if ( (reg1.test(dateStr) == false) && (reg2.test(dateStr) == false) ) { return false; }
     var parts = dateStr.split(RegExp.$1); // Split into 3 parts based on what the divider was
     // Check to see if the 3 parts end up making a valid date
     if (format.substring(0, 1) == "M") { var mm = parts[0]; } else 
        if (format.substring(1, 2) == "M") { var mm = parts[1]; } else { var mm = parts[2]; }
     if (format.substring(0, 1) == "D") { var dd = parts[0]; } else 
        if (format.substring(1, 2) == "D") { var dd = parts[1]; } else { var dd = parts[2]; }
     if (format.substring(0, 1) == "Y") { var yy = parts[0]; } else 
        if (format.substring(1, 2) == "Y") { var yy = parts[1]; } else { var yy = parts[2]; }
     if (parseFloat(yy) <= 50) { yy = (parseFloat(yy) + 2000).toString(); }
     if (parseFloat(yy) <= 99) { yy = (parseFloat(yy) + 1900).toString(); }
     var dt = new Date(parseFloat(yy), parseFloat(mm)-1, parseFloat(dd), 0, 0, 0, 0);
     if (parseFloat(dd) != dt.getDate()) { return false; }
     if (parseFloat(mm)-1 != dt.getMonth()) { return false; }
     return true;
  }  


  function CloseAndRefresh( )
  {
    window.opener.location.reload();
    this.close();
    return true;
  }


  function getCheckCount( skey, qna )
  {
    var sStr, j = 0;
    for( var i=1; i <= qna; i++ )
    {
      sStr = skey + "_" + i
      if( eval("document.forms[0]." + sStr + ".checked") ) 
      {
        j++;
      }
    }
    return j;
  }

  function IsNumeric( strString )
  {
    var strValidChars = "0123456789.";
    var strChar;
    var blnResult = true;
    var intPeriods = 0;

    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( strChar == "." )  
      {
        intPeriods += 1;
        if( intPeriods > 1 ) 
          blnResult = false;
      }
      if (strValidChars.indexOf(strChar) == -1)
        blnResult = false;
    }
    return blnResult;
  }
  
  
  function IsNumericWhole( strString )
  {
    var strValidChars = "0123456789-";
    var strChar;
    var blnResult = true;
    var intPeriods = 0;

    if( strString == null )  return false;
    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( strChar == "." )  
      {
        intPeriods += 1;
        if( intPeriods > 1 ) 
          blnResult = false;
      }
      if (strValidChars.indexOf(strChar) == -1)
        blnResult = false;
    }
    return blnResult;
  }
// -->
