<!--

function submitOrder(itemid) {
    document.orderworldForm.itemid.value = itemid;
    //if (!validate()) {
    //    return false;
    //}
    document.orderworldForm.submit();
    return false;
}

var SECOND = 1000; // the number of milliseconds in a second
var MINUTE = SECOND * 60; // the number of milliseconds in a minute
var HOUR = MINUTE * 60; // the number of milliseconds in an hour
var DAY = HOUR * 24; // the number of milliseconds in a day
var WEEK = DAY * 7; // the number of milliseconds in a week

function daysBetween(yr, mo, dy) {
    nDate = new Date(); // current date (local)
    nTime = nDate.getTime(); // current time (UTC)
    dTime = Date.UTC(yr, mo - 1, dy); // specified time (UTC)
    bTime = Math.abs(dTime - nTime);  // time difference
    return Math.round(bTime / DAY);
}

function pastToday(yr, mo, dy) {
    nDate = new Date();
    nTime = nDate.getTime(); // current time (UTC)
    dTime = Date.UTC(yr, mo - 1, dy); // specified time (UTC)
    bTime = Math.round((dTime - nTime)/DAY);  // time difference
    //alert(bTime);
    if (bTime >= -1)
        return false;
    else
        return true;
}

function validate() {

    myForm = document.orderworldForm;

    totaldays = daysBetween(myForm.startyear.value, myForm.startmonth.value, myForm.startday.value);
    
    if (totaldays > (6 * 30)) {
        alert("Start date cannot be later than 6 months from today.");
        return false;
    }

    past = false;
    past = pastToday(myForm.startyear.value, myForm.startmonth.value, myForm.startday.value);
    
    if (past) {
        alert("Start date cannot be a past date.");
        return false;
    }

    return true;
}

//-->


