Below is a function I have for date check on an online booking form. What I want to achieve is for an alert to pop up when the user tries to book with 2 days of today's date(the current date).

***************************************************

function checkdate(){
flag=0;
dsd = new Array();
ded = new Array();
sdate=document.frm.startrentday[document.frm.startrentday.selectedIndex].value;
sdate=(sdate<10)?"0"+parseInt(sdate):sdate;
smonth=document.frm.startrentmonth[document.frm.startrentmonth.selectedIndex].value;
smonth=(smonth<10)?"0"+parseInt(smonth):smonth;
syear=document.frm.startrentyear[document.frm.startrentyear.selectedIndex].value;
syear=(syear<10)?"0"+parseInt(syear):syear;
dsd=valid_date;
//alert(dsd);
dsd[1]=(dsd[1]<10)?"0"+parseInt(dsd[1]):dsd[1];
dsd[2]=(dsd[2]<10)?"0"+parseInt(dsd[2]):dsd[2];
//dsd=dsd.reverse();
dsd1=dsd.join("");
csd=(syear+""+smonth+""+sdate);
//alert (Number(csd)+"\n"+Number(dsd1));
if((Number(csd)>=today_date) && (Number(csd)<today_date+2)){
alert("If you need to hire a vehicle within the next 48 hours.\nPlease contact our office +353 62 53103");
return false;
}else if(Number(csd)<today_date){
alert("Do not select Previous start date");
return false;
}

*************************************************

The today_date variable is fine. It was defined outside this function.

When I have today_date+2, the alert shows for dates after a two day period.

Is there any way, from looking at my code, that you can see of having the alert pop up only for dates that are two days and less.

I'd really appreciate any help.

Thanks