$(function() {
	
	
	//$.datepicker.setDefaults({showOn: 'both', buttonImageOnly: true, buttonImage: 'fileadmin/images/calendar.png', buttonText: 'Calendar'});
	if($('#swordfrom1')){
		$('#swordfrom1').datepicker({ 
		minDate: new Date(2001, 1 - 1, 1),  
		maxDate: new Date(2010, 12 - 1, 31),  
		beforeShow: readLinked1,     
		onSelect: updateLinked1 
		}); 
	}
	if($('#swordfrom2')){
		$('#swordfrom2').datepicker({ 
		minDate: new Date(2001, 1 - 1, 1),  
		maxDate: new Date(2010, 12 - 1, 31),  
		beforeShow: readLinked2,     
		onSelect: updateLinked2 
		}); 
	}
	
});	

function readLinked1() { 
    $('#swordfrom1').val( 
        $('#selectMonth').val() + '/' + 
        $('#selectDay').val() + '/' +  
        $('#selectYear').val() 
    ); 
    return {}; 
} 
 
// Update three select controls to match a date picker selection 
function updateLinked1(date) { 
    $('#selectMonth').val(date.substring(0, 2)); 
    $('#selectDay').val(date.substring(3, 5)); 
    $('#selectYear').val(date.substring(6, 10)); 
} 
 
$('#selectMonth, #selectYear').change(checkLinkedDays1); 
 
// Prevent selection of invalid dates through the select controls 
function checkLinkedDays1() { 
    var daysInMonth = 32 - new Date($('#selectYear').val(), 
        $('#selectMonth').val() - 1, 32).getDate(); 
    $('#selectDay option').attr('disabled', ''); 
    $('#selectDay option:gt(' + (daysInMonth - 1) +')').attr('disabled', 'disabled'); 
    if ($('#selectDay').val() > daysInMonth) { 
        $('#selectDay').val(daysInMonth); 
    } 
} 

function readLinked2() { 
    $('#swordfrom2').val( 
        $('#selectMonth2').val() + '/' + 
        $('#selectDay2').val() + '/' +  
        $('#selectYear2').val() 
    ); 
    return {}; 
} 
 
// Update three select controls to match a date picker selection 
function updateLinked2(date) { 
    $('#selectMonth2').val(date.substring(0, 2)); 
    $('#selectDay2').val(date.substring(3, 5)); 
    $('#selectYear2').val(date.substring(6, 10)); 
} 
 
$('#selectMonth2, #selectYear2').change(checkLinkedDays2); 
 
// Prevent selection of invalid dates through the select controls 
function checkLinkedDays2() { 
    var daysInMonth = 32 - new Date($('#selectYear2').val(), 
        $('#selectMonth2').val() - 1, 32).getDate(); 
    $('#selectDay2 option').attr('disabled', ''); 
    $('#selectDay2 option:gt(' + (daysInMonth - 1) +')').attr('disabled', 'disabled'); 
    if ($('#selectDay2').val() > daysInMonth) { 
        $('#selectDay2').val(daysInMonth); 
    } 
} 
function AgreeCheck(){
	val = document.getElementById('agree').checked;
	if(!val){
		alert('Accepteer de Algemene voorwaarden!');
	}
	return val;
}