$(document).ready(function(){
    $("#fdatepicker").datepicker({ dateFormat: 'dd-mm-yy', minDate: new Date()});
    $("#tdatepicker").datepicker({ dateFormat: 'dd-mm-yy', minDate: new Date()});
    document.getElementById('fdatepicker').setAttribute("autocomplete", "off");
    document.getElementById('tdatepicker').setAttribute("autocomplete", "off"); 
});

function doCheckForm()
{
	//Hoteliers script (form checker + handler):
	/* waarde uit datepickers halen */
	vanDate = document.getElementById('fdatepicker').value;
	totDate = document.getElementById('tdatepicker').value;
	if((vanDate == '') || (totDate == '')){
		alert('Vul een aankomst en vertrek datum in.\nPlease choose an arrival and departure date\nBitte ein ankunft und abfahrt datum zu selectiern');
		return
	}
	dateSplit = vanDate.split('-');
	totdateSplit = totDate.split('-');
	/* waarde in de input boxen inserten */
	$("#ad").attr("value", dateSplit[0]);
	$("#am").attr("value", dateSplit[1]);
	$("#ayear").attr("value", dateSplit[2]);
	$("#dd").attr("value", totdateSplit[0]);
	$("#dm").attr("value", totdateSplit[1]);
	$("#dyear").attr("value", totdateSplit[2]);
	$("#mainContent").html('<h2>Beschikbaarheid</h2><iframe style="margin-left: -10px;" onload="" height="1800px" id="hoteliersIframe" name="hoteliersIframe" scrolling="auto" width="610" frameborder="0">');
	document.getElementById("hcomForm").target = 'hoteliersIframe';
	document.getElementById("hcomForm").submit();
	//$('html,body').animate({scrollTop: 470}, 2000);
	$("#actualContentRight").css("background-image","url(\"../fileadmin/templates/images/contentiframeback.png\")");
	$("#actualContentRight").css("background-repeat","repeat");

}

function doInlogcode()
{
	//Hoteliers script (form checker + handler):
	/* waarde uit datepickers halen */
	inputVal  = document.getElementById('inlogcode').value;
	if(inputVal  == ''){
		alert('Vul a.u.b. de inlogcode in die u van Huis ter Geul heeft gekregen...');
		return
	}
	$("#mainContent").html('<h2>Inloggen met code</h2><iframe style="margin-left: -10px;" onload="" height="1800px" id="hoteliersInlogFrame" name="hoteliersInlogFrame" scrolling="auto" width="610" frameborder="0">');
	document.getElementById("hcomFormCode").target = 'hoteliersInlogFrame';
	document.getElementById("hcomFormCode").submit();
	//$('html,body').animate({scrollTop: 470}, 2000);
	$("#actualContentRight").css("background-image","url(\"../fileadmin/templates/images/contentiframeback.png\")");
	$("#actualContentRight").css("background-repeat","repeat");
	
	//Update inlogcode field:
	//window.parent.hoteliersInlogFrame.document.getElementById('corpname').value = inputVal;
	//parent.hoteliersInlogFrame.location.href="http://www.google.nl";
	setTimeout("top.frames['hoteliersInlogFrame'].document.getElementById('corpname').value = inputVal;", 1500);

}
