<!--//
	// Estimating JavaScript Functions for Atlas Van Lines International, Inc. //
	
	// If the browser is W3 DOM compliant, execute setImageSwaps function
    if (document.getElementsByTagName && document.getElementById) 
    {
	    if (window.addEventListener) window.addEventListener('load', showVehicles, false);
	    else if (window.attachEvent) window.attachEvent('onload', showVehicles);

	    if (window.addEventListener) window.addEventListener('load', showMotorcycles, false);
	    else if (window.attachEvent) window.attachEvent('onload', showMotorcycles);
    }
	
	
	// ------------------------------- //
	//        Show/Hide Vehicles       //
	// ------------------------------- //
	function showVehicles(){
	    var numToShow = df[0].numVehicles.selectedIndex;
	    if(isNaN(numToShow)||numToShow < 1){
	        numToShow = 0;
	    }else if(numToShow > 5){
	        numToShow = 5;
	    }
	    
	    //hide all except first one
	    setDisplay('Veh1', 'none');
	    setDisplay('Veh2', 'none');
	    setDisplay('Veh3', 'none');
	    setDisplay('Veh4', 'none');
	    setDisplay('Veh5', 'none');
	    
	    //show correct number
	    var i = 1;
	    while (i<=numToShow){
            setDisplay('Veh'+i, 'block');
            i++;
        }

	}
	function showMotorcycles(){
	    var numToShow = df[0].numMotorcycles.selectedIndex
	    if(isNaN(numToShow)||numToShow < 1){
	        numToShow = 0;
	    }else if(numToShow > 5){
	        numToShow = 5;
	    }
	    
	    //hide all except first one
	    setDisplay('Cyc1', 'none');
	    setDisplay('Cyc2', 'none');
	    setDisplay('Cyc3', 'none');
	    setDisplay('Cyc4', 'none');
	    setDisplay('Cyc5', 'none');
	    
	    //show correct number
	    var i = 1;
	    while (i<=numToShow){
            setDisplay('Cyc'+i, 'block');
            i++;
        }
	}
	
	// ------------------------------- //
	//         Calendar Controls       //
	// ------------------------------- //
	var now = new Date();
	var yearahead = new Date(); yearahead.setFullYear(now.getFullYear() + 2); yearahead.setDate(1);
	var yesterday = new Date(); yesterday.setDate(now.getDate() - 1)

	var pickupdate = new CalendarPopup("calendardiv");
	pickupdate.setCssPrefix("ATL");
	pickupdate.addDisabledDates(null,formatDate(yesterday,"yyyy-MM-dd"));
	pickupdate.addDisabledDates(formatDate(yearahead,"yyyy-MM-dd"),null);
	pickupdate.setTodayText("This Month");
	pickupdate.setReturnFunction("setMultipleValues1");

	function setMultipleValues1(y,m,d){								
		var omy = document.getElementById(OrigMonthYearID);
		var od = document.getElementById(OrigDayID);
		omy.selectedIndex=getIndex(omy, m + '-' + y);
		od.selectedIndex=getIndex(od, d);
		toggleDisplay('calendardiv');
		if (typeof(omy.onchange) == "function") omy.onchange();
		if (typeof(od.onchange) == "function") od.onchange();
	}
	
	var deliverydate = new CalendarPopup("calendardiv");
	deliverydate.setCssPrefix("ATL");
	deliverydate.addDisabledDates(null,formatDate(yesterday,"yyyy-MM-dd"));
	deliverydate.addDisabledDates(formatDate(yearahead,"yyyy-MM-dd"),null);
	deliverydate.setTodayText("This Month");
	deliverydate.setReturnFunction("setMultipleValues2");

	function setMultipleValues2(y,m,d){								
		var dmy = document.getElementById(DestMonthYearID);
		var dd = document.getElementById(DestDayID);
		dmy.selectedIndex=getIndex(dmy, m + '-' + y);
		dd.selectedIndex=getIndex(dd, d);
		toggleDisplay('calendardiv');
		if (typeof(dmy.onchange) == "function") dmy.onchange();
		if (typeof(dd.onchange) == "function") dd.onchange();
	}
				
//-->
