//TOEVOEGEN FAVORIETEN
function favolink()
{
	if (window.external){
	document.write('<a href="javascript:void(0);" title="Voeg Lastminute.nu toe aan je favorieten" target="_self" onClick="window.external.AddFavorite(\'http://www.lastminute.nu\',\'Lastminute.nu - Lastminute vakantie overzicht\');">');
	document.write('<font class="linkond">Lastminute.nu in je favorieten</font></a>');
	}
}

//NIEUWSBRIEF AANMELDEN
function checkMailing(){
	if ((document.mailing.email.value == "") || (document.mailing.email.value == "Je e-mailadres"))
	{
	alert("Vul je e-mailadres in om de nieuwsbrief te ontvangen.")
	document.mailing.email.focus(); 
	return false;
	}
return true;
}
function validate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      alert('Je e-mailadres is niet correct ingevuld.');
      return false;
   }
}

//SPAN TONEN
function showSpan(branch)
{
var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block") 
		objBranch.display="none";
	else
		objBranch.display="block";
}

//OPEN LINK IN NIEUW WINDOW
function openExtWindow(url)
{   w = (document.all ? screen.width : screen.width) * 0.92;
    h = (document.all ? screen.height : screen.height-150) * 0.92;
    op = 'scrollbars=yes,toolbar=yes,location=yes,directories=yes,menubar=yes,resizable=yes,status=yes,width=' + w + ',height=' + h + ',screenX=0,screenY=0,top=0,left=0';
    com=open(url,'',op);
}

//CONTROLE CONTACTFORMULIER
function checkAdv()
{
with (window.document.adverteren)
{
if (naam.value == "")
	{
	alert("Vul je naam in alvorens het formulier te versturen.")
	naam.focus(); 
	return false;
	}
if (email.value.length < 3)
	{
	alert("Vul je e-mailadres in alvorens het formulier te versturen.")
	email.focus(); 
	return false;
	}
}}

//SCALE IMAGES OP HELE PAGINA
function scaleImage(image, size)
{
	if((!image.complete) || (typeof(image.naturalWidth) != 'undefined' && image.naturalWidth == 0) || (image.src.indexOf('no_image') != -1))
	{
		if(size >= 150)
		{
			image.src = '/images/nopic_vakantie.gif';
		} else {
			image.src = '/images/nopic_vakantie.gif';
		}
	} else {
		image.style.height = '';
		image.style.width  = '';
		
		var imageh = image.clientHeight;
		var imagew = image.clientWidth;
		
		var scaleh = size / imageh;
		var scalew = size / imagew;
		
		if(scaleh < scalew)
		{
			image.style.height = size                        + 'px';
			image.style.width  = Math.round(imagew * scaleh) + 'px';
		} else {
			image.style.height = Math.round(imageh * scalew) + 'px';
			image.style.width  = size                        + 'px';
		}
	}
}
function scaleImages(size)
{
	for(var i = 0; i < document.images.length; i++)
	{
		if(document.images[i].className == 'scaleimage')
		{ scaleImage(document.images[i], size); }
	}
}
