	function cursor_wait() 
	{
		document.body.style.cursor = 'wait';
	}
	
	function cursor_clear() 
	{
		document.body.style.cursor = 'default';
	}

	function shortMonths ()
	{
		months = new Array ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
		return months;	
	}

	function getShortMonth (mon)
	{
		months = shortMonths();
		return months[mon];	
	}

	function quitForm (xmlResponse)
	{
		var errorMsg = xmlResponse.getElementsByTagName('error')[0].firstChild.data;
		if (errorMsg != "OK")
			alert ("Error: " + errorMsg);
		else
			alert ("Your seasonal settings have been saved");

		var queryForm = getObject ("query");
		queryForm.submit();
	}

	function changeYear (obj) 
	// Fetch data for the new year
	{
		cursor_wait();
		var year = yrVu.year;
		var yearSelObj = getObject("clsYrSel");
		yearSelObj.disable = true;
		var newYear = yearSelObj.value;
		if (year != newYear)
		{
			var yearData = "newyr=" + newYear;
			yearData += "&prop=" + yrVu.property;
			yrVu.year = newYear;
//			doXmlReq (recYrData, "https://Secure-Comms.co.uk/VM/Incl/VillaSeasons.php", yearData);
			doXmlReq (recYrData, "RatesReq.php", yearData);
		}
	}
	
	function recYrData (xmlResponse)
	{
		var errorMsg = xmlResponse.getElementsByTagName('error')[0].firstChild.data;
		if (errorMsg != "OK")
			alert ("Error: " + errorMsg);
		else
		{
			var monthTag;
			var mons = shortMonths ();
			for (mon = 0; mon < 12; mon++)
			{
				monthTag = mons[mon].toLowerCase() + '1';
				yrVu.monthsData[mon] = xmlResponse.getElementsByTagName(monthTag)[0].firstChild.data;
			}
			updateGrid (yrVu);

			var newPricesStr = xmlResponse.getElementsByTagName('prices')[0].firstChild.data;
			var newPrices = newPricesStr.split ("|");
			yrVu.prices.length = 0;
			yrVu.prices = yrVu.prices.concat (newPrices);
			updatePrices (yrVu);
			
			cursor_clear();
		}	
//var debugMsg = xmlResponse.getElementsByTagName("debugmsg")[0].firstChild.data;
//if (debugMsg)
//	alert (debugMsg);	
		var yearSelObj = getObject("clsYrSel");
		yearSelObj.disable = false;
	}
	
	function changeCurrency ()
	{
		yrVu.currency = getValue ("clsCurrSel");
		switch (yrVu.currency)
		{
			case "Pounds sterling" :
			yrVu.xRate = 1;
			break;
			
			case "Euros" :
			yrVu.xRate = yrVu.xRates[2];
			break;
			
			case "US dollars" :
			yrVu.xRate = yrVu.xRates[3];			
			break;
			
			case "Canadian dollars" :
			yrVu.xRate = yrVu.xRates[1];			
			break;
			
			default :
			yrVu.xRate = 1;			
		}
		updatePrices (yrVu);
	}

