function Certify(URL) {
  popupWin = window.open(URL, 'Participant', 'location,scrollbars,width=450,height=415,left=175,top=50')
  window.top.name = 'opener';
}

// You can edit the following line to change the status bar message.
   var statusMsg = "Password Protected Area"
function gateKeeper() {
   gateKeeperBox = window.open('gatemain.html', 'theKeeper', 'width=230,height=100,left=275,top=215,resizable=yes');
}

function window_onload()
{

	// Set the focus to the member ID
	window.document.loginForm.User_ID.focus();

	// Select the field
	window.document.loginForm.User_ID.select();

}
function chkform(theForm)
{

	if (theForm.User_ID.value == "")
	{
		alert("You must enter a User ID.");
		theForm.User_ID.focus();
		return (false);
	}

	if (theForm.User_ID.value.length < 1)
	{
		alert("You must enter a User ID.");
		theForm.User_ID.focus();
		return (false);
	}

	if (theForm.User_ID.value.length > 64)
	{
		alert("User ID cannot be more than 64 characters.");
		theForm.User_ID.focus();
		return (false);
	}
	if (theForm.Your_Password.value == "")
	{
		alert("You must enter a password.");
		theForm.Your_Password.focus();
		return (false);
	}

	if (theForm.Your_Password.value.length < 1)
	{
		alert("You must enter a password.");
		theForm.Your_Password.focus();
		return (false);
	}

	if (theForm.Your_Password.value.length > 64)
	{
		alert("Password cannot be more than 64 characters.");
		theForm.Your_Password.focus();
		return (false);
	}

	return (true);
}

function TW_processLogin() {
// Dual Login JavaScript Routine (DealerStation/eServ)
// v.1 2004

document.loginForm.GoButton.disabled = true;

thisChoice = document.loginForm.whichROLOS;
if (thisChoice[0].checked == true) { // User selects ROLOS 3 (eServ)
            document.loginForm.user.value = document.loginForm.User_ID.value;
            document.loginForm.pw.value = document.loginForm.Your_Password.value;
            document.loginForm.action = 'http://www2.officesupply-link.com/4349/dealerstation/catalog/news.asp';
            document.loginForm.submit();
            } else { // User selects ROLOS 4 (DealerStation)
            document.loginForm.user.value = document.loginForm.User_ID.value;
            document.loginForm.pw.value = document.loginForm.Your_Password.value;
            document.loginForm.action = 'http://www2.officesupply-link.com/4349/dealerstation/catalog/news.asp';
            document.loginForm.submit();
            }
}

function CookieDef(expires,path,domain,secure)
{
  this.secure = secure;
  this.path = path;
  this.domain = domain;
  this.getValue = getCookie;
  this.setValue = setCookie;
  this.expire = deleteCookie;
  if (expires == 0) {
    this.expires = "";
  } else {
    var today_date = new Date();
	 var expire_seconds = today_date.getTime() + (expires * 24 * 60 * 60  * 1000);
    today_date.setTime(expire_seconds);
    this.expires = today_date.toGMTString();
  }
}
function getCV(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 getCV(j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return "";
}
function setCookie(name,value)
{
  document.cookie = name + "=" + escape(value) +
    ((this.expires == "") ? "" : ("; expires=" + this.expires)) +
    ((this.path == "") ? "" : ("; path=" + this.path)) +
    ((this.domain == "") ? "" : ("; domain=" + this.domain)) +
    ((this.secure == true) ? "; secure" : "");
}
function deleteCookie(name) {
  document.cookie = name + "=" + "" + "; expires=Thu,01-Jan-70 00:00:01 GMT";
}

function WA_getCookie(cookieobj, cookiename, cookieset, settype)     {
  theValue = cookieobj.getValue(cookiename);

  if (settype == 1)     {
    cookieset.value = theValue;
  }
  if (settype == 2)     {
    cookieset.checked = (String(theValue)!="" && String(theValue).toUpperCase() !="FALSE");
  }
  if (settype == 3)     {
    for (var n=0; n< cookieset.length; n++)     {
      if (cookieset[n].value == theValue)     {
        cookieset[n].checked = true;
        break;
      }
    }
  }
  if (settype == 4)     {
    for (var n=0; n< cookieset.options.length; n++)     {
      if (cookieset.options[n].value == theValue)     {
        cookieset.selectedIndex = n;
        break;
      }
    }
  }
}

function WA_setCookie(cookieobj, cookiename, cookievalue, cookiecheck, settype)     {
  var theValue = "";
  if (settype == 1)     {
    for (var n=0; n<cookievalue.length; n++)    {
      if (cookievalue[n].checked)     {
        theValue = cookievalue[n].value;
      }
    }
  }
  else      {
    theValue = cookievalue
  }

  if (cookiecheck)     {
    cookieobj.setValue(cookiename, theValue);
  }
}
function WA_deleteCookie(cookieobj, cookiename, cookiecheck)     {
  if (cookiecheck)     {
    cookieobj.setValue(cookiename, "");
    cookieobj.expire(cookiename);
  }
}

function WA_decodeCookieSelectVal(theVal)     {
  theVal = theVal.replace(/\|WACS\|/g, ", ");
  return theVal;
}

function WA_checkCookieSelectOption(theList, theOption, theVal)     {
  var testVal = "";
  if (theList.options[theOption].value)     {
    testVal = theList.options[theOption].value;
  }
  else      {
    testVal = theList.options[theOption].text;
  }
  if (testVal == WA_decodeCookieSelectVal(theVal))     {
    theList.options[theOption].selected = true;
    return true;
  }
  return false;
}
