function setArrivalDate(value, type){
var currDay = window.document.frmQuickFind.SrchFromDay.value;
var currMonth = window.document.frmQuickFind.SrchFromMonth.value;
var currYear = window.document.frmQuickFind.SrchFromYear.value;

if(currDay.length==1){
currDay = '0'+currDay;
}
if(currMonth.length==1){
currMonth = '0'+currMonth;
}
if((type==1 || type==2) && value.length==1){
value = '0'+value;
}

if(type==0) {
currDateString = new String(currYear+''+currMonth+''+currDay);
window.document.frmQuickFind.qfdArrivalDate.value = currDateString;
}
else{
if(type==1) {
currDateString = new String(currYear+''+currMonth+''+value);
}
if(type==2) {
currDateString = new String(currYear+''+value+''+currDay);
}
if(type==3) {
currDateString = new String(value+''+currMonth+''+currDay);
}

var searchDate = new Date(currYear, currMonth-1, currDay);
var check = checkSearchDate(searchDate);
if(check == false){
setCurrentDay();
}
else{
window.document.frmQuickFind.qfdArrivalDate.value = currDateString;
}
}
}

function checkSearchDate(searchDate) {
var currDate = new Date();

if(searchDate.getYear() < currDate.getYear()){
alert("Please select a year that is in the future");
return false;
}
if(searchDate.getMonth() < currDate.getMonth()){
alert("Please select a month that is in the future");
return false;
}
if(searchDate.getDate() < currDate.getDate()){
alert("Please select a day that is in the future");
return false;
}

return true;
}
