function display_email(part2, part1, part3, link) {
email=(part1 + '@' + part2 + part3);
if (link) {
    email=link + '<' + email + '>';
}
else {
    link=email;
}
return ('<a href="mailto:' + email + '">' + link + '</a>');
}
//    *    *    *    *    *    *    *    *    *
function limitText(limitField, limitCount, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    }
    else {
        limitCount.value = limitNum - limitField.value.length;
    }
}
//    *    *    *    *    *    *    *    *    *
function setfocus(){  // not used - from http://www.java2s.com/Code/JavaScript/Form-Control/Focusaninputfield.htm
    document.forms[0].field.focus();

}
//    *    *    *    *    *    *    *    *    *
function universal_popup(mylink, windowname, width, height, x_pos, y_pos)
// sets default
{
    if (!window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
//    window_handle = window.open(href, windowname, 'scrollbars=1,resizable=1');
    window_handle = window.open(href, windowname, 'scrollbars=1,resizable=1,location=0,titlebar=0');
    if (!width) {
        width=400;  // default size
        height=400;
    }
    window_handle.resizeTo(width, height);
    if (!x_pos) {
        x_pos=200;  // default position
        y_pos=100;
    }
    if (window_handle.screenX == 0) {
        window_handle.moveTo(x_pos, y_pos);
    }
window_handle.focus();
return false;
}
//  autoTab.js - from Medicare web site.
//
//  Example call:
//    <input type="text" id="firstname" name="" size=20
//          onKeyup="autoTab(event, this, 'surname')" maxlength=20>
//    <input type="text" id="surname" name="" size=20 maxlength=20>
//
//  e is the current event, ie a keyPress
//  tabFrom is the current element with focus
//  tabTo is the element id to tab to (new focus)

function autoTab(e, tabFrom, tabTo) {

  switch (e.keyCode) {
    //Ignore navigation type Keys
    case 9:
      //Tab Key
      break
    case 16:
      //Shift Key (used with Tab to move backwards)
      break
    case 35:
      //End Key
      break
    case 36:
      //Home Key
      break
    case 37:
      //Up Arrow
      break
    case 38:
      //Right Arrow
      break
    case 39:
      //Down Arrow
      break
    case 40:
      //Left Arrow
      break
    default:
      //Check the tab field allows the Attribute property
      if (tabFrom.getAttribute) {

        //AutoTab for Text input field
        if (tabFrom.getAttribute("type") == "text" || tabFrom.getAttribute("type") == "password") {

          //Check the Input field maximum length
          if (tabFrom.value.length == tabFrom.getAttribute("maxlength")) {
            //AutoTab
            document.getElementById(tabTo).focus();
          }
        }
      }
  }
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function changeOption()
{
    x=document.getElementsByTagName('form')[0];
    x.id='changed';
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function formSubmit()
{
    x=document.getElementsByTagName('form')[0];
    if (x.id=='changed') {
        r=alert('One or more of the action options have been changed.\nUpdate the settings before returning.');
    }
    else {
        window.location.assign("admin_class.php");
    }
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function popup_cart_delivery(mylink, windowname)
{
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window_handle = window.open(href, windowname, 'width=420,height=450,scrollbars=1,resizable=1');
    window_handle.focus();
    return false;
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function popup_grain_mills_large(mylink, windowname)
{
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window_handle = window.open(href, windowname, 'width=900,height=800,scrollbars=1,resizable=1');
    window_handle.moveTo(50,50);
    window_handle.focus();
    return false;
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function popup(mylink, windowname)
{
    if (!window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window_handle = window.open(href, windowname, 'width=820,height=550');
    window_handle.focus();
    return false;
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function popup_portrait(mylink, windowname)
{
    if (!window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window_handle = window.open(href, windowname, 'width=420,height=620');
    window_handle.focus();
    return false;
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function popup_small(mylink, windowname)
{
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window_handle = window.open(href, windowname, 'width=400,height=300');
    window_handle.focus();
    return false;
}
//  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *
function popup_delivery(mylink, windowname)
{
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window_handle = window.open(href, windowname, 'width=840,height=620,scrollbars=1,resizable=1');
    window_handle.focus();
    return false;
}

    function popUp(URL)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0');");
}




