	function GetSelectValue(FormName, SelectName)
	{
		var S = document.getElementById(FormName)[SelectName]
		return S.options[S.selectedIndex].value;
	}

	function SubmitOffer()
	{
		var Country = GetSelectValue('OfferForm', 'Country');
		var MaxSpending = GetSelectValue('OfferForm', 'MaxSpending');
		var PayAtOnce = document.forms['OfferForm'].PayAtOnce[0].checked;

		if (Country == '')
		{
			alert('Please select your country');
			return false;
		}
		if (MaxSpending == 0)
		{
			alert('Please select how much you want to spend on a new car');
			return false;
		}
		if (Country == 'XX')
		{
			alert('Only inhabitants of the European Union can order at T.E.C.');
			return false;
		}
		if (PayAtOnce == 0)
		{
			alert('T.E.C. does not provide payment plans');
			return false;
		}

		location.href = 'ChooseCar.asp';
	}

	function ChooseBrand()
	{
		var BrandId = GetSelectValue('ChooseCar', 'BrandId');
		location.href = 'ChooseCar.asp?BrandId=' + BrandId;
	}

	function ChooseType()
	{
		var BrandId = GetSelectValue('ChooseCar', 'BrandId');
		var TypeId = GetSelectValue('ChooseCar', 'TypeId');
		location.href = 'ChooseCar.asp?BrandId=' + BrandId + '&TypeId=' + TypeId;
	}
	
	function ApplyJob(JobId)
	{
		location.href = 'JobApply.asp?VacancyId=' + JobId;
	}

	function ChooseEdition()
	{
		var BrandId = GetSelectValue('ChooseCar', 'BrandId');
		var TypeId = GetSelectValue('ChooseCar', 'TypeId');
		var EditionId = GetSelectValue('ChooseCar', 'EditionId');
		location.href = 'ChooseCar.asp?BrandId=' + BrandId + '&TypeId=' + TypeId + '&EditionId=' + EditionId;
	}

	function ChooseSubmit()
	{
		var EditionId = GetSelectValue('ChooseCar', 'EditionId');

		if (EditionId > 0)
		{
			document.getElementById('ChooseCar').submit();
		}
	}

	function ViewCustomer()
	{
		location.href = 'ViewCustomer.asp';
	}

	function EditCustomer()
	{
		location.href = 'EditCustomer.asp?Action=Load';
	}

	function SetPassword()
	{
		location.href = 'SetPassword.asp';
	}

	function LogOff()
	{
		location.href = 'LogOff.asp';
	}

	function InvokeAction(A)
	{
		document.forms[0].action += A;
		document.forms[0].submit();
	}
	function ViewCar(EditionId)
	{
		location.href = 'CarDetails.asp?EditionId=' + EditionId;
	}
	function ViewType(TypeId)
	{
		location.href = 'TypeDetails.asp?TypeId=' + TypeId;
	}
	function ViewOriginal(ImageId, Title, Width, Height)
	{
		var CarWindow = window.open('CarFullscreen.asp?ImageId=' + ImageId + '&Title=' + Title + '&Width=' + Width + '&Height=' + Height, '_blank', 'width=775,height=' + ((775 / Width) * Height) + ',resizable');
	}
	function ViewDocument(DocumentId)
	{
		location.href = 'ViewDocument.asp?DocumentId=' + DocumentId;
	}

	function UpdatePrice(Sender)
	{
		var i = Sender.selectedIndex;
		document.forms['Appointment'].OfferPrice.value = Sender.options[i].value;
	}