function get_calendar(date) {
    new Ajax.Request('/home/calendar.html'+'?date='+date, {
        method:'get',
        onSuccess: function(response) {
            $("full_calendar").style.width = '159px';
            $("calendar_container").innerHTML=response.responseText;
            if($("calendar_container").style.display == 'none') {
                //Effect.BlindDown($("calendar_container"), {delay: .05, duration: 1});
                $("calendar_container").show();
            }
            if($("calendar-wrapper").style.display == 'none') {
                $("calendar-wrapper").show();
                $("calendar-wrapper").style.display = 'block';
            }
        }
    });
}

function show_holidays(country) {
    new Ajax.Request('/home/holidays.html'+'?country='+country, {
        method:'get',
        onSuccess: function(response) {
            $("holidays_container").innerHTML=response.responseText;
            $("full_calendar").style.width = '325px';
            $("holidays_container").show();
			$("holidays_container").style.display = 'block';
        }
    });
}

function close_holidays() {
    //Effect.Shrink($("holidays_container"), {afterFinish: function(){ $("full_calendar").style.width = '175px'; } });
    $("holidays_container").hide();
    $("full_calendar").style.width = '159px';
}

function holidays_list(region) {
    new Ajax.Request('/home/holidaysList.html'+'?holiday_region='+region, {
        method:'get',
        onSuccess: function(response) {
            $("holidays_container").innerHTML=response.responseText;
            //Effect.Grow($("holidays_container"), { duration: 3.0 });
            $("holidays_container").style.display = 'block';
            //$("full_calendar").style.width = '480px';
        }
    });
}

function select_holiday(start,finish,holiday_name) {
    new Ajax.Request('/home/calendar.html'+'?date='+start+'&holiday=1&finish='+finish+'&holiday_name='+holiday_name, {
        method:'get',
        onSuccess: function(response) {
            $("calendar_container").innerHTML=response.responseText;
        }
    });
}

function close_calendar() {
    close_holidays();
    
    //Effect.BlindUp($("calendar_container"), {delay: .05, duration: 1});
    $("calendar-wrapper").hide();
    $("calendar_container").hide();
    $("duration_dropdown").show();
}

function change_dates() {
    var select_date = $("dates").value;
    new Ajax.Request('/home/whenDate.html?date='+select_date, {
        method:'get',
        onSuccess: function(response) {
            $("open_calendar_link").innerHTML=response.responseText;
        }
    });
}

function process_form(date) {
    $("busy_form").style.display = 'block';
    if ($("region") == undefined)
    {
        var region = '';
    }
    else
    {
        var region = $("region").value;
    }
    if(date != undefined) dates = date; else dates = $("dates").value;
    new Ajax.Request('/home/processForm.html?accommodation='+$("accommodation").value+'&country='+$("country").value+'&region='+region+'&dates='+dates+'&duration='+$("duration").value+'&acc_display='+$("accommodation_display").value, {
        method:'get',
        onSuccess: function(response) {
            $("form_container").innerHTML=response.responseText;
            change_dates();
            $("busy_form").style.display = 'none';
        }
    });
}
		
function clearNewsletterBox(t)
{
    if (t && $("newsletterTerm").value == t)
    {
        $("newsletterTerm").value = "";
    } 
    else if ($("newsletterTerm").value == "Uw e-mail adres")
    {
        $("newsletterTerm").value = "";
    }
}

function fillNewsletterBox(t)
{
    if ($("newsletterTerm").value == "")
    {
        if (t)
            $("newsletterTerm").value = t;
        else
            $("newsletterTerm").value = "Uw e-mail adres";
    }

}
