// Suckerfish dropdown specifiek voor IE6
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("menu");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;


/*
 * Functie voor het Bel Mij Gedeelte
 */
$(document).ready( function()
{
	// targetfile ophalen
	var targetFile	= $('form[name=belmij]').attr('action');
	
	// actie bij het klikken van de submitknop
	$('form[name=belmij]').submit( function()
	{
		// Formdata ophalen
		var bmnaam	= $('input[name="Naam"]').attr('value');
		var bmtelefoon	= $('input[name="Telefoon"]').attr('value');

		// Checken of de velden wel gevuld zijn
		if( bmnaam == '' || bmtelefoon == '' )
		{
			displayAlert(3);
			
			return false;
		}

		// Posten maar !!
		$.post( targetFile, { bmnaam: bmnaam, bmtelefoon: bmtelefoon }, function(data)
		{
			
			if ( data.status )
			{
				displayAlert(1);
			} else {
				displayAlert(2);
			}
			
		} , 'json');
		
		return false;

	});
});


/*
 * Functie die de alertbox toont
 */
function displayAlert( param1 )
{

	// Hide de andere velden
	$('.succes, .error, .fieldcheck').css('display', 'none');
	
	// Show de gecorrespondeerde tekst
	if ( param1 == 1)
	{
		$('.succes').css('display', 'block');
	} 
	else if ( param1 == 2 ) 
	{
		$('.error').css('display', 'block');
	}
	else
	{
		$('.fieldcheck').css('display', 'block');
	}
	
	// Show de alertbox
	$('.alert').fadeIn('normal');
	
	// Hide de box na 5 seconden
	setTimeout( 'hideAlert();', 5000 );

}


/*
 * Functie die de box weer hide
 */
function hideAlert()
{

	// Hide de alertbox
	$('.alert').fadeOut('normal');
	
	// Hide de andere velden
	$('.succes, .error, .fieldcheck').css('display', 'none');

}
