

function GenerateOptionsForContactForm7()
{
	monthArray = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'];
	numberOfVisibleMonth = 24;
	
	currentDate = new Date();
	currentMonth = currentDate.getMonth();
	currentYear = currentDate.getFullYear();
	
	lastVisibleDate = new Date(currentYear, currentMonth+numberOfVisibleMonth, 1);

	var selectElementTo;

	try {
		selectElementTo = $$('span.your-traveldate-monthyear select')[0];
		
		if (!selectElementTo)
			return;
	}
	catch (Exception)
	{ return; }
	
	selectElementTo.options.length = 0; //clears the list

	for (m = 0; m < numberOfVisibleMonth; m++)
	{
		tmpDate = new Date(currentYear, currentMonth+m, 1);
		
		selectElementTo.options[selectElementTo.options.length] = new Option(monthArray[tmpDate.getMonth()] + ' - ' + tmpDate.getFullYear(), monthArray[tmpDate.getMonth()] + '-' + tmpDate.getFullYear());
	}
	
	//sets the first value of the selectboxes to the hidden fields
	$('hiddentraveldate').value = selectElementTo.options[0].value; 
	
	//adds an event to the selectboxes so they updates the hidden fields with the selected value (work around thing for contact form 7...)
	selectElementTo.observe('change', 
		function(event) { 
			$('hiddentraveldate').value = $F(Event.element(event));
		} 
	);
}

//fills the date optionlists in the "Contact From 7" when the page is loaded...
Event.observe(window, 'load', GenerateOptionsForContactForm7);


