// ----- WizardPaneValidator
//
// WizardPaneValidator is het overzicht van foutmeldingen onderin het pane. Het houdt een lijstje bij met alle validators in het pane 
// en een lijstje met alle cellen die gehighlight kunnen worden. 
//

var SummaryMainDiv;

// Registers the SummaryMainDiv, so it can be shown/hidden upon validation
function SetupSummary(mainDivID, textDivID) 
{
	if(typeof(Page_ValidationActive) != "undefined" && Page_ValidationActive == true)
	{
		SummaryMainDiv = new WizardPaneValidator (xGetElementById(mainDivID), xGetElementById(textDivID));
		SummaryMainDiv.Evaluate();
		
		// This sets a trigger on any updated validator
		_val_externalUpdateDisplayEventHandler = EvalSummary;
	} else {
		setTimeout("SetupSummary('" + mainDivID + "', '" + textDivID + "')", 1000);
	}
}

function EvalSummary()
{
	if(SummaryMainDiv)
	{
		SummaryMainDiv.Evaluate();
	}
}

// Creates a new WizardPaneValidator object and sets the 
// Evaluate() function of the object to WizardPaneValidator_Evaluate
function WizardPaneValidator(elmMain, elmText)
{
	this._elm = elmMain;
	this._elmText = elmText;
	this.Validators = null;
	this.ValidatorAlerters = null;
	this.error = false;
	this.Evaluate = WizardPaneValidator_Evaluate;
}

/*
	Als je de Evaluate() methode aanroept gaat de WizardPaneValidator 
	alle validators af. Als deze een probleem signaleren, voegt de 
	WizardPaneValidator de melding toe aan zijn lijstje. Voor elke 
	validator met een probleem zoeken we bovendien de TDs erbij die 
	gebruikt kunnen worden om aan te geven dat er op die rij een probleem 
	is. Hiervan wordt de class veranderd.
*/
function WizardPaneValidator_Evaluate()
{
	if (this._elm == null || this._elmText == null) return;
	
	// Eerst wissen we alle elementen met de wzValidateAlert
	if(this.ValidatorAlerters == null)
	{
		this.ValidatorAlerters = xGetElementsByClassName("wzValidateAlert", document.body, "div");
	}
	
	var Elements = this.ValidatorAlerters;
	for(var i = 0; i<Elements.length; i++)
	{
		var e = Elements[i];
		// Als er ' wzValidateAlert' is toegevoegd, halen we dat weg
		e.className = e.className.replace(/ wzValidateAlert/g, "");
		
	}
	
	if(this.Validators == null)
	{
		this.Validators = Page_Validators;
	}
	
	if(this.Validators == null || this.Validators.length == 0 )
	{
		this._elm.innerHTML = "";
		return;
	}

	var Message= "";
	var NumMessages= 0;

	for( var i = 0; i < this.Validators.length; i++ )
	{
		var Validator = this.Validators[i];

		if( !Validator.isvalid && !Validator.offscreen )
		{
			if( Validator.getAttribute("errormessage") != null )
			{
				if (Message.indexOf(Validator.getAttribute("errormessage")) < 0) {
					// The message has not been added to the collection, add it
					Message += Validator.getAttribute("errormessage") + "<br />"; 
					NumMessages++;	
				}
			}

			Validator.ValidatorAlerters = new Array();

			var parent = Validator.parentNode;
			var isIE = false;
			if (parent == null)		// ie
			{
				isIE = true;
				parent = Validator.parentElement;	 
			}
			
			if (parent != undefined)
			{
				// Validation alerts will be in either panerow or rowwrapper
				while (parent.className != null && parent.className.indexOf("panerow") == -1 && parent.className.indexOf("rowwrapper") == -1)
				//while (parent.className != null && parent.className.indexOf("panerow") == -1)
				{
					if (isIE)
					{
						parent = parent.parentElement;
					}
					else
					{
						parent = parent.parentNode;
					}
				}
			}
			var parentRow = parent;
			if(parentRow != null)
			{
				Validator.ValidatorAlerters = xGetElementsByClassName("wzVH", parentRow, "*");
			}

			for(var j = 0; j<Validator.ValidatorAlerters.length; j++)
			{
				var e = Validator.ValidatorAlerters[j];
				e.className += " wzValidateAlert";
			}
		}
		else
		{
			if( Validator.ValidatorAlerters != null )
			{
				// Check if there is at least one validator on the control that is currently validated that is visible, which means,
				// that the value of the control-to-validate does not meet the requirements of that validator. If there is one visible 
				// the code to remove the 'wzValidateAlert' should not be executed because it gives the user the illusion that the controls 
				// correctly filled, and that's not true.
				var filter = "span[controltovalidate='" + Validator.getAttribute('controltovalidate') + "']:visible";
				if ($(filter).length == 0)
				{
				for(var j = 0; j<Validator.ValidatorAlerters.length; j++)
				{
					var e = Validator.ValidatorAlerters[j];
					e.className = e.className.replace(/ wzValidateAlert/g, "");
				}
			}
		}
	}
	}
	
	// Indien twee of meer schermvelden niet voldoen aan de input- en/of formatvalidatie-eisen, verschijnt er slechts één foutmelding, nl:
	if ( NumMessages > 2 )
	{
		Message = "Niet alle velden zijn correct ingevuld. Wilt u de roodgemarkeerde velden alsnog invullen of corrigeren?";
	}
	
	this.error = (Message.length > 0);
	
    // If errors, we set the message, and the message color to red.
    // If no errors, we just set the message color to white, thus preventing
    // the button 'jumps upwards'. ( Unit 0537323 ).
    var sumar = xGetElementsByClassName("panerow summary", document.body, "div")
    var txt = sumar[0].innerHTML.toLowerCase();
    
    // count the breaks in the previous message (the message that is currently in the summary).
    var _m = '<br>';
    var prevErrCnt = 0;
    for (var i=0;i<txt.length;i++)
    {
        if (_m == txt.substr(i,_m.length))
        prevErrCnt++;
    }
    				
    // Retrieve the highest number of error lines ever on this page.
    var imaxPrevErrCnt = document.getElementById("maxerrorcnt").value;
    var maxPrevErrCnt = 0;
    if ( imaxPrevErrCnt == "i" )    // initial
    {
        this._elm.style.display = "none";
    }
    else
    {
        maxPrevErrCnt = parseInt(document.getElementById("maxerrorcnt").value);
    }

    if ( prevErrCnt > maxPrevErrCnt )
    {
        document.getElementById("maxerrorcnt").value = prevErrCnt;
    }
    if ( this.error )
    {
        if ( !IsStandardWizardPage(location.href) )
        {
            // Ad lines to to current message if necessary, to make it as long as the
            // longest error text ever on this page.
            var curErrCnt = 0;
            for (var i=0;i<Message.length;i++)
            {
                if (_m == txt.substr(i,_m.length))
                curErrCnt++;
            }
            for ( var i = curErrCnt; i < maxPrevErrCnt; i++ )
            {
                Message = Message + "<br>";
            }
            
            this._elmText.innerHTML = Message;
            this._elm.style.display = "block";
            sumar[0].style.color = "red";
        }
        else if ( !IsWizardStartPage(location.href) )
        {
            this._elmText.innerHTML = Message;
            this._elm.style.display = "block";
            sumar[0].style.color = "red";
        }
        else
        {
            if ( sumar[0].innerHTML.length > 78  )
            {
                Message = Message + "<br>";
            }
            this._elmText.innerHTML = Message;
            this._elm.style.display = "block";
        }        
    }
    else
    {
        if ( !IsStandardWizardPage(location.href) )
        {
            sumar[0].style.color = "white"; // mijnunive paginas
            // Change color of links inside the summary as well
            var x = sumar[0].getElementsByTagName('a');
            for (var i=0;i<x.length;i++)
            {
                x[i].style.color = "white";
            }
        }
        else if ( !IsWizardStartPage(location.href) )
        {
            sumar[0].style.color = "white"; // geen wizard start pagina.
            // Change color of links inside the summary as well
            var x = sumar[0].getElementsByTagName('a');
            for (var i=0;i<x.length;i++)
            {
                x[i].style.color = "white";
            }            
        }
        else
        {
            Message = " ";
            if ( sumar[0].innerHTML.length > 98  )
            {
                Message = Message + "<br><br>";
            }
            maxPrevErrCnt = parseInt(document.getElementById("maxerrorcnt").value);
            for ( var i = 1; i <= maxPrevErrCnt; i++ )
            {
                Message = Message + "<br>";
            }           
             
            this._elmText.innerHTML = Message;          
        }
    }
}

function IsStandardWizardPage(url)
{
var result = true;
url = url.replace("//","[[");
var slashpos = url.indexOf('/');
var pagePart = url.substring(slashpos,url.length);
if ( pagePart == '/mijnunive/aanmelden' )
{
    result = false;
}
else if ( pagePart == '/mijnunive/aanmelden#messagesanchor' )
{
    result = false;
}
else if ( pagePart == '/mijnunive' )
{
    result = false;
}

return result;
}

function IsWizardStartPage(url)
{
var result = false;
url = url.replace("//","[[");
var slashpos = url.lastIndexOf('/');
var pagePart = url.substring(slashpos,url.length);
if ( pagePart == '/afsluiten' || pagePart == '/premieberekenen'  )
{
    result = true;
}
return result;
}


function activity_indicator(){
    var e = document.getElementById("panel");
    try
    {
        e.setAttribute("class", "loadpanel");
    }
    catch(err){}
}

// ----- Einde WizardPaneValidator





// ---- Update functions voor het polisblad en periode-afhankelijke zaken -- //

/*
	Deze functie kijkt precies waar een element op de pagina staat qua Y-coor 
	door van alle parentnodes de offsetTop uit te lezen en deze bij elkaar 
	op te tellen
*/
function xFullOffsetTop(e)
{
	var res = 0;
	while(e.tagName != "BODY")
	{
	if(xDef(e.offsetTop))res +=	e.offsetTop;
	e=e.offsetParent;
	}
	return res;
}
var InboedelDekking = 'Super';
var AllPeriodDependencies = new Array();
var PeriodSelector = null;
function PeriodSelectorChanged() {
	//alert('periodchanged fired');
	if(PeriodSelector == null) {
		return;
	}
	
	if (typeof(PeriodSelector) == "string") {
		if(PeriodSelector == 'JaarBetaaltermijn')
		{
			SetYearPeriod();
		} else {
			UpdateAllPeriodDependencies(
				PeriodSelector,
				PeriodSelector.toLowerCase());
		}
	} else {
		// replace discount zorgverzekering, uses text for lookup values
		UpdateAllPeriodDependencies(
			PeriodSelector.options[PeriodSelector.selectedIndex].value,
			PeriodSelector.options[PeriodSelector.selectedIndex].text.replace(' (3% korting)',''));
	}
}
function SetYearPeriod()
{
   
  UpdateAllPeriodDependencies(
			'Jaar',
			'jaar');
}
function UpdateAllPeriodDependencies(periodSelected, periodName)
{
	for(var i = 0; i< AllPeriodDependencies.length; i++)
	{
	if(typeof(AllPeriodDependencies[i]) == "function")
	{
		AllPeriodDependencies[i](periodSelected, periodName);
	}
	}
}
function AddDependency(func)
{
	AllPeriodDependencies.push(func);
}

var AllPeriodEigenRisicoDependencies = new Array();
var eigenrisico = "0"; 

function EigenRisicoOrPeriodSelectorChanged()
{
    if(PeriodSelector == null)return;

    if(PeriodSelector == 'JaarBetaaltermijn')
    {
        UpdateAllPeriodDependencies('Jaar','jaar');
        // eigenrisico still passed for compatibility reasons
        UpdateAllPeriodEigenRisicoDependencies('Jaar','jaar',eigenrisico);
    }
    else
    {
        UpdateAllPeriodDependencies(
            PeriodSelector.options[PeriodSelector.selectedIndex].value,
            PeriodSelector.options[PeriodSelector.selectedIndex].text);

        UpdateAllPeriodEigenRisicoDependencies(
            PeriodSelector.options[PeriodSelector.selectedIndex].value,
            PeriodSelector.options[PeriodSelector.selectedIndex].text,
            eigenrisico);
    }
    
    PeriodSelectorChanged();
}

function UpdateAllPeriodEigenRisicoDependencies(periodSelected, periodName, ownRisk)
{
    for(var i = 0; i< AllPeriodEigenRisicoDependencies.length; i++)
    {
        if(typeof(AllPeriodEigenRisicoDependencies[i]) == "function")
        {
            AllPeriodEigenRisicoDependencies[i](periodSelected, periodName, ownRisk);
        }
    }
}








function AddNewDependency(func)
{
	AllPeriodEigenRisicoDependencies.push(func);
}


function hideElement(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
}

function showElement(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != '' ) {
		el.style.display = '';
	}
}

var AllDependencies = new Array();
function UpdateAllDependencies()
{
      for(var i = 0; i< AllDependencies.length; i++)
      {
      
        if(typeof(AllDependencies[i]) == "function")
        {
          AllDependencies[i]();
        }
       }
}
function AddKRVDependency(func)
{
  AllDependencies.push(func);
}

var AllDLRPeriodDependencies = new Array();
var DLRPeriodSelector = null;
function DLRPeriodSelectorChanged()
{
  if(DLRPeriodSelector == null) {
    UpdateAllDLRPeriodDependencies('60Dagen');
    return;
  }
  
  if(DLRPeriodSelector.checked){
    UpdateAllDLRPeriodDependencies('180Dagen');
  }
  else {
    UpdateAllDLRPeriodDependencies('60Dagen');
  }
}
function UpdateAllDLRPeriodDependencies(periodSelected)
{
  for(var i = 0; i< AllDLRPeriodDependencies.length; i++) {
    if(typeof(AllDLRPeriodDependencies[i]) == "function") {
      AllDLRPeriodDependencies[i](periodSelected);
    }
  }
}
function AddDLRDependency(func) {
  AllDLRPeriodDependencies.push(func);
}

/*
	Deze functie converteert een jaarpremie naar de correcte maand-, 
	kwartaal- of halfjaar-premie. Om te werken moet er in de pagina een 
	betalingstermijn control aanwezig zijn.
*/
function makeMoneyPeriodic(NumericValue, periodSelected)
{
	switch(periodSelected)
	{
		case "3":
		break;
		case "2":
		NumericValue /= 2;
		NumericValue *= 1.02;
		break;
		case "1":
		NumericValue /= 4;
		NumericValue *= 1.03;
		break;
		case "0":
		NumericValue /= 12;
		NumericValue *= 1.0367;
		break;
	}
	return Math.round(NumericValue * 100)/100;
}

/*
	Voor het consequent formatteren van numerieke waarden in de client-side code.
	In javascript zijn alle numerieke waarden geformatteerd als xxx.xxxxxx Je 
	moet dus pas op het allerlaatst converteren naar de nederlandse formattering 
	met een komma.
*/
function formatNumericValue(num, type, period)
{
	var NumericValue = num;
	if(period)
	{
	NumericValue = makeMoneyPeriodic(NumericValue, period);
	}
	
	
	var minus = "";
	if(NumericValue < 0)
	{
	minus = "-";
	NumericValue = -NumericValue;
	}
	if(NumericValue == NaN)
	{
	return "";
	}else{
	var centen = Math.round(NumericValue*100);
	var heel = Math.floor(centen/100);
	var comma = ",";
	var deci = centen - heel*100;
	if(type == "money")
	{
			if(deci == 0)deci = "--";
			if(deci < 10 && deci > 0)deci = "0" + deci;
	}
	if(type == "number")
	{
		if(deci == 0)
		{
		deci = "";
		comma = "";
		}
	}
	return minus + heel + comma + deci + " ";
	}
}

/*		Functies voor het client side laten verschijnen en verdwijnen van stukken HTML */
var arrShowHides = new Array();
function addShowHide(id)
{
	if (!arrShowHides)
	{
	arrShowHides = new Array();
	}
	
	var element = xGetElementById(id);
	if(element)
	{
	    arrShowHides.push(element);
	    element.switchBoxes = new Array();
	    var switches = element.getAttribute("switches");
	    var arrSwitchIDs = switches.split(" ");
	    for(var i = 0; i<arrSwitchIDs.length; i++)
	    {
			    var box = xGetElementById(arrSwitchIDs[i]);
			    if(box.tagName.toLowerCase() == "input")
			    {
				    WireBox(box, element);
			    }else{
				    var arrInputBoxes = box.getElementsByTagName("input");
				    for(var boxCount = 0; boxCount < arrInputBoxes.length; boxCount++)
				    {
				    if(arrInputBoxes[boxCount].type == "radio" || arrInputBoxes[boxCount].type == "checkbox" )
				    {
						    WireBox(arrInputBoxes[boxCount], element);
				    }
				    }
			    }
	    }
	// alvast een keer aanroepen, zodat het show/hide blokje initieel goed staat
	refreshShowHide(id);
	}
}

function WireBox(box, element)
{
	element.switchBoxes.push(box);
	xAddEventListener(box, "click", new Function("refreshShowHide('" + element.id + "');"), false);
}

function refreshShowHide(id)
{
	var element = xGetElementById(id);
	var functionName = element.getAttribute("visibilityfunction");

	if(typeof(window[functionName]) == "function")
	{
	var bVisible = window[functionName](element.switchBoxes);
	var bCurrentVisible = (element.style.display != "none");
	if(bVisible != bCurrentVisible)
	{
		var defaultTextBoxValue = 'XxXxXx';
		var $input = $('#' + id).find('input:text').first();
		if ($input != undefined)
		{
			if ($input.parents().eq(1).attr('defaultvalue') != undefined)
			{
				defaultTextBoxValue =  $input.parents().eq(1).attr('defaultvalue');
			}
		}
		
		if(bVisible)
		{
			if ($input != undefined && $input.val() == defaultTextBoxValue)
			{
				$input.val('');
			}
			element.style.display = "block";
		}else{
			if ($input != undefined && $input.val() == '')
			{
				$input.val(defaultTextBoxValue);
			}
			element.style.display = "none";
		}
		var arrValidators = xGetElementsByClassName("wzV", element, "span");
		for(var valCount = 0; valCount<arrValidators.length; valCount++)
		{
			var validator = arrValidators[valCount];
			validator.enabled = bVisible;
			validator.offscreen = !bVisible;
			EvalSummary();
		}
		}
	}
}
function showWhenFirstSwitchChecked(arrBoxes)
{
	if(arrBoxes.length < 1)return false;
	var firstBox = arrBoxes[0];
	return firstBox.checked;
}

function showWhenLastItemChecked(arrBoxes)
{
	if(arrBoxes.length < 1)return false;
	var box = arrBoxes[arrBoxes.length - 1];
	return box.checked;
}

function showWhenItemChecked(arrBoxes)
{
  if(arrBoxes.length < 1)return false;
  var firstBox = arrBoxes[0];
  return firstBox.checked;
}

function hideWhenFirstSwitchChecked(arrBoxes)
{
	return !showWhenFirstSwitchChecked(arrBoxes);
}
	
var insuranceName, premiumValue = -1;
var oivDescription, oivValue, oivChecked;
var juridicalDescription, juridicalValue, juridicalChecked;

function selectedInsuranceChange(value, id) {	
	if (value == "waz") insuranceName = "WA zonder Eigen Risico";
	else if (value == "wapz") insuranceName = "WA+ zonder Eigen Risico";
	else if (value == "wapm") insuranceName = "WA+ met Eigen Risico";
	else if (value == "arz") insuranceName = "All Risks zonder Eigen Risico";
	else insuranceName = "All Risks met Eigen Risico";
	
	premiumValue = xGetElementById(id).innerHTML;
	PeriodSelectorChanged();
}

function enforcechar(what,limit)
{
	if (what.value.length>=limit)
	return false;
}

function showAmount(amount) {
	if (amount == "" || amount == 0) {
		return "0,00";
	 }
	 var str = Math.round(amount * 100).toString();
	 var length = str.length;
	 if (str.length == 1) 
	 {
	    str =  ",0" + str.substr(length - 2, length);
	 }
	 else
	 {
	    str = str.substr(0, length - 2) + "," + str.substr(length - 2, length);
	 }
	 if (amount <1) str = "0"+ str;	 // to add a leading zero
	return str;
}

function CheckEndDatePreviousInsurer( obj ) 
{
	var d1 =	CreateDate( obj.value );
	if ( ValidateStringDate(obj.value) )
	{
		var d2 =	CreateDate( obj.getAttribute( "startdate" ) );

		if ( d2 < d1 ) 
		{
			alert( obj.getAttribute( "message" ) );
		}
	}
}

function CreateDate( str ) 
{
    // The startdate is added serverside, there is no formatting in the ToString() and therefore 
    // the regionalsettings of the server determin the formatting of the datestring. Normally that 
    // will be en-us format (MM/dd/yyyy). That requires different handling because the month and day
    // values are switched.
    if (str.indexOf('-') > 0)
    {
	    var matchResult = str.match(/^\s*\b(\d+)\b\D*\b(\d+)\b\D*\b(\d+)\s*$/);
	    if (matchResult != null )
	    {
		    var day = Number(matchResult[1]);
		    var month = Number(matchResult[2]);
		    var year = Number(matchResult[3]);
    	    	
    	    // month is zero based in javascript, we have to substract 1 from the month value.
    	    month--;
    	    
		    return new Date( year, month, day );
	    }
	    else 
	    {
		    //return new Date();
		    return null;	
	    }
	}
	else
	{
	    var matchResult = str.match(/^\s*\b(\d+)\b\D*\b(\d+)\b\D*\b(\d+)\s*$/);
	    if (matchResult != null )
	    {
		    var day = Number(matchResult[2]);
		    var month = Number(matchResult[1]);
		    var year = Number(matchResult[3]);
    	
    	    // month is zero based in javascript, we have to substract 1 from the month value.
    	    month--;

		    return new Date( year, month, day );
	    }
	    else 
	    {
		    //return new Date();
		    return null;	
	    }
	}
}

function ValidateStringDate(datum)
{
	var EnteredValue = datum;	
	var day; 
	var month;
	var year;
	if(EnteredValue == "dd-mm-jjjj" || EnteredValue == "")
	{
		return true;
	}
	
	// Eerst testen voor situatie met 8 digits
	var matchResult = EnteredValue.match(/^\s*(\d{2})\W*(\d{2})\W*(\d{4})\s*$/);
	if(matchResult)
	{
	day = Number(matchResult[1]);
	month = Number(matchResult[2]);
	year = Number(matchResult[3]);
	}
	matchResult = EnteredValue.match(/^\s*\b(\d+)\b\D*\b(\d+)\b\D*\b(\d+)\s*$/);
	if(matchResult)
	{
	day = Number(matchResult[1]);
	month = Number(matchResult[2]);
	year = Number(matchResult[3]);
	if(year < 100)
	{
		if(year < 30)
		{
		year+=2000;
		}else{
		year+=1900;
		}
	}
	}	
	if(year)
	{
		if (IsValidDate(day,month,year)) {
			return true;
		}
	}
	return false;
}

function HandleNotEditableForm( obj )
{

	if ( confirm( obj.getAttribute("message") ) )
	{
		location.replace( obj.getAttribute("wizardstarturl") );
		
	}
	else 
	{
		location.replace( obj.getAttribute("homeurl") ); 
	}
}

function HandleNotEditableMutationForm( obj )
{
	alert (obj.getAttribute("message"));
	location.replace(obj.getAttribute("homeurl"));
}

function hideProgress()
{
	var geduldMsg = xGetElementById ("geduldMsg");
	if (geduldMsg) geduldMsg.style.display = "none";
}

// functies waarvan nog niet is vastgesteld dat ze gebruikt worden.
// indien blijkt dat ze daadwerkelijk gebruikt worden, gaarna naar boven verplaatsen

function showProgress(msg)
{
	var geduldMsg = xGetElementById("geduldMsg");
	var geduldMsgTxt = xGetElementById("geduldMsgTxt");
	if(geduldMsg) {
		geduldMsg.style.display = "block";
	}				
	geduldMsgTxt.innerHTML = msg;
}


/*
	Deze drie functie stellen de breedte van de kolommen in 
*/
function widerColumn() {
	xGetElementById('panelDiv').style.width = "65%";
	xGetElementById('polisbladDiv').style.width = "15%";
	xGetElementById('polisbladDiv').style.left = "75%";
	//WizardResize();
}

function demiColumn() {
	xGetElementById('panelDiv').style.width = "45%";
	xGetElementById('polisbladDiv').style.width = "40%";
	xGetElementById('polisbladDiv').style.left = "55%";
	//WizardResize();
}

function smallerColumn() {
	xGetElementById('panelDiv').style.width = "25%";
	xGetElementById('polisbladDiv').style.width = "60%";
	xGetElementById('polisbladDiv').style.left = "35%";
	//WizardResize();
}
/*
	Deze functie wordt periodiek aangeroepen omdat er dynamisch items kunnen worden toegevoegd aan 
	en verwijderd van de wizard. het interval wordt gestart in WizardController/WizardPage.cs
*/
function WizardResize()
{

	var controls = xGetElementsByClassName("controls", null, "div");
	if(controls.length == 0)return;
	controls = controls[0];
	var full = controls.childNodes[0];
	var ControlsTop = xFullOffsetTop(controls);
	var screensize = xClientHeight();
	var AvailHeight = screensize - ControlsTop;
	// Een klein beetje extra ruimte laten, zodat je ook 
	// de volgende knop en het volgende headertje kan zien
	AvailHeight -= 60;	
	var polisblad = xGetElementById('polisbladDiv');
	if (polisblad==null) return;
	var panel = xGetElementById('panelDiv');
	if (panel==null) return;
	var ftrTop = polisblad.offsetHeight + polisblad.offsetTop;
	
	if ( (panel.offsetHeight + panel.offsetTop)	> (polisblad.offsetHeight + polisblad.offsetTop) ) 
	{
		ftrTop = panel.offsetHeight + panel.offsetTop;
	}

	var footer = xGetElementById('footerDiv');
	if(footer)
	{
		footer.style.top = ftrTop + 10;
	}
	
}






/*
	Hulp functie om een ancestor tag te vinden met een bepaalde tagname
*/
function xFindParentOfName(e, n)
{
	while(e.parentNode && e.parentNode.tagName.toUpperCase() != "BODY")
	{
	e = e.parentNode;
	if(e.tagName.toUpperCase() == n.toUpperCase())return e;
	}
	return null;
}

function ShowHideZorgOptGegevensVelden()
{
var ja = document.getElementById('container_ctl18_ctl02_rbl_0');
if ( ja.checked )
{
    document.getElementById('ledenkortingdiv').style.display = 'block';
}
else
{
    document.getElementById('ledenkortingdiv').style.display = 'none';
}
}


