function change(id, newClass) 
{
	identity=document.getElementById(id);
	identity.className=newClass;
}

function PopupPic(sPicURL) 
{ 
	window.open( "foto.php?image="+sPicURL, "", "resizable=1"); 
} 

function confrm(msg, to) 
{
  if(window.confirm(msg)) 
  {
	window.location = to;
  }
}

function clearText(el) 
{
	if (el.defaultValue==el.value)
	{
		el.value = "";
	} 
}

function checkadres(){
  if (document.contact.Voorletter.value == "")
  {
  alert("Je dient je voorletter(s) bij klantgegevens in te vullen")
  document.contact.Voorletter.focus(); 
  return false;
  }
  if (document.contact.Voornaam.value == "")
  {
  alert("Je dient je voornaam bij klantgegevens in te vullen")
  document.contact.Voornaam.focus(); 
  return false;
  }
  if (document.contact.Achternaam.value == "")
  {
  alert("Je dient je achternaam bij klantgegevens in te vullen")
  document.contact.Achternaam.focus(); 
  return false;
  }
  if (document.contact.Adres.value == "")
  {
  alert("Je dient je adres bij klantgegevens in te vullen")
  document.contact.Adres.focus(); 
  return false;
  }
  if (document.contact.Huisnummer.value == "")
  {
  alert("Je dient je huisnummer bij klantgegevens in te vullen")
  document.contact.Huisnummer.focus(); 
  return false;
  }
  if (document.contact.Postcode.value == "")
  {
  alert("Je dient je postcode bij klantgegevens juist in te vullen, bijvoorbeeld 3581ML")
  document.contact.Postcode.focus(); 
  return false;
  }
  if (document.contact.Postcode.value.length < 4)
  {
  alert("Je dient je postcode bij klantgegevens juist in te vullen, bijvoorbeeld 3581ML")
  document.contact.Postcode.focus(); 
  return false;
  }
  if (document.contact.Plaats.value == "")
  {
  alert("Je dient je woonplaats bij klantgegevens in te vullen")
  document.contact.Plaats.focus(); 
  return false;
  }
  if (document.contact.Telefoonnummer.value == "")
  {
  alert("Je dient je telefoonnummer bij klantgegevens in te vullen")
  document.contact.Telefoonnummer.focus(); 
  return false;
  }
  if (document.contact.Telefoonnummer.value.length < 8)
  {
  alert("Je dient je telefoonnummer bij klantgegevens in te vullen")
  document.contact.Telefoonnummer.focus(); 
  return false;
  }
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contact.Email.value) != true)
  {
	alert("Je dient een juist e-mailadres in te vullen bij klantgegevens")
	document.contact.Email.focus();
	return false;
  }
  return true;
  }
  
  
function AbortEntry(sMsg, eSrc)
{
  window.alert(sMsg);
  // set focus and highlight to the offending error
  eSrc.focus();
  //eSrc.select();
 }

function HandleError()
{
  	  
  if (document.contact.aantalvalue == "")
  {
  alert("Je moet een getal invullen.")
  document.contact.aantal.focus();
  return false;
  }
  
  if (document.contact.aantal.value <= "0")
  {
  alert("Je moet een positief getal invullen.")
  document.contact.aantal.focus();
  return false;
  }
  
  if (document.contact.aantal.value > 99)
  {
  alert("Je kan dit product maximaal 99 keer bestellen.")
  document.contact.aantal.focus();
  return false;
  } 
  
  if (IsNumeric(document.kassa.aantal.value) == false) 
  {
  alert("Je moet een positief getal invullen.")
  document.kassa.aantal.focus();
  return false;
  }
  
  return true;
}

//wordt gebruikt door bovenstaande functie
function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
