
// buyItem - adds an item to the shooping basket
function buyItem(newNumber, newName, newPrice) {
if (confirm('Add '+newName+' to basket')) {
index = document.cookie.indexOf("TheBasket");
countbegin = (document.cookie.indexOf("=", index) + 1);
countend = document.cookie.indexOf(";", index);
if (countend == -1) {
countend = document.cookie.length;
}
document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newNumber+"|"+newName+"|"+newPrice+"]";
}
}

// resetShoppingBasket - resets to shopping basket to empty
function resetShoppingBasket() {
index = document.cookie.indexOf("TheBasket");
document.cookie="TheBasket=.";
}
function WriteGraphic(x) {
var sObject = x
var yObject=sObject+".htm"
window.open(yObject, "", 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, width=400, height=550');
}
function WriteGraphic2(x) {
//var sObject = document.DocumentForm.GrphFile.value
var yObject= x + ".htm"
var newWin=window.open(yObject, 'bbuyspecials', 'toolbar=0, location=, directories=0, status=0, menubar=0, scrollbars=1, resizable=0, width=400, height=500');
newWin.moveTo(380, 0);
}
//]]>
</script><script type="text/javascript">
//<![CDATA[
<!--
papTrack();
//-->
//]]>
</script><script language="Javascript" type="text/javascript">
//<![CDATA[

function checkform() {
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].type") == "checkbox") {
      if (document.subscribeform.elements[fieldstocheck[i]].checked) {
      } else {
        alert("Please enter your "+fieldnames[i]);
        eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
        return false;
      }
    }
    else {
      if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
        alert("Please enter your "+fieldnames[i]);
        eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
        return false;
      }
    }
  }
  for (i=0;i<groupstocheck.length;i++) {
    if (!checkGroup(groupstocheck[i],groupnames[i])) {
      return false;
    }
  }
  
  if(! compareEmail())
  {
    alert("Email Addresses you entered do not match");
    return false;
  }
  return true;
}

var fieldstocheck = new Array();
var fieldnames = new Array();
function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}
var groupstocheck = new Array();
var groupnames = new Array();
function addGroupToCheck(value,name) {
  groupstocheck[groupstocheck.length] = value;
  groupnames[groupnames.length] = name;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}
function checkGroup(name,value) {
  option = -1;
  for (i=0;i<document.subscribeform.elements[name].length;i++) {
    if (document.subscribeform.elements[name][i].checked) {
      option = i;
    }
  }
  if (option == -1) {
    alert ("Please enter your "+value);
    return false;
  }
  return true;
}


