function changeImage(flag, border)
{
	updateCost();
	if(flag == 'none')
	{
		document.plate_spacer.width = 6;
	}
	else
	{
		document.plate_spacer.width = 33;
	}
	document.getElementById('display').style.backgroundImage = 'url(plateimages\/badges\/' + flag + '_' + border + '\.gif)';
}

function changeShadow(Shad)
{
	updateCost();

	TheFlagBit = (document.BuildForm.flag.value);
	
	if(TheFlagBit == 'none')
	{	
		document.getElementById('Shadow').style.backgroundImage = eval('\"url\(plateimages\/shadows\/shad\_' + Shad + '\_none\.gif\)\"');
	}
	else
	{
		document.getElementById('Shadow').style.backgroundImage = eval('\"url\(plateimages\/shadows\/shad\_' + Shad + '\.gif\)\"');
	}
	if(Shad == 'none')
	{	
		document.getElementById('backwarning').style.backgroundImage = eval('\"url\(plateimages\/spacer.gif\)\"');
	}
	else
	{
		document.getElementById('backwarning').style.backgroundImage = eval('\"url\(plateimages\/warningfont.gif\)\"');
// was - document.getElementById('backwarning').style.backgroundImage = eval('\"url\(plateimages\/spacer.gif\)\"');
	}
}

function updateNumber(number, font)
{
	i = 0;
	while(i < 8)
	{
		if (isAlphaNumeric(number.charAt(i)) == true)
		{
			newChar = number.charAt(i);
		}
		else if(number.charAt(i) == ' ')
		{
			newChar = '_';
		}
		else
		{
			newChar = 'spacer';
		}
		if(newChar != 'spacer')
		{
			newChar = newChar.toUpperCase();
		}
		if(newChar == 'I' || newChar == '1' || newChar == '_')
		{
			newWidth = 11;
		}
		else if(newChar == '' || newChar == 'spacer')
		{
			newWidth = 1;
		}
		else
		{
			newWidth = 33;
		}
		switch (i)
		{
		case 0:
			document.images.char_1.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_1.width = newWidth;
			break;
		case 1:
			document.images.char_2.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_2.width = newWidth;
			break;
		case 2:
			document.images.char_3.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_3.width = newWidth;
			break;
		case 3:
			document.images.char_4.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_4.width = newWidth;
			break;
		case 4:
			document.images.char_5.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_5.width = newWidth;
			break;
		case 5:
			document.images.char_6.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_6.width = newWidth;
			break;
		case 6:
			document.images.char_7.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_7.width = newWidth;
			break;
		case 7:
			document.images.char_8.src = 'plateimages/' + font + '/' + newChar + '.gif';
			document.images.char_8.width = newWidth;
			break;
		}
		i++;
	}
		if(font == '3D' || font == 'BSAU145d' || font == 'Carbon')
		{
			warning = "plateimages\/spacer.gif";
		}
		else
		{
			warning = "plateimages\/warningfont.gif";
		}
		document.getElementById('fontwarning').style.backgroundImage = eval('\"url\(' + warning + '\)\"');

}
function SwapPlateImage() {
		var plateimg = document.BuildForm.plate_rear[BuildForm.plate_rear.selectedIndex].value;
		document.getElementById('imgRearPlate').style.backgroundImage = eval('\"url\(images\/' + plateimg + '\.gif\)\"');	
}

function checkTagLineBox() {
	regNumb = document.BuildForm.TagLine.value;
	regNumbCharNumb = regNumb.length
	var charact = /[0-z]/
	var comma= /[\,]/
	var dot= /[\.]/
	var dash= /[\-]/
	var space = /[\ ]/
	var ampas = /[\&]/
	var doubleq = /[\"]/
	var singleq = /[\']/
	for (i= 0; i<regNumbCharNumb; i++) {
	if ((!regNumb.charAt(i).match(doubleq)) & (!regNumb.charAt(i).match(singleq)) & (!regNumb.charAt(i).match(charact)) & (!regNumb.charAt(i).match(space)) & (!regNumb.charAt(i).match(comma)) & (!regNumb.charAt(i).match(dot)) & (!regNumb.charAt(i).match(ampas)) & (!regNumb.charAt(i).match(dash)))
		{
		alert("Illigal Character in the tag line, please check")
		return false;
		}
	}
	return true;
}
function bottom(s)
	{
		document.getElementById("TagLineText").innerHTML=s;
	}

function isAlphaNumeric(char)
{
	char = char.toUpperCase();
	var strValidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	if (char.length == 0) return false;
	if (strValidChars.indexOf(char) == -1)
	{
		return false;
	}
	else
	{
		return true;
	}
}