var Formats = {
	vatformats: {
		GB:	'999999999',
		MT:	'99999999', 
		AT:	'U99999999',
		PT:	'999999999',
		DE:	'999999999',
		ES:	'X9999999X',
		FI:	'99999999',
		IT:	'99999999999',
		NL:	'999999999B99',
		BE:	'999999999(9)',
		DK:	'99999999',
		CZ:	'9999999999',
		EL:	'999999999',
		SE:	'999999999999',
		PL:	'9999999999',
		SI:	'99999999',
		SK:	'9999999999',
		LV:	'99999999999',
		LT:	'999999999',
		LT:	'999999999999',
		LU:	'99999999',
		HU:	'99999999',
		FR:	'XX999999999',
		EE:	'999999999',
		CY:	'99999999L',
		IE:	'9S99999L'
	},
	
	zipformats: {
		GB: 'XXXXXXXXXX',
		MT: 'AAA 99A',
		AT: 'A-9999',
		PT: '9999-999',
		DE: '99999',
		ES: '99999',
		FI: '99999',
		IT: '99999',
		NL: '9999 AA',
		BE: '9999',
		DK: '9999',
		CZ: '999 99',
		GR: '999 99',
		SE: '999 99',
		PL: '99-999',
		SK: 'SK-999 9',
		LV: 'LV-9999',
		LT: 'LT-9999',
		LU: 'L-9999',
		HU: 'H-9999',
		FR: '99999',
		EE: 'EE-9999',
		CY: 'CY-9999',
		RO: '999999'
	}
}

window.onload = init;

function init()
{
	placeVatFormat();
}

function placeVatFormat()
{
	if( document.forms[0].country )
	{
		if( document.forms[0].country.value )
		{
			if( document.getElementById('vatnumber') )
			{
				var VatElement = document.getElementById('vatnumber');
				
				VatElement.innerHTML = '';
				
				if( Formats.vatformats[document.forms[0].country.value] ) 
				{
					VatFormat = Formats.vatformats[document.forms[0].country.value];
					VatElement.innerHTML = document.forms[0].country.value + VatFormat;
				}
			}
			
			if( document.getElementById('zipcodeEx') )
			{
				var ZipElement = document.getElementById('zipcodeEx');
				
				ZipElement.innerHTML = '';
				
				if( Formats.zipformats[document.forms[0].country.value] ) 
				{
					ZipFormat = Formats.zipformats[document.forms[0].country.value];
					ZipElement.innerHTML = ZipFormat;
				}
			}
		}
	
		document.forms[0].country.onchange = function ()
		{
			if( document.getElementById('vatnumber') )
			{
				var VatElement = document.getElementById('vatnumber');
				
				VatElement.innerHTML = '';
				
				if( Formats.vatformats[this.value] ) 
				{
					VatFormat = Formats.vatformats[this.value];
					VatElement.innerHTML = this.value + VatFormat;
				}
			}
			
			if( document.getElementById('zipcodeEx') )
			{
				var ZipElement = document.getElementById('zipcodeEx');
				
				ZipElement.innerHTML = '';
				
				if( Formats.zipformats[this.value] ) 
				{
					ZipFormat = Formats.zipformats[this.value];
					ZipElement.innerHTML = ZipFormat;
				}
			}
		}
	}
}
