var today = new Date();
var PickDate = new Date(today.getTime()+ 2*24*60*60*1000);
var RetDate = new Date(today.getTime()+ 7*24*60*60*1000);

var mon = today.getMonth()+1;
var day    = today.getDate();
var yea        = today.getFullYear();


var pmon = PickDate.getMonth()+1;
var pday    = PickDate.getDate();
var pyea        = PickDate.getFullYear();

var rmon = RetDate.getMonth()+1;
var rday    = RetDate.getDate();
var ryea        = RetDate.getFullYear();

//document.write(rday);

function setPickupDate(what)
	{
	document.car_options.pickupmonth.value=	pmon;
	document.car_options.pickupday.value=	pday;
	document.car_options.pickupyear.value=	pyea;
		
	}
	
function UpdateMonths(what)
	{
		document.car_options.returnmonth.value = document.car_options.pickupmonth.value;
	}

function setRetDate(what)
	{
	document.car_options.returnmonth.value=	rmon;
	document.car_options.returnday.value=	rday;
	document.car_options.returnyear.value=	ryea;
		
	}

function monthCompare(what)
	{
		
		//alert (document.car_options.pickupmonth.value);
		//alert (document.car_options.returnmonth.value);
		//alert (document.car_options.pickupmonth.value > document.car_options.returnmonth.value);
		
		if (parseFloat(document.car_options.pickupmonth.value) > parseFloat(document.car_options.returnmonth.value))
			{
				document.car_options.returnyear.value = pyea+1;
			}
		else
			{
				document.car_options.returnyear.value = pyea;
			}	
			
			
	}
	


function leapyear(y)
	{
	isleap=0;

	if (mod(y,4)== 0) {
// Years evenly divisible by 4 are leap years.
    $isleap=1;
// Exception: Centurial years that are not evenly divisible by 400.
    if ( mod(y,100) == 0 && mod(y,400) != 0) {
        // not a leap year
        $isleap=0;        
    }            
}
return $isleap;    
		
	}


function pickdays(m,l) {

	var select2 = document.car_options.pickupday; 
	select2.options.length = 0;
	
	if ((m=="1") || (m=="3") || (m=="5") || (m=="7") || (m=="8") || (m=="10") || (m=="12")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		select2.options[select2.options.length] = new Option ('29');
		select2.options[select2.options.length] = new Option ('30');
		select2.options[select2.options.length] = new Option ('31');
		}
		
		if ((m=="4") || (m=="6") || (m=="9") || (m=="11")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		select2.options[select2.options.length] = new Option ('29');
		select2.options[select2.options.length] = new Option ('30');
		}
		
	if ((m=="2") && (l=="0")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		}
		
	if ((m=="2") && (l=="1")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		select2.options[select2.options.length] = new Option ('29');
		}
}

function pickdays2(m,l) {

	var select2 = document.car_options.returnday; 
	select2.options.length = 0;
	
	if ((m=="1") || (m=="3") || (m=="5") || (m=="7") || (m=="8") || (m=="10") || (m=="12")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		select2.options[select2.options.length] = new Option ('29');
		select2.options[select2.options.length] = new Option ('30');
		select2.options[select2.options.length] = new Option ('31');
		}
		
		if ((m=="4") || (m=="6") || (m=="9") || (m=="11")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		select2.options[select2.options.length] = new Option ('29');
		select2.options[select2.options.length] = new Option ('30');
		}
		
	if ((m=="2") && (l=="0")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		}
		
	if ((m=="2") && (l=="1")) 
		{
		select2.options[select2.options.length] = new Option ('1');
		select2.options[select2.options.length] = new Option ('2');
		select2.options[select2.options.length] = new Option ('3');
		select2.options[select2.options.length] = new Option ('4');
		select2.options[select2.options.length] = new Option ('5');
		select2.options[select2.options.length] = new Option ('6');
		select2.options[select2.options.length] = new Option ('7');
		select2.options[select2.options.length] = new Option ('8');
		select2.options[select2.options.length] = new Option ('9');
		select2.options[select2.options.length] = new Option ('10');
		select2.options[select2.options.length] = new Option ('11');
		select2.options[select2.options.length] = new Option ('12');
		select2.options[select2.options.length] = new Option ('13');
		select2.options[select2.options.length] = new Option ('14');
		select2.options[select2.options.length] = new Option ('15');
		select2.options[select2.options.length] = new Option ('16');
		select2.options[select2.options.length] = new Option ('17');
		select2.options[select2.options.length] = new Option ('18');
		select2.options[select2.options.length] = new Option ('19');
		select2.options[select2.options.length] = new Option ('20');
		select2.options[select2.options.length] = new Option ('21');
		select2.options[select2.options.length] = new Option ('22');
		select2.options[select2.options.length] = new Option ('23');
		select2.options[select2.options.length] = new Option ('24');
		select2.options[select2.options.length] = new Option ('25');
		select2.options[select2.options.length] = new Option ('26');
		select2.options[select2.options.length] = new Option ('27');
		select2.options[select2.options.length] = new Option ('28');
		select2.options[select2.options.length] = new Option ('29');
		}
}

		
function selectstartday(day) {

	var select2 = document.car_options.pickupday; 
	select2.selectedIndex = day;
	}

