
window.onload = function(){
	

	checkSlideshowSupport()
	checkForImageSwap()
	imageFader()
	pageScroll()
	linkToNewWindow()
	checkForAlertMessage()
	showSteps()	
	//checkForForm()
}


function clearInput(obj) {
	
	
	if ((obj.value == "Enter contact name") || (obj.value == "Enter email address") || (obj.value == "Ask us your question...")) {
		
			obj.value = ""
			
		}
			
	
}



function checkForAlertMessage()	{
	
	if(alertMessage != "") {
		
		
	alert(alertMessage)	
	alertMessage = ""	
	
	}		
		
}


function apertureCheck() {
	
	
  if (document.getElementById("aperture").value == "") {
	  
	  alert("Please enter an aperture size")
	  document.getElementById("aperture").focus()

	  return false
	  
  }
	
  var checkOK = "0123456789.";
  var checkStr = document.getElementById("aperture").value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please use only numbers and the decimal point in the aperture field,\ndo not add the suffix mm or microns.");
    document.getElementById("aperture").focus()
	document.getElementById("aperture").select()
    return (false);
  }	
	
	
}


function checkValue(obj) {

	  if (obj.order_qty.value == "") {
	  
	  alert("Please enter an order quantity")
	  obj.order_qty.focus()

	  return false
	  
  	}
  
  	
  var checkOK = "0123456789";
  var checkStr = obj.order_qty.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please use only whole numbers as a quantity.");
    obj.order_qty.focus()
	obj.order_qty.select()
    return false
  }	
  	
	return true
	
}


function displayVat(obj) {
	
	if(shippingRegions[obj.value] == 2){
		
		document.getElementById("vat_number").parentNode.style.display = "block"
		document.getElementById("vat_number").focus()
		document.getElementById("vat_number").select()
		
  	}
  	
  	else {
	  	
		document.getElementById("vat_number").parentNode.style.display = "none"
	  
 	}
	
}
