		isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;

		var REG_button = new RegExp().compile('but_');
		var REG_hover  = new RegExp().compile('_hi\\.');	

window.onload = function() {	

	// Apple Mac goes bananas on this script,
	// so bail out
	if (isMac) return;

	// image mouseovers
	var links = document.body.getElementsByTagName("a");
	parseImageLinks(links);

}

/**
 *	Image links, autopreload
 *	--------------------------
 */

function parseImageLinks(list) {
	var link, child, src;

	for(var i=0; i<list.length; i++) {
		link = list.item(i);
		if (child = link.firstChild) {
			if(/img/i.test(child.nodeName)) {
				src = child.getAttribute("src");
				
				if(REG_button.test(src)) {
					if(REG_hover.test(src))
						link.className += ' active';
					else
						new HoverImage(link, child);
				}
			}
		}
	}
}

function HoverImage(link, image) {
	var offState = new Image()
		offState.src = image.src;
	
	var onState = new Image();
		// Update 30-07-2004: extension .php added
		onState.src = offState.src.replace(/\.(gif|jpg|php)/, '_hi.$1');

	link.onmouseover = function() {
		image.src = onState.src;		
	}

	link.onmouseout = function() {
		image.src = offState.src;
	}
}


function PopMailAFriend() {
	window.open("ff_mailafriend.php", "newwin", "width=400,height=520");
}


// email
function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "U heeft geen e-mailadres ingevoerd..\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Het e-mailadres is niet geldig.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Het e-mailadres bevat ongeldige tekens.\n";
       }
    }
return error;    
}


// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "U heeft geen telefoonnummer ingevuld.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "Het telefoonnummer is ongeldig.";
  
    }
//    if (!(stripped.length == 10)) {
//	error = "The phone number is the wrong length. Make sure you included an area code.\n";
//    } 
return error;
}


// non-empty textbox

function isEmpty(strng, name) {
	var error = "";
	  if (strng.length == 0) {
		 error = "Het veld '" + name + "' is niet ingevuld.\n"
	  }
	return error;	  
}


// valid selector from dropdown list

function checkDropdown(choice) {
var error = "";
    if (choice == 0) {
    error = "You didn't choose an option from the drop-down list.\n";
    }    
return error;
}    


function checkForm(whichform, theForm) {
    var why = "";
	switch(whichform) {
		case "contact":
			why += isEmpty(theForm.name.value, 'naam');
			why += isEmpty(theForm.email.value, 'email');
			why += isEmpty(theForm.message.value, 'vraag of opmerking');
			if (theForm.email.value.length > 0) {
				why += checkEmail(theForm.email.value);
			}
			break;
		default:
			alert(whichform + " onbekend!");
			return false;
	}
	if (why != "") {
		why = "\nHet formulier kan niet worden verstuurd om de volgende reden(en):\n\n" + why;
		why += "\n\nVerbetert u dit alstublieft.";

       alert(why);
       return false;
    } else {
		theForm.submit();
	}
}
