function get_calendar(date,duration,country,region,action,qs,script) {
    $('full_calendar').show();
    
    var extra = '';    
    if (duration != null && duration != '')
    {
        extra += '&duration='+duration
    }
    if (country != null && country != '' )
    {
        extra += '&country='+country;    
    }
    if (region != null && region != '')
    {
        extra += '&region='+ region;
    }
    if (action != null && action != '')
    {
        extra += '&action='+ action;
    }
   
    if (script === undefined || script == '') {
    	script = '';
    }
   
    script += '/search/calendar.html'+'?date='+date+extra;
    if(qs !== undefined) {
    	script += '&' + qs;
    }
    
    new Ajax.Request(script, {
        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();
            }
        }
    });
}
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").show();
            $("holidays_container").style.display = 'block';
        }
    });
}

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() {
    $('full_calendar').hide();
    close_holidays();
    //Effect.BlindUp($("calendar_container"), {delay: .05, duration: 1});
    $("calendar_container").hide();
					
}
				
function change_lister_period(date,duration,country,region,action,qs,script) {
	var extra = '';
    if (action != null && action != '')
    {
        extra += '&action='+ action;
    }
    
    if (script === undefined || script == '') {
    	script = '';
    }
    
    script += '/search/dateCalc.html?date='+date+extra;
    if(qs !== undefined) {
    	script += '&' + qs;
    }
    
    new Ajax.Request(script, {
        method:'get',
        onSuccess: function(response) {
            $('full_calendar').hide();
						
            $("calendar_container").hide();

            location.href = response.responseText;
        }
    });
}
// Redirect function for holiday calendar selection.
function setDateSelection(date,duration,country,region)
{
    change_lister_period(date,duration,country,region);
}

function lister_select_month(url, url_params, script) {
    if (script === undefined || script == '') {
    	script = '';
    }
    
    new Ajax.Request(script+'/search/listerSelectMonth.html?date='+$("dates").value+'&url='+url+'&'+url_params, {
        method:'get',
        onSuccess: function(response) {
            location.href = response.responseText;
        }
    });
}

function lister_select_duration(url, url_params, script) {
    if (script === undefined || script == '') {
    	script = '';
    }
	
    new Ajax.Request(script+'/search/listerSelectDuration.html?duration='+$("duration").value+'&url='+url+'&'+url_params, {
        method:'get',
        onSuccess: function(response) {
            location.href = response.responseText;
        }
    });
}

