function openPopupWindow( winURL , winName , winWidth , winHeight , winMenubar, winScroll )
{
	winLeft = ( screen.width / 2 ) - ( winWidth / 2 ); winTop = ( screen.height / 2 ) - ( winHeight / 2 ); 
	window.open( winURL , winName , "toolbar=0,directories=0,location=0,menubar=" + winMenubar + ",resizable=0,status=0,scrollbars=" + winScroll + ",width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop + "");
}

function validatePostcodeForm(form)
{
	if ( (form.postcode.value == "") || (form.postcode.value.length != 4) )
	{
		window.alert("Please enter a four digit postcode.");
		form.postcode.focus();
		return false;
	}
	else
	{
        for ( var i = 0; i < form.postcode.value.length; i++ )
        { 
            var ch = form.postcode.value.substring( i, i + 1 ); 
            if ( ( ch < "0" ) || ( ch > "9" ) )
            { 
				window.alert("Please enter a numeric postcode.");
				form.postcode.focus();
				return false;
			}
		}
		return true;
	}
}

function validateNumberForm(form)
{
	if (form.registrationNumber.value == "")
	{
		window.alert("Please enter a valid registration number.");
		form.registrationNumber.focus();
		return false;
	}
	else
	{
        for ( var i = 0; i < form.registrationNumber.value.length; i++ )
        { 
            var ch = form.registrationNumber.value.substring( i, i + 1 ); 
            if ( ( ch < "0" ) || ( ch > "9" ) )
            { 
				window.alert("Please enter a numeric registration number.");
				form.registrationNumber.focus();
				return false;
			}
		}
		return true;
	}
}

function validateNameForm(form)
{
	if (form.surname.value == "")
	{
		window.alert("Please enter a valid surname.");
		form.surname.focus();
		return false;
	}
	else
	{
        for ( var i = 0; i < form.surname.value.length; i++ )
        { 
            var ch = form.surname.value.substring( i, i + 1 ); 
            if ( (ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch != " ") && (ch != "-") && (ch != "'") )
            { 
				window.alert("Surname entered must contain only letters and spaces.");
				form.surname.focus();
				return false;
			}
		}
        for ( var i = 0; i < form.firstNames.value.length; i++ )
        { 
            var ch = form.firstNames.value.substring( i, i + 1 ); 
            if ( (ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch != " ") && (ch != "-") && (ch != "'") )
            { 
				window.alert("First names entered must contain only letters and spaces.");
				form.firstNames.focus();
				return false;
			}
		}
		return true;
	}
}
