function initImage() {
  imageId = 'thephoto';
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  image.style.visibility = 'visible';
  fadeIn(imageId,0);
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 5;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 50);
    }
  }
}

function fadeOut(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity >= 0) {
      setOpacity(obj, opacity);
      opacity -= 5;
			if (opacity <= 0) {window.location = 'default.asp?nav=10'};
      window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 50);
    }
  }

}
/*--------------------------------------------------------------------------------
ValidateWijnForm
--------------------------------------------------------------------------------*/
  	function ValidateWijnform(theForm,theAction)
  	{
			
			var errors = 0;
			var nietsbesteld = false;
  
  		if (!(IsFilledIn			(theForm.Naam,'field','field_error','NAAM niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInEmail			(theForm.Email,'textarea','textarea_error','Ongeldig E-MAILADRES !',1))) errors++;
  	  if (!(IsFilledIn			(theForm.Telefoon,'textarea','textarea_error','TELEFOON niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.FlesBaronniereWit,'textarea','textarea_error','Fles Baronniere Wit niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.KistBaronniereWit,'textarea','textarea_error','Kist Baronniere Wit niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.FlesBaronniereRood,'textarea','textarea_error','Fles Baronniere Rood niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.KistBaronniereRood,'textarea','textarea_error','Kist Baronniere Rood niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.FlesBaldyWit,'textarea','textarea_error','Fles Baldy Wit niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.KistBaldyWit,'textarea','textarea_error','Kist Baldy Wit niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.FlesBaldyRood,'textarea','textarea_error','Fles Baldy Rood niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.KistBaldyRood,'textarea','textarea_error','Kist Baldy Rood niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.FlesCastell,'textarea','textarea_error','Fles Castell niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.KistCastell,'textarea','textarea_error','Kist Castell niet ingevuld !',1))) errors++;
  		if (parseInt(theForm.FlesBaronniereWit.value) + parseInt(theForm.KistBaronniereWit.value) + parseInt(theForm.FlesBaronniereRood.value)
			 + parseInt(theForm.KistBaronniereRood.value) + parseInt(theForm.FlesBaldyWit.value) + parseInt(theForm.KistBaldyWit.value) + parseInt(theForm.FlesBaldyRood.value)
			  + parseInt(theForm.KistBaldyRood.value) + parseInt(theForm.FlesCastell.value) + parseInt(theForm.KistCastell.value) == 0) nietsbesteld = true;
						
			if (errors == 0 && !nietsbesteld)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			if (!(errors == 0))
				{
				alert("Niet alle velden zijn correct ingevuld.");
				}
  		  else
				{ 
					if (nietsbesteld)
						 {
						 	alert("U hebt niets besteld...");
						  }
					}
  		}

  	}
/*--------------------------------------------------------------------------------
ValidateKerstForm
--------------------------------------------------------------------------------*/
  	function ValidateKerstform(theForm,theAction)
  	{
			
			var errors = 0;
			var nietsbesteld = false;
  
  		if (!(IsFilledIn			(theForm.Naam,'field','field_error','NAAM niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInEmail			(theForm.Email,'textarea','textarea_error','Ongeldig E-MAILADRES !',1))) errors++;
  	  if (!(IsFilledIn			(theForm.Telefoon,'textarea','textarea_error','TELEFOON niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.videe,'textarea','textarea_error','VIDEE niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.stoofvlees,'textarea','textarea_error','STOOFVLEES niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.kindervidee,'textarea','textarea_error','KINDERVIDEE niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.curryworst,'textarea','textarea_error','CURRYWORST niet correct ingevuld !',1))) errors++;
  		if (parseInt(theForm.videe.value) + parseInt(theForm.stoofvlees.value) + parseInt(theForm.kindervidee.value)
			 + parseInt(theForm.curryworst.value) == 0) nietsbesteld = true;
						
			if (errors == 0 && !nietsbesteld)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			if (!(errors == 0))
				{
				alert("Niet alle velden zijn correct ingevuld.");
				}
  		  else
				{ 
					if (nietsbesteld)
						 {
						 	alert("U hebt niets besteld...");
						  }
					}
  		}

  	}

/*--------------------------------------------------------------------------------
ValidateOntbijtForm
--------------------------------------------------------------------------------*/
  	function ValidateOntbijtform(theForm,theAction)
  	{
			
			var errors = 0;
			var nietsbesteld = false;
  
  		if (!(IsFilledIn			(theForm.Naam,'field','field_error','NAAM niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInEmail			(theForm.Email,'textarea','textarea_error','Ongeldig E-MAILADRES !',1))) errors++;
  	  if (!(IsFilledIn			(theForm.Telefoon,'textarea','textarea_error','TELEFOON niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.plus12,'textarea','textarea_error','AANTAL VANAF 12 JAAR niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.min12,'textarea','textarea_error','AANTAL ONDER 12 JAAR niet correct ingevuld !',1))) errors++;
  		if (parseInt(theForm.plus12.value) + parseInt(theForm.min12.value) == 0) nietsbesteld = true;
						
			if (errors == 0 && !nietsbesteld)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			if (!(errors == 0))
				{
				alert("Niet alle velden zijn correct ingevuld.");
				}
  		  else
				{ 
					if (nietsbesteld)
						 {
						 	alert("U hebt niets besteld...");
						  }
					}
  		}

  	}

		
		/*--------------------------------------------------------------------------------
ValidateOntbijtForm
--------------------------------------------------------------------------------*/
  	function ValidateArdennenform(theForm,theAction)
  	{
			
			var errors = 0;
			var nietsbesteld = false;
  
  		if (!(IsFilledIn			(theForm.Naam,'field','field_error','NAAM niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInEmail			(theForm.Email,'textarea','textarea_error','Ongeldig E-MAILADRES !',1))) errors++;
  	  if (!(IsFilledIn			(theForm.Telefoon,'textarea','textarea_error','TELEFOON niet ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.stoofvleesvanaf12,'textarea','textarea_error','AANTAL STOOFVLEES VANAF 12 JAAR niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.forelvanaf12,'textarea','textarea_error','AANTAL FOREL VANAF 12 JAAR niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.stoofvleesonder12,'textarea','textarea_error','AANTAL STOOFVLEES ONDER 12 JAAR niet correct ingevuld !',1))) errors++;
  	  if (!(IsFilledInNumeric			(theForm.forelonder12,'textarea','textarea_error','AANTAL FOREL ONDER 12 JAAR niet correct ingevuld !',1))) errors++;
  		if (parseInt(theForm.stoofvleesvanaf12.value) + parseInt(theForm.forelvanaf12.value) + parseInt(theForm.stoofvleesonder12.value) + parseInt(theForm.forelonder12.value) == 0) nietsbesteld = true;
						
			if (errors == 0 && !nietsbesteld)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			if (!(errors == 0))
				{
				alert("Niet alle velden zijn correct ingevuld.");
				}
  		  else
				{ 
					if (nietsbesteld)
						 {
						 	alert("U hebt niets besteld...");
						  }
					}
  		}

  	}
/*--------------------------------------------------------------------------------
ValidateClubnieuws
--------------------------------------------------------------------------------*/
  	function ValidateClubnieuws(theForm,theAction)
  	{
			
			var errors = 0;
  
  		if (!(IsFilledIn			(theForm.titel,'field','field_error','Vergeet DE TITEL niet in te vullen !',1))) errors++;
  	 if (!(IsFilledIn			(theForm.nieuwbericht,'textarea','textarea_error','Vergeet HET BERICHT niet in te vullen !',1))) errors++;
  		
  		if (errors == 0)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			alert("Niet alle velden zijn correct ingevuld.");
  		}

  	}

/*--------------------------------------------------------------------------------
ValidateContactform
--------------------------------------------------------------------------------*/
  	function ValidateContactform(theForm,theAction)
  	{
			
			var errors = 0;
  
  		if (!(IsFilledIn			(theForm.naam,'field','field_error','Vergeet UW NAAM niet in te vullen !',1))) errors++;
  		if (!(IsFilledInEmail			(theForm.email,'field','field_error','UW EMAILADRES is foutief !',1))) errors++;
  	  if (!(IsFilledIn			(theForm.vraag,'textarea','textarea_error','Vergeet UW VRAAG OF OPMERKING niet in te vullen !',1))) errors++;
  		
  		if (errors == 0)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			alert("Niet alle velden zijn correct ingevuld.");
  		}

  	}		
		
/*--------------------------------------------------------------------------------
ValidateBabbelbox
--------------------------------------------------------------------------------*/
  	function ValidateBabbelbox(theForm,theAction)
  	{
			
			var errors = 0;
  
  	 if (!(IsFilledIn			(theForm.naam,'field','field_error','Vergeet UW NAAM niet in te vullen !',1))) errors++;
  	 if (!(IsFilledIn			(theForm.babbericht,'textarea','textarea_error','Vergeet HET BERICHT niet in te vullen !',1))) errors++;
  		
  		if (errors == 0)
  		{
  			SubmitTheForm(theForm,theAction);
  		}
  		else
  		{
  			alert("Niet alle velden zijn correct ingevuld.");
  		}

  	}
  	

/*--------------------------------------------------------------------------------
IsNotEmpty :: controle of een veld een waarde bevat of niet
	INPUT:
	theField:			het veld
	theStyle:			de standaard stijl van het veld
	theErrorStyle:		de style bij foutieve waarde
	theErrorMessage:	de foutboodschap
	isRequired:			is het veld verplicht in te vullen (duh, in deze functie dus genegeerd...)
	
	OUTPUT:
	true / false
--------------------------------------------------------------------------------*/
function IsFilledIn(theField,theStyle,theErrorStyle,theErrorMessage,isRequired)
{
	var theValue = theField.value.toLowerCase();
	theField.className=theStyle;
	theField.title = "";
	
	if (theValue == "")
	{
		//--- if is empty
		theField.className=theErrorStyle;
		theField.title=theErrorMessage;
		theField.focus();
		return false;
	}
	return true;
}










/*--------------------------------------------------------------------------------
IsFilledInEmail :: controle of een veld een geldig emailadres bevat
	INPUT:
	theField:			het veld
	theStyle:			de standaard stijl van het veld
	theErrorStyle:		de style bij foutieve waarde
	theErrorMessage:	de foutboodschap
	isRequired:			is het veld verplicht in te vullen
	
	OUTPUT:
	true / false
--------------------------------------------------------------------------------*/
function IsFilledInEmail(theField,theStyle,theErrorStyle,theErrorMessage,isRequired)
{
	var theValue = theField.value.toLowerCase();
	theField.className=theStyle;
	theField.title = "";
	
	if (theValue == "" && isRequired == 0)
	{
		return true;
	}
	else
	{
		if (theValue == "" || !(IsValidEmail(theValue)))
		{
			theField.className=theErrorStyle;
			theField.title=theErrorMessage;
			theField.focus();
			return false;
		}
		else
		{
			return true;
		}
	}
}










/*--------------------------------------------------------------------------------
IsFilledInNumeric :: controle of een veld een geldig GEHEEL getal bevat
	INPUT:
	theField:			het veld
	theStyle:			de standaard stijl van het veld
	theErrorStyle:		de style bij foutieve waarde
	theErrorMessage:	de foutboodschap
	isRequired:			is het veld verplicht in te vullen
	
	OUTPUT:
	true / false
--------------------------------------------------------------------------------*/
function IsFilledInNumeric(theField,theStyle,theErrorStyle,theErrorMessage,isRequired)
{
	var theValue = theField.value.toLowerCase();
	theField.className=theStyle;
	theField.title = "";
	
	if (theValue.indexOf(",") >= 0)
	{
		theValue = theValue.replace(",",".");
		theField.value = theValue;
	}
	
	if (theValue == "" && isRequired == 0)
	{
		return true;
	}
	else
	{
		if (theValue == "" || isNaN(theValue) || theValue.indexOf(".") >= 0)
		{
			theField.className=theErrorStyle;
			theField.title=theErrorMessage;
			theField.focus();
			return false;
		}
		else
		{
			return true;
		}
	}
}









/*--------------------------------------------------------------------------------
IsFilledInDecimal :: controle of een veld een geldig getal bevat
	INPUT:
	theField:			het veld
	theStyle:			de standaard stijl van het veld
	theErrorStyle:		de style bij foutieve waarde
	theErrorMessage:	de foutboodschap
	isRequired:			is het veld verplicht in te vullen
	
	OUTPUT:
	true / false
--------------------------------------------------------------------------------*/
function IsFilledInDecimal(theField,theStyle,theErrorStyle,theErrorMessage,isRequired)
{
	var theValue = theField.value.toLowerCase();
	theField.className=theStyle;
	theField.title = "";
	
	if (theValue.indexOf(",") >= 0)
	{
		theValue = theValue.replace(",",".");
		theField.value = theValue;
	}
	
	if (theValue == "" && isRequired == 0)
	{
		return true;
	}
	else
	{
		if (theValue == "" || isNaN(theValue))
		{
			theField.className=theErrorStyle;
			theField.title=theErrorMessage;
			theField.focus();
			return false;
		}
		else
		{
			return true;
		}
	}
}








/*--------------------------------------------------------------------------------
IsPasswordsEqual :: controle of twee velden (bedoeld voor paswoorden) dezelfde waarden bevatten
	INPUT:
	theField1:			het eerste veld
	theField2:			het tweede veld
	theStyle:			de standaard stijl van het veld
	theErrorStyle:		de style bij foutieve waarde
	theErrorMessage:	de foutboodschap
	
	OUTPUT:
	true / false
--------------------------------------------------------------------------------*/
function IsPasswordsEqual(theField1,theField2,theStyle,theErrorStyle,theErrorMessage)
{
	var theValue1 = theField1.value.toLowerCase();
	var theValue2 = theField2.value.toLowerCase();
	theField1.className=theStyle;
	theField1.title = "";
	theField2.className=theStyle;
	theField2.title = "";
	
	if (theValue1 == theValue2)
	{
		return true;
	}
	else
	{
		theField1.value = "";
		theField2.value = "";
		theField1.className=theErrorStyle;
		theField2.className=theErrorStyle;
		theField2.focus();
		theField1.focus();
		alert(theErrorMessage);
		return false;
	}
}









/*--------------------------------------------------------------------------------
IsValidEmail :: controle of een emailadres een geldig adres kan zijn
	INPUT:
	sEmail
	
	OUTPUT:
	true / false
--------------------------------------------------------------------------------*/
function IsValidEmail(emailStr) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		return false
	}

	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) {
	    return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
			return false
		    }
	    }
	    return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
	    return false
	}
	
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
	    domArr[domArr.length-1].length>3) {
	   return false
	}

	if (len<2) {
	   return false
	}

	return true;
}









	
/*--------------------------------------------------------------------------------
Form Actions:
	SubmitTheForm	posten
	ClearTheForm	alle velden leeg maken
	ResetTheForm	formulier herstellen naar oorspronkelijke vorm
--------------------------------------------------------------------------------*/
function SubmitTheForm(theForm,theAction)
{
	theForm.action = theAction;
	theForm.submit();
}

function ClearTheForm(theForm,theBasicStyle)
{
	for (var i=0;i<theForm.elements.length;i++)
	{
		theForm.elements[i].value = "";
		theForm.elements[i].title = "";
		theForm.elements[i].className = theBasicStyle;
	}
	theForm.elements[0].focus();
}
	
function ResetTheForm(theForm,theBasicStyle)
{
	for (var i=0;i<theForm.elements.length;i++)
	{
		theForm.elements[i].title = "";
		theForm.elements[i].className = theBasicStyle;
	}
	theForm.reset();
	theForm.elements[0].focus();
}


