<!--

function MailFriend(imageNumber) {
  winMail = window.open('mailFriend.asp?image=' + imageNumber,'MailFriend','toolbar=no,status=no,width=400,height=500');
  if (window.focus) winMail.focus();

  return false;
}

function AddTerm(form) {
  index = form.selectedIndex;
  value = form[index].value;

  if (value.length > 0) {
    termLength = document.searchform.Term.value.length;

    if (termLength > 0) {
      if (document.searchform.Term.value.charAt(termLength - 1) != " ") {
        document.searchform.Term.value += " ^ ";
      }
    }
    document.searchform.Term.value += value;
    form.selectedIndex = 0;
  }
}

function AddIdentifier(form) {
  index = form.selectedIndex;
  value = form[index].value;

  append = value + " ";
  document.searchform.Term.value += append;

  form.selectedIndex = 0;
}


function popDownloads() {
  winVD = window.open("viewDownloads.asp","checkDownloads", "width=500,height=300,resizable,scrollbars,toolbar");
  if (window.focus) winVD.focus();
  return false;
}

function verifyData(){
  if (emailCheck() == false) return false;
  if (passwordMatch() == false) return false;

  var len = document.frmUser.length;
  var i = 0;

  for (i = 0; i < len; i++) {
    var item = document.frmUser.elements[i];

    if (item.name.indexOf("db_nc_") == -1 && item.name.indexOf("db_") > -1) {
      if (item.value.length == 0) {
        var niceName = item.name.replace("db_", "");

        niceName = niceName.substring(0, 1).toUpperCase() + niceName.substring(1);

        if (niceName.indexOf("2") > -1) {
          niceName = niceName.replace("2", "");
          niceName = "Billing " + niceName;
        }

        if (niceName.indexOf("1") > -1) {
          niceName = niceName.replace("1", "");
          niceName = "Shipping " + niceName;
        };

        alert(niceName + ' is a required field');
        if (window.focus) item.focus();
        return false;
      }
    }
  }

  return true;
}

function emailCheck(){
  var a = document.frmUser.db_email.value;
  if(a.indexOf("@") == -1){
    alert('Invalid Email address - please enter again');
    document.frmUser.db_email.select();
    return false;
  }
  return true;
}


function passwordMatch() {
  if (document.frmUser.db_password.value.length < 6) {
    alert('Passwords must be at least 6 characters long');
    document.frmUser.db_password.focus();
    return false
  }

  if (document.frmUser.db_password.value != document.frmUser.verifyPassword.value) {
    alert ("Your passwords do not match - please enter again");
    document.frmUser.db_password.select();
    return false;
  }
  return true;
}

function goDefault() {
  document.location = "default.asp?member=yes"
}

function getFocus() {
  window.focus()
}

function continueBrowse() {
  window.blur()
}

function closeWindow() {
  window.close()
}

function checkUsageNotes() {
  var a = document.frm.usageNotes.value;
  if(a == ""){
    alert('The Usage Notes should not be empty.');
    document.frm.usageNotes.select();
    return false;
  }
  return true;
}


function goBasket() {
  document.location = "basket.asp"
}

function goCheckOutLast() {
  window.location="checkOutLast.asp"
}

function StartMess() {
  CopyWin = window.open('copyrght.asp','Copyright','toolbar=no,status=no,width=400,height=220');
  WarnWin = window.open('warning.asp','Warning','toolbar=no,status=no,width=400,height=200');
}

function CopyMess() {
  winCopy = window.open('copyrght.asp','Copyright','toolbar=no,status=no,width=400,height=220');
  if (document.focus) winCopy.focus();

  return false;
}

function WarnMess() {
  winWarn = window.open('warning.asp','Warning','toolbar=no,status=no,width=400,height=200');
  if (document.focus) winWarn.focus();

  return false;
}

function openDownload(image,title) {
  winHR = window.open("download.asp?image=" + image + "&title=" + title, "download", "width=580,height=320,resizable,scrollbars,toolbar");
  if (document.focus) winHR.focus();

  return false;
}

function addBasket(direct,showFormat,showQuantity) {
  if (direct > 0) {
    addString = ""
    if (showQuantity > 0) {
      quantity = document.frm.quantity.value
      addString = addString + "&quantity=" + quantity
    }
    if (showFormat > 0) {
      kind = document.frm.format.selectedIndex
      addString = addString + "&format=" + kind
    }
    winCC = window.open("checkCookie.asp?preview=no&mode=add" + addString + "&kind=" + kind, "basket", "width=650,height=420,resizable,scrollbars,toolbar")
  } else {
    winCC = window.open("checkCookie.asp?mode=add&alwaysUsage=no&preview=no", "basket", "width=650,height=420,resizable,scrollbars,toolbar")
  }

  if (document.focus) winCC.focus();
  return false;
}

function showBasket() {
  winCC = window.open("checkCookie.asp?preview=no","basket", "width=600,height=420,resizable,scrollbars,toolbar")
  if (document.focus) winCC.focus();

  return false;
}

function goCheckout() {
  winCC = window.open("checkCookie.asp?mode=checkout","basket", "width=600,height=420,resizable,scrollbars,toolbar")
  if (document.focus) winCC.focus();

  return false;
}


function addThumbBasket(direct,showFormat,showQuantity,image,title) {
  if (direct > 0) {
    addString = ""
    if (showQuantity > 0) {
      quantity = document.frm.quantity.value
      addString = addString + "&quantity=" + quantity
    }

    if (showFormat>0) {
      kind = document.frm.format.selectedIndex
      addString = addString + "&format=" + kind
    }
    addString = addString + "&image=" + image
    addString = addString + "&title=" + title

    winCC = window.open("checkCookie.asp?from=thumb&preview=no&mode=add" + addString, "basket", "width=600,height=420,resizable,scrollbars,toolbar")

  } else {
    addString = ""
    addString = addString + "&image=" + image
    addString = addString + "&title=" + title

    winCC = window.open("checkCookie.asp?from=thumb&mode=add&alwaysUsage=no&preview=no" + addString, "basket", "width=600,height=420,resizable,scrollbars,toolbar")
  }

  if (document.focus) winCC.focus();
  return false;

}

function collectionWindow() {
  winCol = window.open('collection.asp','winCol','scrollbars=yes,resizable=yes,width=400,height=300');
  if (document.focus) winCol.focus();

  return false;
}

function copyrightWindow() {
  winCopy = window.open('copyright.asp','winCopy','scrollbars=yes,resizable=yes,width=400,height=220');
  if (document.focus) winCopy.focus();

  return false;
}

function warningWindow() {
  winWarn = window.open('warning.asp','winWarn','scrollbars=yes,resizable=yes,width=400,height=200');
  if (document.focus) winWarn.focus();

  return false;
}

function helpWindow() {
  winHelp = window.open('help.asp','winHelp','scrollbars=yes,resizable=yes,width=600,height=400');
  if (document.focus) winHelp.focus();

  return false;
}

function pricesWindow() {
  winPrices = window.open('prices.asp','winPrices','scrollbars=yes,resizable=yes,width=600,height=400');
  if (document.focus) winPrices.focus();

  return false;
}
function OrderWindow() {
  winOrder = window.open('order.asp','basket','scrollbars=yes,resizable=yes,width=600,height=420');
  if (document.focus) winOrder.focus();

  return false;
}

function DownloadWindow() {
  winDownload = window.open('viewDownloads.asp','winDownload','scrollbars=yes,resizable=yes,width=600,height=420');
  if (document.focus) winDownload.focus();

  return false;
}

function contactWindow() {
  winContact = window.open('contactUs.asp', 'winContact', 'scrollbars=yes,resizable=yes,width=600,height=420');
  if (document.focus) winContact.focus();

  return false;
}

function confirmClear() {
  return confirm('ALL contents in the basket will be CLEARED if you click OK')
}

function imageOver(image, name) {
  imageSwitch(image, "../images/" + name + "mo.gif");
}

function imageOut(image, name) {
  imageSwitch(image, "../images/" + name + ".gif");
}

function imageClick(image, name) {
  imageSwitch(image, "../images/" + name + "cl.gif");
}

function imageSwitch(image, name) {
  image.src = name;
}

function newUserPassCheck(pass1, pass2, newUser){
  if (newUser.checked == true) {
    return true;
  }

  var passLength = pass1.value.length;

  if (passLength < 6) {
    alert('Passwords should be at least 6 characters long, please enter a new password');
    pass1.select();
    return false;
  }

  if (pass1.value != pass2.value) {
    alert('Your passwords do not match, please retype your passwords');
    pass1.select();
    return false;
  }

  return true;
}

function openURL(url, width, height) {
  winOpener = window.open(url,'STURLOpener','scrollbars=yes,resizable=yes,width=' + width +',height=' + height);
  if (document.focus) winOpener.focus();

  return false;
}

//-->