function lookupFrom(fieldValue) {
    if(fieldValue.length == 0) {
        // Hide the suggestion box.
        $('#suggestions').hide();
    } else {
        $.post("/ajax/rpc.php", {from: ""+fieldValue+""}, function(data){
            if(data.length >1){
                $('#suggestions').show('blind','',500);
                $('#autoSuggestionsList').html(data);
            }
        });
    }
} // lookup from

function lookupWhere(fieldValue) {
    if(fieldValue.length == 0) {
        // Hide the suggestion box.
        $('#suggestions1').hide();
    } else {
        $.post("/ajax/rpc.php", {where: ""+fieldValue+""}, function(data){
            if(data.length >1){
                $("#suggestions1").show('blind','',500);
                $('#autoSuggestionsList1').html(data);
            }
        });
    }
} // lookup where

function fill(thisValue, thisCode, field ) {
	if(field == "from"){
    	$('#from').val(thisValue);
    	$('#from_code').val(thisCode);
    	$('#suggestions').hide();
	}else{
		$('#where').val(thisValue);
		$('#where_code').val(thisCode);
		$('#suggestions1').hide();
	}	
}

function hide(){
	$('#suggestions').hide();
	$('#suggestions1').hide();
}

$(function() {
	$("#date1").datepicker({
		onSelect: function(dateText, inst) {
					$('#date2').val(dateText);
		}
	});
	$("#date2").datepicker();
});

function showOptions(value){
	var hossz = document.getElementById('infant').options.length;
	for(var i=0; i<=hossz; i++){
		document.getElementById('infant').options[i] = null;
	}
	for(var i=0; i<=value; i++){
		document.getElementById('infant').options[i] = new Option(i,i);
	}
}


