function openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter){
        if(isCenter){
                if(isCenter=="true"){
                        var myLeft       = (screen.width-myWidth)/2;
                        var myTop        = (screen.height-myHeight)/2;
                        features        += (features!='')?',':'';
                        features        += ',left='+myLeft+',top='+myTop;
                }
                if(isCenter=="hide"){
                        features        += (features!='')?',':'';
                        features        += ',left=10000,top=100';
                }
        }
        window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight).focus();
}

function PopUpBars(URL, sbars)
{
	day      = new Date();
	id       = day.getTime();
	b_width  = (screen.width  / 2) - 380;
	b_height = (screen.height / 2) - 275;
	width    = 760;
      height   = 550;

	if(screen.width == 800)
	{
      	b_width  = 0;
		b_height = 0;
	}

	eval("page" + id + " = window.open(URL, '" + id + "', 'channelmode=1,location=0,menubar=0,resizable=1,scrollbars=" + sbars + ",status=1,titlebar=0,toolbar=0,title=0');");
}

function PopUpInfo(URL, sbars)
{
	day      = new Date();
	id       = day.getTime();
	b_width  = (screen.width  / 2) - 374;
	b_height = (screen.height / 2) - 180;
	width    = 748;
      height   = 340;

	if(screen.width == 800)
	{
      	b_width  = 0;
		b_height = 0;
	}

	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=" + sbars + ",location=0,status=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",top=" + b_height + ",left=" + b_width + "');");
}

function PopUpInfoNew(Filiaal, Prog, Affiliate, vroegboek, sbars)
{
	Filiaal3 = "";

	if (Filiaal.length == 3)
	{
		Filiaal3 = Filiaal;
            Filiaal  = "";
	}

	var URL = Prog + '?Filiaal3=' + Filiaal3 + '&Filiaal=' + Filiaal + '&Affiliate=' + Affiliate + '&vroegboek=' + vroegboek;

	PopUpInfo(URL, sbars);
}


function PopUpInfoTaal(Prog, Filiaal3, Affiliate, itaal, vroegboek, sbars)
{
	var URL = Prog + '?Filiaal3=' + Filiaal3 + '&itaal=' + itaal + '&Affiliate=' + Affiliate + '&vroegboek=' + vroegboek;

	PopUpInfo(URL, sbars);
}

function CampingInfo(Taal, Filiaal, Relatie, Affiliate)
{
	if (!Affiliate && VarAffiliate)	Affiliate = VarAffiliate;
	CampingInfoBoeken(Taal, Filiaal, Relatie, "N", Affiliate); 
}

function CampingInfoBoeken(Taal, Filiaal, Relatie, Boeken, Affiliate)
{
	var ExtraAffilliate = '';
	
	iWidth   = 780;
      iHeight  = 550;
	Filiaal3 = "";

	if (Affiliate) ExtraAffilliate = "&AFFILIATE=" + Affiliate;
	
	if (Taal.length > 1)
	{
		if (Taal.substr(0, 1) == "0")
		{
			Taal = Taal.substr(1, Taal.length - 1);
		}
	}
	if (Filiaal.length == 3)
	{
		Filiaal3 = Filiaal;
            Filiaal  = "";
	}
	window.open("http://www.vacansoleil.com/campinginfo/camping.php?ITAAL=" + Taal + "&FILIAAL3=" + Filiaal3 + "&FILIAAL=" + Filiaal + "&BOEKEN=" + Boeken + "&RLCO=" + Relatie + ExtraAffilliate, "CampingInfo", "channelmode=yes,resizable=yes,status=yes,titlebar=yes,toolbar=0,location=no,menubar=no,scrollbars=yes").focus();
}

function DirectBoeken( Filiaal3, itaal, relatie, objectcode)
{
	var datum    = new Date();
	var id       = datum.getTime();
	var b_width  = (screen.width / 2) - 380;
	var b_height = (screen.height / 2) - 275;

	if(screen.width == 800)
	{
		b_width = 0;
		b_height = 0;
	}
	eval("page" + id + " = window.open('http://boeken.vacansoleil.com/VacanSoleil/D_BOEK.pgm?FILIAAL3=' + Filiaal3 + '&ITAAL=' + itaal + '&cmpid=&COBJ=' + objectcode + '&CREL=' + relatie , '" + id + "', 'channelmode=yes,resizable=yes,status=yes,titlebar=yes,toolbar=0,location=no,menubar=no');");
}

function BoekenMain( Filiaal3, itaal, vroegboek)
{
	var datum    = new Date();
	var id       = datum.getTime();

	eval("page" + id + " = window.open('http://boeken.vacansoleil.com/VacanSoleil/Frameset1.pgm?FILIAAL3=' + Filiaal3 + '&ITAAL=' + itaal + '&vroegboek=' + vroegboek, '" + id + "', 'channelmode=yes,resizable=yes,status=yes,titlebar=yes,toolbar=0,location=no,menubar=no');");
}

function InfoAcco(Filiaal3, itaal, acco) 
{
      var URL  = 'INFOACCO_N.PGM?FILIAAL3=' + Filiaal3 + '&ANCTAL=' + itaal + '&ACCO=' + acco;
      day      = new Date();
      id       = day.getTime();
      b_width  = (screen.width / 2)-374;
      b_height = (screen.height / 2)-200;
      eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,location=0,statusbar=0,menubar=0,resizable=no,width=748,height=380,top=" + b_height + ",left=" + b_width + "');");
}

function DownLoadPdf( URL )
{
      var day = new Date();
	var id  = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', '');");
}

function Bericht(tekst, veld)
{
	var frm = document.forms[0];
	alert(tekst);
	frm[veld].focus();
	frm[veld].select();
	return false;
}

function Bericht3(tekst, veld)
{
	var frm = document.forms[0];
	alert(tekst);
	frm[veld].focus();
	return false;
}

function SimpleTest( verplicht, naam, waarde, foutmelding )
{
	var frm = document.forms[0];
	if(verplicht == "Y")
	{
		if(waarde == "")
		{
			alert(foutmelding);
			frm[naam].focus();
			frm[naam].select();
			return false;
		}
	}
	return true;
}

function IsPostcode(invoer, land)
{
	switch (land.toUpperCase())
	{
		case "NL" : return IsPostcodeLand(invoer, "01");
		case "DK" : return IsPostcodeLand(invoer, "10");
		case "BE" : return IsPostcodeLand(invoer, "08");
		case "UK" : return IsPostcodeLand(invoer, "05");
		case "GB" : return IsPostcodeLand(invoer, "05");
		case "FR" : return IsPostcodeLand(invoer, "02");
		case "PL" : return IsPostcodeLand(invoer, "21");
		case "DE" : return IsPostcodeLand(invoer, "03");
		case "IT" : return IsPostcodeLand(invoer, "04");
		case "HU" : return IsPostcodeLand(invoer, "13");
		default   : ;
	}
	return true;
}

function IsPostcodeFil(invoer, filiaal)
{
	switch (filiaal)
	{ 
		case "1" : return IsPostcodeLand(invoer, "01");
		case "2" : return IsPostcodeLand(invoer, "10");
		case "3" : return IsPostcodeLand(invoer, "08");
		case "4" : return IsPostcodeLand(invoer, "05");
		case "5" : return IsPostcodeLand(invoer, "02");
		case "7" : return IsPostcodeLand(invoer, "21");
		case "8" : return IsPostcodeLand(invoer, "03");
		case "9" : return IsPostcodeLand(invoer, "04");
		case "0" : return IsPostcodeLand(invoer, "13");
		default    : ;
	}
	return true;
}

function IsPostcodeFil3(invoer, Filiaal3)
{
	switch (Filiaal3)
	{ 
		case "VAC" : return IsPostcodeLand(invoer, "01");
		case "VDK" : return IsPostcodeLand(invoer, "10");
		case "VBE" : return IsPostcodeLand(invoer, "08");
		case "VGB" : return IsPostcodeLand(invoer, "05");
		case "VFR" : return IsPostcodeLand(invoer, "02");
		case "VPL" : return IsPostcodeLand(invoer, "21");
		case "VDE" : return IsPostcodeLand(invoer, "03");
		case "VIT" : return IsPostcodeLand(invoer, "04");
		case "VHU" : return IsPostcodeLand(invoer, "13");
		default    : ;
	}
	return true;
}

function IsPostcodeLand(invoer, Land)
{
	if(invoer == "")
	{
		return true;
	}

	switch (Land)
	{ 
		case "01" : if (! IsNummer(invoer.substr(0, 4), 4))
			      {
			        return false;
			      }
				if (invoer.substr(4, 1) == " ")
				{
			        return IsLetter(invoer.substr(5, 2), 2);
                        }
                        else
                        {
                          return IsLetter(invoer.substr(4, 2), 2);
				}
		case "02" : return IsNummer(invoer, 5);
		case "03" : return IsNummer(invoer, 5);
		case "04" : return IsNummer(invoer, 5);
		case "05" : return true;
		// case "06" : return true;	// Spanje
		case "08" : return IsNummer(invoer, 4);
		case "10" : return IsNummer(invoer, 4);
		case "13" : return IsNummer(invoer, 4);
		case "16" : return IsNummer(invoer, 4);
		case "17" : return IsNummer(invoer, 5);
		case "21" : if (! IsNummer(invoer.substr(0, 2), 2))
			    {
				return false;
			    }
			    return IsNummer(invoer.substr(3, 3), 3);
		case "29" : return true;
		default   : ;
	}
	return true;
}

function IsTelefoonFil(telefoon, filiaal)
{
	if(telefoon == "")
	{
		return true;
	}
	
	switch (filiaal)
	{
		case "1" : return IsTelefoonLand(telefoon, "01");
		case "2" : return IsTelefoonLand(telefoon, "10");
		case "3" : return IsTelefoonLand(telefoon, "08");
		case "4" : return IsTelefoonLand(telefoon, "04");
		case "5" : return IsTelefoonLand(telefoon, "02");
		case "7" : return IsTelefoonLand(telefoon, "21");
		case "8" : return IsTelefoonLand(telefoon, "03");
		case "9" : return IsTelefoonLand(telefoon, "04");
		case "0" : return IsTelefoonLand(telefoon, "13");
		default  : ;
	}
	return true;
}

function IsTelefoonFil3(telefoon, Filiaal3)
{
	if(telefoon == "")
	{
		return true;
	}
	
	switch (Filiaal3)
	{
		case "VAC" : return IsTelefoonLand(telefoon, "01");
		case "VDK" : return IsTelefoonLand(telefoon, "10");
		case "VBE" : return IsTelefoonLand(telefoon, "08");
		case "VGB" : return IsTelefoonLand(telefoon, "05");
		case "VFR" : return IsTelefoonLand(telefoon, "02");
		case "VPL" : return IsTelefoonLand(telefoon, "21");
		case "VDE" : return IsTelefoonLand(telefoon, "03");
		case "VIT" : return IsTelefoonLand(telefoon, "04");
		case "VHU" : return IsTelefoonLand(telefoon, "13");
		default    : ;
	}
	return true;
}

function IsTelefoonLand(telefoon, Land)
{
	if(telefoon == "")
	{
		return true;
	}
	
	switch (Land)
	{
		case "01" : return IsNummer(telefoon, 10);
		case "10" : return IsNummer(telefoon,  8) || IsNummer(telefoon,  9) || IsNummer(telefoon,  10) || IsNummer(telefoon,  11) || IsNummer(telefoon,  12) || IsNummer(telefoon,  13) || IsNummer(telefoon,  14);
		case "08" : return (IsNummer(telefoon, 9) || IsNummer(telefoon, 10));
		case "05" : return IsNummer(telefoon, 11);
		case "02" : return IsNummer(telefoon, 10);
		case "21" : return IsNummer(telefoon, 10);
		case "03" : return (IsNummer(telefoon, 8) || IsNummer(telefoon, 9) || IsNummer(telefoon, 10) || IsNummer(telefoon, 11));
		case "04" : return (IsNummer(telefoon, 8) || IsNummer(telefoon, 9) || IsNummer(telefoon, 10) || IsNummer(telefoon, 11));
		case "13" : return (IsNummer(telefoon, 8) || IsNummer(telefoon, 9) || IsNummer(telefoon, 10) || IsNummer(telefoon, 11));
		default   : ;
	}
	return true;
}

function IsNummer(invoer, lengte)
{
	var geldigeTekens = "0123456789";
	return Controle(invoer, lengte, geldigeTekens)
}

function IsLetter(invoer, lengte)
{
	var geldigeTekens = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	return Controle(invoer, lengte, geldigeTekens)
}

function Controle(invoer, lengte, geldigeTekens)
{
	if( (invoer.length < lengte) && (lengte != 0))
	{
		return false;
	}
	for(var a = 0; a < invoer.length; a ++)
	{
		if(geldigeTekens.indexOf(invoer.substr(a, 1)) == -1)
		{
			return false;
		}
	}
	return true;
}

function IsEmail(invoer)  //controle geldigheid e-mail
{
	invoer = Trim(invoer);
	var pos = invoer.indexOf("@");
	if(invoer.length > 5)
	{
		if(invoer.indexOf(" ") == -1) //string mag geen spaties bevatten
		{
			if(pos > 0 && pos < invoer.length - 4)
			{
				pos=invoer.indexOf("@", pos + 1);  //er mag geen tweede @ voorkomen
				if(pos == -1)
				{
					pos = invoer.length - invoer.lastIndexOf("."); //laatste positie van rechts van . in dotpos
					if(pos > 2 && pos < 6)//domein moet minimaal 2 maximaal 4 tekens bevatten
					{
						return true;
					}
				}
			}
		}
	}
	return false;
}

function Trim(invoer) //trimmen van string
{  
	var start = 0;
	var end = invoer.length;
	while ((start < end) && (invoer.charAt(start) == ' '))
	{
		start++;
	}
	while ((end > 0) && (invoer.charAt(end - 1) == ' '))
	{
		end--;
	}
	return invoer.substring(start, end);
}

function VoorlettersKeyUp(tekst, e)
{
	if(! StuurTeken(e))
	{
		VoorlettersBlur(tekst);
	}
}

function LettersKeyUp(tekst, e)
{
	if(! StuurTeken(e))
	{
		LettersBlur(tekst);
	}
}

function NummersKeyUp(tekst, e)
{
	if(! StuurTeken(e))
	{
		NummersBlur(tekst);
	}
}

function TelefoonKeyUpPL(tekst, e)
{
	if(! StuurTeken(e))
	{
		TelefoonBlurPL(tekst);
	}
}

function PostcodeKeyUpPL(tekst, e)
{
	if(! StuurTeken(e))
	{
		PostcodeBlurPL(tekst);
	}
}

function PostcodeKeyUpDK(tekst, e)
{
	if(! StuurTeken(e))
	{
		PostcodeBlurDK(tekst);
	}
}

function HoofdlettersKeyUp(tekst, e)
{
	if(! StuurTeken(e))
	{
		HoofdlettersBlur(tekst);
	}
}

function HoofdlettersKeyUpPL(tekst, e)
{
	if(! StuurTeken(e))
	{
		HoofdlettersBlurPL(tekst);
	}
}

function StuurTeken(e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	StuurTekens = "8,9,35,36,37,39,45,46"; //Backspace,ShiftTab,End,Home,<-,->,Ins,Del
	if(StuurTekens.indexOf(whichCode) != -1)
	{
		return true;
	}
	return false;
}

function VoorlettersBlur(tekst)
{
	tekst.value = tekst.value.toUpperCase();
	var GecorrigeerdeString = "";	
	var GeldigeTekens = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(var a = 0; a < tekst.value.length; a ++)
	{
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1) + ".";
		}
	}
	tekst.value = GecorrigeerdeString;
}

function LettersBlur(tekst)
{
	var GecorrigeerdeString = "";	
	var GeldigeTekens = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
	for(var a = 0; a < tekst.value.length; a ++)
	{
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1);
		}
	}
	tekst.value = GecorrigeerdeString;
}

function PostcodeBlurPL(tekst)
{
	var GecorrigeerdeString = "";
	var GeldigeTekens = "0123456789";
	for(var a = 0; a < tekst.value.length; a ++)
	{
		if(a == 2)
		{ 			
			GecorrigeerdeString += "-";
		}
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1);
		}
	}
	tekst.value = GecorrigeerdeString;
}

function PostcodeBlurDK(tekst)
{
	var GecorrigeerdeString = "";
	var GeldigeTekens = "0123456789";
	var MaxTekens = 4;

	var frm = document.forms[0];
	
	if (frm["LANDKODE"])
	{
		if (frm["LANDKODE"].value == "17")
		{
			MaxTekens = 5;
		}
	} 
	else if (frm["NAW_LNDK_W"])
	{
		if (frm["NAW_LNDK_W"].value == "17")
		{
			MaxTekens = 5;
		}
	}

	
	for(var a = 0; ((a < tekst.value.length) && (a < MaxTekens)); a ++)
	{
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1);
		}
	}
	tekst.value = GecorrigeerdeString;
}

function TelefoonBlurPL(tekst)
{
	var GecorrigeerdeString = "";
	var GeldigeTekens = "0123456789";
	for(var a = 0; a < tekst.value.length; a ++)
	{
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1);
		}
	}
	if (GecorrigeerdeString.substr(0, 1) != "0")
	{
		GecorrigeerdeString = "0" + GecorrigeerdeString;
	}
	tekst.value = GecorrigeerdeString;
}

function NummersBlur(tekst)
{
	var GecorrigeerdeString = "";
	var GeldigeTekens = "0123456789";
	for(var a = 0; a < tekst.value.length; a ++)
	{
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1);
		}
	}
	tekst.value = GecorrigeerdeString;
}

function HoofdlettersBlur(tekst)
{
	var GecorrigeerdeString = "";
	var GeldigeTekens = "0123456789 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(var a = 0; a < tekst.value.length; a ++)
	{
		if(GeldigeTekens.indexOf(tekst.value.substr(a, 1)) != -1)
		{
			GecorrigeerdeString += tekst.value.substr(a, 1);
		}
	}
	tekst.value = GecorrigeerdeString.toUpperCase();
}

function HoofdlettersBlurPL(tekst)
{
	// Polen hebben veel meer als 26 letters voor nu even eenvoudig
	tekst.value = tekst.value.toUpperCase();
}

function RadioChecked(veld)
{	
	if(veld == null) //veld is niet gedefinieerd op het scherm
	{
		return true;
	}
	if(veld.type == null)
	{
		for(var a = 0; a < veld.length; a ++) //multiple checkbox
		{
			if(veld[a].checked)
			{
				return true;	
			}	
		}
	}
	else
	{
		if(veld.type.toLowerCase() == "hidden") //hidden veld
		{
			if(veld.value != "")
			{
				return true;
			}
		}
		else //single checkbox
		{
			if(veld.checked)
			{
				return true;
			}
		}
	}
	return false;	
}

function EerstHoofdletter(veld)
{
	veld.value = veld.value.substr(0, 1).toUpperCase() + veld.value.substr(1, veld.value.length - 1).toLowerCase();
}

function Hoofdletters(veld)
{
	veld.value = veld.value.toUpperCase();
}

function LocaleHoofdletters(veld)
{
	veld.value = veld.value.toLocaleUpperCase();
}

function KleineLetters(veld)
{
	veld.value = veld.value.toLowerCase();
}

window.onerror  = null;
var IE4         = document.all && navigator.userAgent.indexOf("Opera") == -1;
var NS4         = document.layers;
var NS6         = document.getElementById && navigator.userAgent.indexOf("Opera") == -1;
var blink_speed = 1000; // Delay in milliseconds
var left_pos    = 330;  // The Distance of text from left
var i           = 0;
var layerRef    = "";
var styleSwitch = "";

if(IE4) 
{
	layerRef    = "document.all";
	styleSwitch = ".style";
}

//BLINKING
function Knipper(layerName)
{
	if(IE4)
	{ 
		if(i%2 == 0)
		{
			eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility="visible"');
		}
		else
		{
			eval(layerRef + '["' + layerName + '"]' + styleSwitch + '.visibility="hidden"');
		}
	}
	if(NS6 && (navigator.appName != "Microsoft Internet Explorer"))
	{
		if(i%2 == 0)
		{
			eval('document.getElementById("' + layerName + '").style.display=""');
		}
		else
		{
			eval('document.getElementById("' + layerName + '").style.display="none"');
		}
	}
	if(i < 1)
	{
		i++;
	} 
	else
	{
		i--
	}
	setTimeout("Knipper('" + layerName + "')", blink_speed);
}

function Info(Id2, Filiaal3, iTaal, Affiliate, vroegboek, Extra, sbars)
{
	var URL = 'http://boeken.vacansoleil.com/vacansoleil/info.pgm?DocId2=' + Id2 + '&Filiaal3=' + Filiaal3 + '&iTaal=' + iTaal + '&Affiliate=' + Affiliate + '&vroegboek=' + vroegboek + Extra;

	PopUpInfo(URL, sbars);
}

