//sets default variable values

targeturl	= "http://arestravel.com/";
aresid 		= "492";
city		= "";
section		= "";
subsection	= "";

function write_hotdeals(){
	
	document.write("Hot Deals".link(targeturl+aresid+"/-/hotdeals/"));
	
}

function write_action(theform){
	
	theform.action=targeturl+aresid+'/-/date/simple/city='+city+'/section='+section+'/subsection='+subsection;
		
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		index_04_over = newImage("images/index_04-over.gif");
		index_05_over = newImage("images/index_05-over.gif");
		index_06_over = newImage("images/index_06-over.gif");
		index_07_over = newImage("images/index_07-over.gif");
		index_08_over = newImage("images/index_08-over.gif");
		preloadFlag = true;
	}
}

function write_date(){

	todays_date = new Date();
	
	
		
	new_day = todays_date.getDate() + 3;
	todays_date.setDate(new_day);
	
	months = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');

	//sets options in the day drop down
	
	for(i=0;i<31;i++){
	
		j = i + 1;
		option_selected = 0;
		if( todays_date.getDate() == j ){
			option_selected = 1;
		}
		document.hotelquery.elements[1].options[i] = new Option(j,j,"",option_selected);
		
	}
	
	for(i=0;i<12;i++){
	
		new_date = todays_date;
		
		month_num = new String((new_date.getMonth() + 1));
		if(month_num.length == 1){
			month_num = "0" + month_num;
		}
		
		year = String(new_date.getYear());
		if(year.length == 3){
			year = "20" + year.substring(1, 3);
		}
		
		
		
		option_value = year + "-" + month_num;
		option_text = months[new_date.getMonth()] + " " + year;
		document.hotelquery.elements[2].options[i] = new Option(option_text,option_value);
		
		new_month = new_date.getMonth() + 1;
		new_date.setMonth(new_month);
	}
	
	
	//sets options in the number of nights drop down
	
	for(i=0;i<40;i++){
	
		j = i + 1;
		selected_nights = 0;
		if( j == 3 ){
			selected_nights = 1;
		}
		document.hotelquery.elements[3].options[i] = new Option(j,j,"",selected_nights);
		
	}
	
	
	
}

window.onload = write_date