
var newwindow

function open_newwindow(filenam, w, h) { 
  newwindow = window.open(""+filenam+"", "newwindow", "width="+w+",height="+h+",toolbar=no, location=no,directories=no, status=no, menubar=no, resizable=no, scrollbars=no,top");
  newwindow.focus();
}

function verifyEmail(form) {

  checkEmail = form.email.value
  checkName = form.name.value
  What = form.what.value

  if ((What == "contact")&&(checkName == "")) {
    alert("Please enter your name.");
    form.name.select();
    return false;
  }

  if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) {
    alert("Your email address does not appear to be valid. Please check it.");
    form.email.select();
    return false;
  } 

  else {
    form.method="post";
    form.target="_self";
    if (What == "contact") { form.action="contact.php"; }
    if (What == "club") { form.action="cleverclub.php"; }
    form.submit();
  }
}

function ClearForm(form)  {
  form.email.value = "";
}

function verifyCheckout(form) {

  for (x=0; x<form.gift.length; x++) {
    if (form.gift[x].checked == true) { 
      giftVal = form.gift[x].value;
    } 
  } 

  if (giftVal == "1") {
    action = "gift_options.php";
  }
  else {
    action = "https://ww1.secure-transaction.com.au/cleverdicks/checkout_step1.php";
  }

  form.method = "post";
  form.target = "_self";
  form.action = action;
  form.submit();
}