// Function will select wait flash movie

function setWaitMovie() {
	
	var today = new Date();
	var late  = false;
	var usa   = false;

	var dest = document.getElementById('destination');
	var checkinDateString = document.getElementById('checkin');

	var checkinDay = parseInt(checkinDateString.value.substr(0,2));
	var checkinMonth = parseInt(checkinDateString.value.substr(3,2))-1; 
	var checkinYear = parseInt('20' + checkinDateString.value.substr(6,2));
	
	var checkinDate = new Date(checkinYear, checkinMonth, checkinDay);
	var daysTillCheckin = parseInt((checkinDate - today) / 1000 / 60 / 60 / 24) + 1;
	
	if(daysTillCheckin < 15) { late = true; }
	if(dest.value.indexOf(', usa') > 0) { usa = true; }
	var changeMovie = false;
	
	if(late && usa) {
		
		var mov = 'images/ventefilm_usa_late.swf';
		var parms = 'ventefilm_usa_late.swf';
		changeMovie = true;
	
	} else if(late) {
		
		var mov = 'images/ventefilm_eur_late.swf';
		var parms = 'ventefilm_eur_late.swf';
		changeMovie = true;
	
	} else if(usa) {
		
		var mov = 'images/ventefilm_usa_invoice.swf';
		var parms = 'ventefilm_usa_invoice.swf';
		changeMovie = true;
	}
	
	if(changeMovie) {

		document.getElementById('wait1').innerHTML='<object width="175" height="146"><param id="movieparms" name="movie" value="' + parms + '"><embed id="waitmovie" src="' + mov + '" width="175" height="146"></embed></object>';
		
	}
}
