﻿function completeReservering(){
    if(document.getElementById('voorwaarden').checked == true){
        doPostBack();
    }else{
        alert('De volgende problemen zijn gevonden:\nU bent niet akkoord gegaan met de voorwaarden.');
    }
}
function goToNext3Months(maand, jaar){
    maand += 3;
    if (maand > 12){
        jaar++;
        maand -= 12;
    }
    document.getElementById('volgendeMaand').value = maand;
    document.getElementById('volgendeJaar').value = jaar;
    doPostBack();
}
function goToPrev3Months(maand, jaar){
    maand -=3;
    if(maand < 1){
        jaar--;
        maand +=12;
    }
    document.getElementById('volgendeMaand').value = maand;
    document.getElementById('volgendeJaar').value = jaar;
    doPostBack();
}
function goToNextYear(maand, jaar){
    if (parseFloat(maand) > 12){
        jaar++;
        maand -= 12;
    }
    document.getElementById('volgendeMaand').value = maand;
    document.getElementById('volgendeJaar').value = jaar;
    doPostBack();
}
/* Volledig jaar tonen */
function showFullYear(jaar){
    document.getElementById('toDoReservering').value = "showFullYear";
    document.getElementById('volgendeJaar').value = jaar;
    doPostBack();
}
function goToStep2(id){
    Obj = document.getElementById("geselecteerdeProduct");
    Obj.value = id;
    doPostBack();
}
function doPostBack(){
    document.aspnetForm.action = document.location;
	document.aspnetForm.submit();
}

function berekenPrijs(volprijs, kinderprijs){
    
    var prijsObj = document.getElementById('prijs');
    var personenObj = document.getElementById('aantalPersonen');
    var kinderenObj = document.getElementById('aantalKinderen');
    
    var totKindPrijs = 0;
    if(kinderenObj){
        if(kinderenObj.value == ""){
            kinderenObj.value = 0;
        }
        totKindPrijs = (parseFloat(kinderenObj.value) * parseFloat(kinderprijs))
    }
    var totVolPrijs = 0;
    if(personenObj){
        if(personenObj.value == ""){
            personenObj.value = 0;
        }
        totVolPrijs = (parseFloat(personenObj.value) * parseFloat(volprijs))
    }
    if(document.getElementById("annuleringsverzekering").checked == true){
	if (Math.round(((totVolPrijs + totKindPrijs) * 0.05)*100)/100<15) {
        prijsObj.value = Math.round(((totVolPrijs + totKindPrijs) + 15)*100)/100;
	}
	else {
        prijsObj.value = Math.round(((totVolPrijs + totKindPrijs) * 1.05)*100)/100;
	}
    }else{
        prijsObj.value = Math.round((totVolPrijs + totKindPrijs) * 100)/100;
    }
    
}
function backToNormal(obj){
    obj.style.backgroundColor = "#CCCCCC";
}
function valideReservering(){
    MM_validateForm(    'aantalPersonen','','R',
                        'naam','','R',
                        'adres','','R',
                        'postcode','','R',
                        'woonplaats','','R',
                        'telefoon','','R',
                        'email','','RisEmail',
                        'plaatsnemenAan','','RisRadio'
                    );
   if (document.MM_returnValue == true) {
        gaatGoed = true;
        
        if(document.getElementById('aantalPersonen').value == 0){
            document.getElementById('aantalPersonen').style.backgroundColor = "#FFCB2D";
            gaatGoed = false;
        }
        
        if(gaatGoed = true){
            doPostBack();
        }
    }
}
function submitenter(myfield,e,where)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13)
   {
        if(where == "wijbellenterug")
            wijbellenterug();
            
   //myfield.form.submit();
   return false;
   }
else
   return true;
}

function wijbellenterug(){
    document.location = "/SendForm.aspx?todo=wijbellenterug&telefoon=" + document.getElementById('telefoonnummerWijBellenUTerug').value;
}
function validateWijBellenTerug(){
    MM_validateForm('Naam','','R','Telefoonnummer','','R');
    if(document.MM_returnValue){
        document.getElementById('bezigmet').value = "wijbellenterug";
        document.aspnetForm.action = document.location;
	    document.aspnetForm.submit();
    }
}

function validateBrochureAanvraag(){
    MM_validateForm('naam','','R','e-mail','','RisEmail');
    if(document.MM_returnValue){
        document.aspnetForm.action = document.location;
	    document.aspnetForm.submit();
    }
}

function validateNaarVriend(){
    MM_validateForm('Naam','','R','NaamVriend','','R','E-mailvriend','','RisEmail');
    if(document.MM_returnValue){
        document.aspnetForm.action = document.location;
	    document.aspnetForm.submit();
    }
}
function CreateBookmarkLink() {

 title = "Dorsvlegel Vinkel"; 
 url = "http://www.dorsvlegel.nl";
 
	if (window.sidebar) { // Mozilla Firefox
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera
		return true; }
 }
 
 /* Scrollen maken */
function updateDiv(){
    var veld = document.getElementById("right");
    if(veld){
        if(veld.offsetHeight < 600){
            var vanafBoven;
            if (document.documentElement && !document.documentElement.scrollTop){
            // IE6 +4.01 but no scrolling going on
            }else if (document.documentElement && document.documentElement.scrollTop){
                vanafBoven = document.documentElement.scrollTop
            }else if (document.body && document.body.scrollTop){
                vanafBoven = document.body.scrollTop
            }
           
           if(vanafBoven >= 741){
            veld.style.marginTop = vanafBoven - 741 + "px";
           }else{
             veld.style.marginTop = "0px";
           }
        }else{
            clearInterval(upDivInt);
        }
    }
}
var upDivInt = setInterval("updateDiv();",25);
