function getInternetExplorerVersion() {
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}

if(!$chk(MVP)) {
	var MVP = {}; 
}

if(!$chk(MVPVars)) {
	var MVPVars = {}; 
}
MVPVars = {
	areaToggle1: Class.empty,
	areaToggle2: Class.empty,
	areaToggle3: Class.empty,
	areaToggle4: Class.empty,
	betaalwijze: 'betaalwijze',
	onderwijsvorm: 'onderwijsvorm'
};

MVP.slideBetaal = function(e,value){
	if(value == 'deelnemer'){
		MVPVars.areaToggle2.start('height', $('slide2').getStyle('height'), 0);
		MVPVars.areaToggle1.start('height', $('slide1').getStyle('height'), 275);		
	}
	if(value == 'werkgever'){
		MVPVars.areaToggle1.start('height', $('slide1').getStyle('height'), 0);
		MVPVars.areaToggle2.start('height', $('slide2').getStyle('height'), 645);		
	}
}

MVP.slideBetaalPE = function(e,value){
	if(value == 'deelnemer'){
		MVPVars.areaToggle2.start('height', $('slide2').getStyle('height'), 0);
	}
	if(value == 'werkgever'){
		MVPVars.areaToggle2.start('height', $('slide2').getStyle('height'), 210);		
	}
}

MVP.slideOnderwijs = function(e,value){

	if(value == 'contactonderwijs'){
		MVPVars.areaToggle4.start('height', $('elearning').getStyle('height'), 0);
		MVPVars.areaToggle3.start('height', $('contactonderwijs').getStyle('height'), 205);
	}
	if(value == 'elearning'){
		MVPVars.areaToggle3.start('height', $('contactonderwijs').getStyle('height'), 0);
		MVPVars.areaToggle4.start('height', $('elearning').getStyle('height'), 140);		
	}	
}

// innerSlideItem
MVP.initFunctions = function(){
	MVPVars.areaToggle1 = new Fx.Tween('slide1', {duration: 500});
	MVPVars.areaToggle2 = new Fx.Tween('slide2', {duration: 500});
	
	MVPVars.areaToggle3 = new Fx.Tween('contactonderwijs', {duration: 500});
	MVPVars.areaToggle4 = new Fx.Tween('elearning', {duration: 500});
	
	MVPVars.areaToggle5 = new Fx.Tween('inschrijvingTotaalOpties1', {duration: 240});
	MVPVars.areaToggle6 = new Fx.Tween('inschrijvingTotaalOpties2', {duration: 240});
	
	$$('.betaalwijze_deelnemer').each(function(element, index) {
		element.addEvent('click', function() {
			if (this.value == 'ViaInschrijvingTotaal') {
				MVPVars.areaToggle5.start('height', this.getStyle('height'), 42);
			} else {
				MVPVars.areaToggle5.start('height', this.getStyle('height'), 0);
			}
		});
	});
	
	$$('.betaalwijze_werkgever').each(function(element, index) {
		element.addEvent('click', function() {
			if (this.value == 'ViaInschrijvingTotaal') {
				MVPVars.areaToggle6.start('height', this.getStyle('height'), 42);
			} else {
				MVPVars.areaToggle6.start('height', this.getStyle('height'), 0);
			}
		});
	});
	
	var radioOptions = $$('.radioBetaal');
	for(i=0;i<radioOptions.length;i++){
		if(radioOptions[i].checked === true){
			MVP.slideBetaal(window,radioOptions[i].value);
		}
		radioOptions[i].addEvent('click',MVP.slideBetaal.bindWithEvent(window,[radioOptions[i].value]));
	}
	
	var radioOptions = $$('.radioBetaalPE');
	for(i=0;i<radioOptions.length;i++){
		if(radioOptions[i].checked === true){
			MVP.slideBetaalPE(window,radioOptions[i].value);
		}
		radioOptions[i].addEvent('click',MVP.slideBetaalPE.bindWithEvent(window,[radioOptions[i].value]));
	}
	var radioOnderwijsOptions = $$('.radioOnderwijs');
	for(i=0;i<radioOnderwijsOptions.length;i++){
		if(radioOnderwijsOptions[i].checked === true){
			MVP.slideOnderwijs(window,radioOnderwijsOptions[i].value);
		}
		radioOnderwijsOptions[i].addEvent('click',MVP.slideOnderwijs.bindWithEvent(window,[radioOnderwijsOptions[i].value]));
	}
}
function clearRadioSelection(id){
    var elements = $$('input[name*=' + id + ']');
    elements.each(function(el){
        el.checked = false;
    });
    if ($chk('calculateTotalPrice') && typeof calculateTotalPrice == 'function'){
    	calculateTotalPrice();
    }
}

window.addEvent('domready',function(){
	if($chk($('aanmeldForm'))){
		MVP.initFunctions();
	}
});
