function check(object_id) {
    with (document.getElementById(object_id))
        checked = !checked;
}


function validateForm() 
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("Email addresses you entered do not match.  Please re-enter.")
    email.focus()
  }
  
  if (phone.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter a phone number.")
    thesubject.focus()
  }
  if (themessage.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the details for your enquiry.")
    themessage.focus()
  }
  if (okSoFar==true)  submit();
 }
}

function validateQuote() 
    { 
        var frm = document.forms["phpquote"];  
        var numericExpression = /^[0-9]+$/;
        var ndiscs = frm.ndiscs.value;
        var d1 = frm.elements.disc;

        if (!ndiscs.match(numericExpression) || ndiscs < 50) {
            alert("You must enter a number of discs from 50 to 1500.");            
            return false;
            setFocus("ndiscs");                        
        }
        
        if (ndiscs > 1500) {
            alert("Please contact us if you would like more than 1500 discs, for preferential rates.");            
            return false;
            setFocus("ndiscs");                        
        }
        
        for(var i=0; i<d1.length; i++){
            if(d1[i].checked) return true();
        }
        alert("You must select either CD, DVD or Blue-Ray Discs.");        
        return false; 
        
        setFocus("ndiscs");        
             
    }
    
function validateQuoteMail() 
{
 var okSoFar=true
 with (document.quotemailer)
 {
  if (name.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter your name.")
    thesubject.focus()
  }
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("Email addresses you entered do not match.  Please re-enter.")
    email.focus()
  }
  if (phone.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter a phone number.")
    thesubject.focus()
  }
  
  if (okSoFar==true)  submit();
 }
}
 
/*           
function validateQuote() 
{ 
    with (document.phpquote)
    { 
        var ndiscs = document.getElementById("ndiscs");
        var d1 = document.forms.phpquote.elements.disc;
        var numericExpression = /^[0-9]+$/;
        
        if (!ndiscs.value.match(numericExpression) || ndiscs.value < 50) {
            alert("You must enter a number of discs from 50 to 9999.");            
            return false;
            setFocus("ndiscs");                        
        }        
            
        for(var i=0; i<d1.length; i++){
            if(d1[i].checked) return true();
        }
        alert("You must select either CD, DVD or Blue-Ray Discs.");        
        return false; 
        
        setFocus("ndiscs");       
    }       
}
*/

/*
function isNumeric(elem, helperMsg){
    var numericExpression = /^[0-9]+$/
    if(elem.value.match(numericExpression)){
        return true
    }else{
        alert(helperMsg)
        elem.focus()
        return false
    }
}



// If the element's string matches the regular expression it is all numbers
  
  var numericExpression = /^[0-9]+$/;
  var nd1=document.forms.phpquote.elements.ndiscs.value
  alert("nd1");
  if(document.forms.phpquote.elements.ndiscs.match(numericExpression)){
    alert("nd1");  
    return true;
  }else{
    alert("You must enter a number of discs between 0 and 10 000");
    ndiscs.focus();
    okSoFar=false;
    return false;
  }
  */
  
  
 
