function set_correct_from_date(search_form) {
	
	var today = new Date();
	var today_day = 18;
	var today_month = 4-1;
	var today_year = 0;
	

	var from_day = document.search_form.pickup_Day.options.selectedIndex;
	var from_month = document.search_form.pickup_Month.options.selectedIndex;
	var from_year = document.search_form.pickup_Year.options.selectedIndex;
	var to_day = document.search_form.return_Day.options.selectedIndex;
	var to_month = document.search_form.return_Month.options.selectedIndex;
	var to_year = document.search_form.return_Year.options.selectedIndex;
	var changeDate = false;
	
	RegenerateDate('pickup_Day', from_month);

    if ((from_year == today_year) && (from_month == today_month) && (from_day < today_day)) {
        from_month = today_month + 1;
		changeDate = true;
    }
    if ((from_year == today_year) && (from_month < today_month)) {
        from_year = today_year + 1;
    }
    // avoiding problem with diffrent number of days in every month - setting 1 day of next month
    /*
    if (from_day > getDaysNum(from_month + 1, actYear + from_year)) {
        from_day = 0;
        from_month++;
    }
    */
    if (from_month == 12) {
        from_month = 0;
        from_year++;
    }
    
    // avoiding problem with last possible date
    /*
    if ((from_year == 2) && (from_month == 11) && (from_day == 30)) {
        from_day--;
    }
    */
    // in case that from_date earlier than new date setting the next day  
    if ((from_year == to_year) && ((from_month > to_month) || ((from_month == to_month) && (from_day >= to_day)))) {
		to_month = from_month;
        to_day = from_day + 1;
        if (to_day >= getDaysNum(to_month+1, actYear+to_year)) {
			to_day = 0;
			to_month++;
            if (to_month > 11) {
                to_month = 0;
                to_year++;
            }
		}
		document.search_form.return_Day[to_day].selected = true;
		document.search_form.return_Month[to_month].selected = true;
        document.search_form.return_Year[to_year].selected = true;
    }

    if (from_year > to_year) {
        to_year = from_year;
        document.search_form.return_Year[to_year].selected = true;
    }
    if (document.search_form.pickup_Day[from_day]) document.search_form.pickup_Day[from_day].selected = true;
    if (document.search_form.pickup_Month[from_month]) document.search_form.pickup_Month[from_month].selected = true;
	if (document.search_form.pickup_Year[from_year]) document.search_form.pickup_Year[from_year].selected = true;
	getDayName();
	

}
function RegenerateDate(select_box_name, from_month){
	var destList = window.document.forms[0][select_box_name];
	/**
     * add remove days in month
     */
    var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);
    var limit_ = 31;
	// days limit
	if (from_month==1) limit_ = 28;
	if (from_month==2) limit_ = 31;
	if (from_month==3) limit_ = 30;
	if (from_month==4) limit_ = 31;
	if (from_month==5) limit_ = 30;
	if (from_month==6) limit_ = 31;
	if (from_month==7) limit_ = 31;
	if (from_month==8) limit_ = 30;
	if (from_month==9) limit_ = 31;
	if (from_month==10) limit_ = 30;
	if (from_month==11) limit_ = 31;

	destList.options.length = 0;
	destList.options.length = (limit_-1);

	for (var k=0; k < limit_; k++){
		if (k < 9) {
			var newOpt = new Option('0'+(k+1), '0'+(k+1));
			destList.options[k] = newOpt;
		}
		else {
			var newOpt = new Option(k+1, k+1);
			destList.options[k] = newOpt;
		}
	}
	if(NS4) history.go(0);
}
