

function GenerateOptionsForContactForm7()
{
	monthArray = ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december'];
	numberOfVisibleMonth = 24;
	
	currentDate = new Date();
	currentMonth = currentDate.getMonth();
	currentYear = currentDate.getFullYear();
	
	lastVisibleDate = new Date(currentYear, currentMonth+numberOfVisibleMonth, 1);
	
	selectElementTo = $$('span.your-traveldate-monthyear select')[0];
	selectElementFrom = $$('span.your-traveldatehome-monthyear select')[0];

	selectElementTo.options.length = 0; //clears the list
	selectElementFrom.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());
		selectElementFrom.options[selectElementFrom.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; 
	$('hiddentraveldatehome').value = selectElementFrom.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));
		} 
	);

	selectElementFrom.observe('change', 
		function(event) { 
			$('hiddentraveldatehome').value = $F(Event.element(event));
		} 
	);
}

//fills the date optionlists in the "Contact From 7" when the page is loaded...
Event.observe(window, 'load', GenerateOptionsForContactForm7);


