function stopError() {
  return true;
}        
		
window.onerror = stopError;

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1) endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

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; 
  }
}

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

function LaunchPromo() {
  var Ctl = GetCookie("Popup_Control");
  var Count = GetCookie ("Popup_Counter");
  var expdate = new Date();
  Count = ((Count == null) ? 5 : (Count - 1));
  if (Count == 0) Count = 5;
  expdate.setTime (expdate.getTime() + 90 * 86400000);
  if (Ctl != "Yes") {
    if (Count == 5) {
      window.open('/cgi-bin/maillist.cgi', 'Popup_window', 'width=470,height=450,scrollbars=yes');
    }
    SetCookie ("Popup_Counter", Count, expdate, "/");
  } else {
    SetCookie ("Popup_Control", "Yes", expdate, "/");
  }	
} 

function SaveUser() {
  var expdate = new Date();
  expdate.setTime (expdate.getTime() + 90 * 86400000);
  SetCookie ("Popup_Control", "Yes", expdate, "/");
}

function TestCookie() {
  var expdate = new Date();
  expdate.setTime (expdate.getTime() + 1200);
  SetCookie ("CookieTest", "Yes", expdate, "/");
  var Tst = GetCookie ("CookieTest");
  if (Tst != "Yes") {
    window.open('/CookieInfo.html', 'Cookie_window', 'width=470,height=350,scrollbars=yes');
  }
}

function TestCookieDisplay() {
  var expdate = new Date();
  expdate.setTime (expdate.getTime() + 1200);
  SetCookie ("CookieTest", "Yes", expdate, "/");
  var Tst = GetCookie ("CookieTest");
  if (Tst != "Yes") {
    document.write('<Font Size=6 Color=RED><Strong>Browser Cookies Disabled</Strong><BR>Our Ordering System Requires Cookies<BR>Please Enable before ordering</Font>');
  }
}

 
