function ResetSavedVisitedNumber() {
	var url = Master_BasePath + "AccoCookies.aspx?Action=Numbers";
	var req = new Request();
	req.GetNoCache(url, ResetSavedVisitedNumberResult);
}
function ResetSavedVisitedNumberResult(result) {
	if (result.readyState != ReadyState.Complete) return;
	if (result.status == HttpStatus.OK && result.responseText != "") {
	
	    var num_array = result.responseText.split(';');
		
		if (num_array[0] == "0")
		    num_array[0] = " <span style='color:gray'>(0)</span>";
		else
		    num_array[0] = " <span style='color:red'>("+num_array[0]+")</span>"
		
		if (num_array[1] == "0")
		    num_array[1] = " <span style='color:gray'>(0)</span>";
		else
		    num_array[1] = " <span style='color:red'>("+num_array[1]+")</span>"
		
		document.getElementById(MijnGegevens_SavedVak).innerHTML = document.getElementById(MijnGegevens_SavedVakText).value + num_array[0];
		document.getElementById(MijnGegevens_VisitedVak).innerHTML = document.getElementById(MijnGegevens_VisitedVakText).value + num_array[1];
	}
}
function SetLightboxSize() {
    var pop = document.getElementById("TravelersDiv");
    var pop2 = document.getElementById("footerDiv");
    var popMail = document.getElementById("accoMailDiv");
    var popInfo = document.getElementById("infoPopupDiv");
    var popCRP = document.getElementById("crpInfoDiv");
    var popGeo = document.getElementById("crpGeocodeDiv");
    
    if(pop == null || pop2 == null) return;
    
    var winy = 0;
    while(pop2 != null) {
        winy += pop2.offsetTop;
        pop2 = pop2.offsetParent;
    }
    pop.style.height = (winy + 40) + "px";
    if(popMail != null) {
        popMail.style.height = (winy + 40) + "px";
    }
    if (popInfo != null) {
        popInfo.style.height = (winy + 40) + "px";
    }
    if (popCRP != null) {
        popCRP.style.height = (winy + 40) + "px";
    }
    if (popGeo != null) {
        popGeo.style.height = (winy + 40) + "px";
    }
}
function OpenTravelers() {
    CenterTravelersElement();
    var pop = document.getElementById("TravelersDiv");
    if (pop != null)
        pop.style.visibility = "visible";
    if(typeof ddlLand != 'undefined' && document.getElementById(ddlLand) != null)
        document.getElementById(ddlLand).style.visibility = "hidden";
    if(typeof ddlDate != 'undefined' && document.getElementById(ddlDate) != null)
        document.getElementById(ddlDate).style.visibility = "hidden";
    if(typeof ddlDuration != 'undefined' && document.getElementById(ddlDuration) != null)
        document.getElementById(ddlDuration).style.visibility = "hidden";
}
function CloseTravelers() {
    var pop = document.getElementById("TravelersDiv");
    if (pop != null)
        pop.style.visibility = "hidden";
    if(typeof ddlLand != 'undefined' && document.getElementById(ddlLand) != null)
        document.getElementById(ddlLand).style.visibility = "visible";
    if(typeof ddlDate != 'undefined' && document.getElementById(ddlDate) != null)
        document.getElementById(ddlDate).style.visibility = "visible";
    if(typeof ddlDuration != 'undefined' && document.getElementById(ddlDuration) != null)
        document.getElementById(ddlDuration).style.visibility = "visible";
}
function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
function CenterTravelersElement() {
    var pop = document.getElementById("TravelersPopup");
    if (pop == null) return;
    
    var posy = 0;
    var winy = 0;
    var winx = 0;
    var winscroll = 0;
    var poph = pop.offsetHeight;
    
    if(window.pageYOffset){
        winscroll = window.pageYOffset;
        winy = window.innerHeight;
        winx = window.innerWidth;
    }else{
        winscroll = iecompattest().scrollTop;
        winy = iecompattest().clientHeight;
        winx = iecompattest().clientWidth;
    }
    
    if(poph >= winy) {
        posy = winscroll;
    } else {
        posy = ((winy - poph) / 2) + winscroll;
    }

    pop.style.top = posy + "px";
    document.getElementById("TravelersDiv").style.width = winx + "px";
}
function CheckTravelersDates() {
    var res = true;
    var ddl0 = document.getElementById("ddlAdults");
    var ddl1 = document.getElementById("ddlChild");
    var ddl2 = document.getElementById("ddlBaby");
    var num0 = parseInt(ddl0.options[ddl0.selectedIndex].text, 10);
    var num1 = parseInt(ddl1.options[ddl1.selectedIndex].text, 10);
    var num2 = parseInt(ddl2.options[ddl2.selectedIndex].text, 10);
    
    if(num0 + num1 + num2 > 8) {
        res = false;
        alert("Het is helaas niet mogelijk om in een boeking\r\n meer dan 8 personen te boeken.\r\n U kunt eventueel meerdere boekingen maken\r\n of telefonisch contact met ons op nemen.");
    }

    for(var i = 1; i < num1 + 1; i++) {
        var d = document.getElementById("txtChild" + i);
        if(d.value == "" || d.value=="Ongeldig") {
            d.value = "Ongeldig";
            res = false;
        }
    }
    for(var j = 1; j < num2 + 1; j++) {
        var f = document.getElementById("txtBaby" + j);
        if(f.value == "" || f.value=="Ongeldig") {
            f.value = "Ongeldig";
            res = false;
        }
    }
    if(res) {
        CloseTravelers();
    }
    return res;
}
function GetBirthdates(ddl, type)
{
    var NrOfDates = parseInt(ddl.options[ddl.selectedIndex].text, 10);
    var element = type==0?"Child":"Baby";
    
    for(i=1; i<ddl.options.length; i++)
    {
        var obj = document.getElementById(element + i.toString())
        obj.style.display = "none";
        obj.value = "";
    }
    
    for(i=1; i<=NrOfDates; i++)
    {
        var obj = document.getElementById(element + i.toString())
        obj.style.display = "";
    }
}
function ClearNewsletterAddres(ctrl) {
    if(ctrl.value == "uw emailadres") {
        ctrl.value = "";
    }
}
function FillNewsletterAddres(ctrl) {
    if(ctrl.value == "") {
        ctrl.value = "uw emailadres";
    }
}
var mar_plaing = true;
var mar_timer;
var mar_nextTime = 5000;
function mar_DisplayControl() {
    if(mar_maxEl == 0) {
        document.getElementById("mbBlock").style.display = "none";
        return;
    }
    var lis = document.getElementById("mar_numbers");
    lis.innerHTML = "";
    var iBegin = 1;
    var iEnd = 6;
    if(mar_maxEl > 6) {
        if(mar_currentImg <= 3) {
            iBegin = 1;
            iEnd = 6;
        } else {
            if(mar_currentImg >= mar_maxEl - 2) {
                iBegin = mar_maxEl - 5;
                iEnd = mar_maxEl;
            } else {
                iBegin = mar_currentImg - 2;
                iEnd = mar_currentImg + 3;
            }
        }
    } else {
        iBegin = 1;
        iEnd = mar_maxEl;
    }
    var s = "";
    for(var i = iBegin; i <= iEnd; i++) {
        var liTag = document.createElement("span");
        var liTag2 = document.createElement("span");
        var aTag = document.createElement('a');
        aTag.setAttribute('href', 'javascript:mar_SetImg(' + i + ');');
        if(i == mar_currentImg) {
            aTag.setAttribute("id", "activeLi");
        }
        var oTx = document.createTextNode("" + i);
        aTag.appendChild(oTx);
        liTag.appendChild(aTag);
        if(i > iBegin) {
            liTag2.appendChild(document.createTextNode("|"));
            lis.appendChild(liTag2);
        }
        lis.appendChild(liTag);
    }
    if(mar_currentImg > 0) {
        document.getElementById("activeLi").className = "active";
        document.getElementById("displayedImageDiv").src = document.getElementById("displayedImage").src;
        changeOpac(0, "displayedImage"); 
        document.getElementById("displayedImage").src = mar_imageUrl[mar_currentImg - 1];
        document.getElementById("mar_title").innerHTML = mar_imageAlt[mar_currentImg - 1];
        document.getElementById("mar_desc").innerHTML = mar_imageDesc[mar_currentImg - 1];
        for(i = 0; i <= 100; i+=5) {
            setTimeout("changeOpac(" + i + ",'displayedImage')",(i * 5));
        } 
    }
}
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
function mar_PlayPause() {
    if(mar_plaing) {
        mar_Pause();
    } else {
        mar_Play();
    }
}
function mar_Pause() {
    clearTimeout(mar_timer);
    mar_plaing = false;
    mar_DisplayControl();
}
function mar_Play() {
    mar_plaing = true;
    mar_DisplayControl();
    mar_timer = setTimeout("mar_PlayNextPicture();", mar_nextTime);
}
function mar_NextPict() {
    if(mar_plaing) {
        mar_Pause();
    }
    mar_currentImg += 1;
    if(mar_currentImg > mar_maxEl) {
        mar_currentImg = 1;
    }
    mar_DisplayControl();
}
function mar_PrevPict() {
    if(mar_plaing) {
        mar_Pause();
    }
    mar_currentImg -= 1;
    if(mar_currentImg < 1) {
        mar_currentImg = mar_maxEl;
    }
    mar_DisplayControl();
}
function mar_PlayNextPicture() {
    mar_currentImg += 1;
    if(mar_currentImg > mar_maxEl) {
        mar_currentImg = 1;
    }
    mar_DisplayControl();
    mar_timer = setTimeout("mar_PlayNextPicture();", mar_nextTime);
}
function mar_SetImg(num) {
    if(mar_plaing) {
        mar_Pause();
    }
    mar_currentImg = num;
    mar_DisplayControl();
}
function mar_StartDisplay() {
    mar_DisplayControl();
    if(mar_maxEl > 1) {
        mar_Play();
    }
}
function mar_OpenLink() {
    window.open(mar_imageLink[mar_currentImg - 1], '_self');
}
function AddToFasvorities(path) {
    if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel("OpVakantieVanaf", path,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( path, "OpVakantieVanaf");
    }
}
/* mail popup */
function OpenAccoMail() {
    CenterAccoMailElement();
    var pop = document.getElementById("accoMailDiv");
    pop.style.visibility = "visible";
}
function CloseAccoMail() {
    var pop = document.getElementById("accoMailDiv");
    pop.style.visibility = "hidden";
}
function CenterAccoMailElement() {
    var pop = document.getElementById("accoMailPopup");
    if(pop == null) return;
    
    var posy = 0;
    var winy = 0;
    var winscroll = 0;
    var poph = pop.offsetHeight;
    
    if(window.pageYOffset){
        winscroll = window.pageYOffset;
        winy = window.innerHeight;
    }else{
        winscroll = iecompattest().scrollTop;
        winy = iecompattest().clientHeight;
    }
    if(500 >= winy) { //144
        posy = winscroll;
    } else {
        posy = ((winy - 500) / 2) + winscroll; //144
    }

    pop.style.top = posy + "px";
}

function ShowPopupInfo(message)
{
    ShowPopupInfo(message, true);
}
function ShowPopupInfo(message, autohide)
{

    CenterPopupInfoElement();
    
    var msgDiv = document.getElementById("infoPopoupText");
    msgDiv.innerHTML = message;
    var pop = document.getElementById("infoPopupDiv");
    pop.style.visibility = "visible";
    
    if(autohide)
        setTimeout("HidePopupInfo()", 3000); // 3 sec
}

function HidePopupInfo()
{
    var pop = document.getElementById("infoPopupDiv");
    pop.style.visibility = "hidden";
    
    var msgDiv = document.getElementById("infoPopoupText");
    msgDiv.innerHTML = "";
}

function CenterPopupInfoElement()
{
    var pop = document.getElementById("infoPopup");
    if(pop == null) return;
    
    var posy = 0;
    var winy = 0;
    var winscroll = 0;
    var poph = pop.offsetHeight;
    
    if(window.pageYOffset){
        winscroll = window.pageYOffset;
        winy = window.innerHeight;
    }else{
        winscroll = iecompattest().scrollTop;
        winy = iecompattest().clientHeight;
    }
    
    if(poph >= winy) {
        posy = winscroll;
    } else {
        posy = ((winy - poph) / 2) + winscroll;
    }

    pop.style.top = posy + "px";
}


function crpNextImage() {
	if(crp_startImg >= crp_maxEl - 2) {
		return;
	}
	crp_startImg++;
	crpShowMenu();
}
function crpPrevImage() {
	if(crp_startImg == 1) {
		return;
	}
	crp_startImg--;
	crpShowMenu();
}
function crpShowImage(imNum) {
	var tempNum = crp_startImg + imNum;
	document.getElementById("crpMainImage").src = crp_imageUrl[tempNum - 1];		
}
function crpRenderImages() {
	if(crp_maxEl == 0) {
		document.getElementById("crpImgFull").style.display = "none";
		return;
	} else {
		document.getElementById("crpImgFull").style.display = "block";
	}
	document.getElementById("crpImgP").style.display = "none";
	if(crp_maxEl > 3) {
		document.getElementById("crpImgN").style.display = "block";
	} else {
		document.getElementById("crpImgN").style.display = "none";
	}
	if(crp_maxEl > 0) {
		document.getElementById("crpImgIm1Div").style.display = "block";
		document.getElementById("crpImg1").src = crp_imageUrl[0];
		document.getElementById("crpMainImage").src = crp_imageUrl[0];
	} else {
		document.getElementById("crpImgIm1Div").style.display = "none";
	}
	if(crp_maxEl > 1) {
		document.getElementById("crpImgIm2Div").style.display = "block";
		document.getElementById("crpImg2").src = crp_imageUrl[1];
	} else {
		document.getElementById("crpImgIm2Div").style.display = "none";
	}
	if(crp_maxEl > 2) {
		document.getElementById("crpImgIm3Div").style.display = "block";
		document.getElementById("crpImg3").src = crp_imageUrl[2];
	} else {
		document.getElementById("crpImgIm3Div").style.display = "none";
	}
}
function crpShowMenu() {
	document.getElementById("crpImg1").src = crp_imageUrl[crp_startImg - 1];
	document.getElementById("crpImg2").src = crp_imageUrl[crp_startImg];
	document.getElementById("crpImg3").src = crp_imageUrl[crp_startImg + 1];
	if(crp_startImg == 1) {
		document.getElementById("crpImgP").style.display = "none";
	} else {
		document.getElementById("crpImgP").style.display = "block";
	}
	if(crp_startImg == crp_maxEl - 2) {
		document.getElementById("crpImgN").style.display = "none";
	} else {
		document.getElementById("crpImgN").style.display = "block";
	}
}
function crpOpenInfoDiv() {
	crpCenterInfoElement();
	var pop = document.getElementById("crpInfoDiv");
    if (pop != null)
        pop.style.visibility = "visible";
}
function crpCloseInfoDiv() {
	var pop = document.getElementById("crpInfoDiv");
    if (pop != null)
        pop.style.visibility = "hidden";
}
function crpOpenGeocodeDiv() {
	crpCenterGeocodeElement();
	var pop = document.getElementById("crpGeocodeDiv");
    if (pop != null)
        pop.style.visibility = "visible";
}
function crpCloseGeocodeDiv() {
	var pop = document.getElementById("crpGeocodeDiv");
    if (pop != null)
        pop.style.visibility = "hidden";
}
function crpCenterInfoElement() {
    var pop = document.getElementById("crpInfoPopup");
    if (pop == null) return;
    
    var posy = 0;
    var winy = 0;
    var winx = 0;
    var winscroll = 0;
    var poph = pop.offsetHeight;
    
    if(window.pageYOffset){
        winscroll = window.pageYOffset;
        winy = window.innerHeight;
        winx = window.innerWidth;
    }else{
        winscroll = iecompattest().scrollTop;
        winy = iecompattest().clientHeight;
        winx = iecompattest().clientWidth;
    }
    
    if(poph >= winy) {
        posy = winscroll;
    } else {
        posy = ((winy - poph) / 2) + winscroll;
    }

    pop.style.top = posy + "px";
    document.getElementById("crpInfoDiv").style.width = winx + "px";
}
function crpCenterGeocodeElement() {
    var pop = document.getElementById("crpGeocodePopup");
    if (pop == null) return;
    
    var posy = 0;
    var winy = 0;
    var winx = 0;
    var winscroll = 0;
    var poph = pop.offsetHeight;
    
    if(window.pageYOffset){
        winscroll = window.pageYOffset;
        winy = window.innerHeight;
        winx = window.innerWidth;
    }else{
        winscroll = iecompattest().scrollTop;
        winy = iecompattest().clientHeight;
        winx = iecompattest().clientWidth;
    }
    
    if(poph >= winy) {
        posy = winscroll;
    } else {
        posy = ((winy - poph) / 2) + winscroll;
    }

    pop.style.top = posy + "px";
    document.getElementById("crpGeocodeDiv").style.width = winx + "px";
}

function echeck(str) {	
	var at="@";
	var dot=".";
	var lat = str.indexOf(at);
	var lstr = str.length;
	var ldot = str.indexOf(dot);
	if (str.indexOf(at) == -1) {
	   alert("Dit is geen geldig e-mail adres!");
	   return false;
	}
	if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
	   alert("Dit is geen geldig e-mail adres!");
	   return false;
	}
	if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
		alert("Dit is geen geldig e-mail adres!");
		return false;
	}
	if (str.indexOf(at, (lat + 1)) != -1) {
		alert("Dit is geen geldig e-mail adres!")  ;
		return false;
	}
	if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
		alert("Dit is geen geldig e-mail adres!");
		return false;
	}
	if (str.indexOf(dot, (lat + 2)) == -1) {
		alert("Dit is geen geldig e-mail adres!");
		return false;
	}
	if (str.indexOf(" ") != -1) {
		alert("Dit is geen geldig e-mail adres!");
		return false;
	}
	return true;
}

function CheckNewsletter() {

    
	if (document.getElementById(nltbLastName).value == '') {
		alert('Niet alle verplichte velden zijn juist ingevuld!');
		return false;
	}
    return echeck(document.getElementById(nltbEmail).value);
}