function printReg(){

	var f = document.platedesigner;

	var plate = document.getElementById("regdiv");

	f.registration.value = f.registration.value.toUpperCase();

	plate.className = f.font.value;
	
	if( ((view == "front") && (f.front.value == "4x4" || f.front.value == "4x4_11x8")) || ((view == "rear") && (f.rear.value == "4x4" || f.rear.value == "motorcycle" || f.rear.value == "motorcycle_8x6" || f.rear.value == "motorcycle_7x5" || f.rear.value == "motorcycle_6x4")) ){

		plateShape = "4x4";

	} else {

		plateShape = "standard";

	}

	if(f.type.value=="old"){

		plate.style.color = "#CCCCCC";

	} else {

		plate.style.color = "#000000";

	}

	if((plateShape == "4x4") && f.registration.value.length > 4){

		plate.innerText = f.registration.value.substr(0,4) + "\r\n" + f.registration.value.substr(4);

	} else {

		plate.innerText = f.registration.value;

	}

}



function printBottom(){

	document.getElementById("btext").innerHTML=document.platedesigner.bottomtext.value+"&nbsp;";

}



function redrawbg(){

	f = document.platedesigner;

	plateTable = document.getElementById("platetable");

	registration = document.getElementById("regdiv");

	bottomText = document.getElementById("btext");

	bottomLogo = document.getElementById("blogo");

	view = f.view.value;
	manlogoos = f.manlogoos.checked;

	// set the side logo based on plate type (show, standard etc)
	
	if(f.type.value == "show"){
	
		sidelogo = f.sidelogo.value;
	
	}
	
	if(f.type.value == "standard"){
	
		sidelogo = f.sidelogo2.value;
		f.bottomtext.value = "www.numberplate-solutions.co.uk";
	}
	

	plateborder = f.plateborder.value;

	if(view == "old"){

		bottomText.style.backgroundColor = "#000000";

		bottomLogo.style.backgroundColor = "#000000";

	} else if (view == "front"){

		bottomText.style.backgroundColor = "#FFFFFF";

		bottomLogo.style.backgroundColor = "#FFFFFF";

	} else {

		bottomText.style.backgroundColor = "#FFCC00";

		bottomLogo.style.backgroundColor = "#FFCC00";

	}

	if(f.type.value == "old"){

		view = "old";

		sidelogo = "none";
		
		TextOpenAndClose('show', 'standard'); // show the show fonts - but disabled

		f.font.options[0].selected = true;

		f.font.disabled = true;

		f.sidelogo.options[0].selected = true; // show plate logo's

		f.sidelogo.disabled = true;
		
		f.sidelogo2.options[0].selected = true; // standard plate logo's

		f.sidelogo2.disabled = true;

		f.make.disabled = true;

		f.plateborder.options[0].selected = true;

		f.plateborder.disabled = true;

		f.bottomtext.disabled = true;

		registration.className = "standard";

		bottomText.style.color = "#CCCCCC";

		bottomText.style.backgroundColor = "#000000";

		bottomLogo.style.backgroundColor = "#000000";

	} else if(f.type.value == "standard"){
		
		TextOpenAndClose('standard', 'show'); // show the standard fonts
		
		TextOpenAndClose('standard2', 'show2');

		f.font.options[0].selected = true;

		f.font.disabled = true;
		
		f.font2.disabled = false;

		f.sidelogo.disabled = true;
		
		f.sidelogo2.disabled = false;

		f.make.disabled = false;

		f.plateborder.disabled = false;

		f.bottomtext.disabled = true;

		registration.className = "standard";

		bottomText.style.color = "#000000";

	} else if(f.type.value == "show"){
		
		TextOpenAndClose('show', 'standard'); // change the font box
		
		TextOpenAndClose('show2', 'standard2'); // change side image drop down

		f.font2.options[0].selected = true;
		
		f.font.disabled = false;

		f.sidelogo.disabled = false;
		
		f.sidelogo2.disabled = true;
		
		f.font.options[1].disabled = true; //this is mine

		f.make.disabled = false;

		f.plateborder.disabled = false;

		f.bottomtext.disabled = false;

		bottomText.style.color = "#000000";

	}

	if( ((view == "front") && (f.front.value == "4x4" || f.front.value == "4x4_11x8")) || ((view == "rear") && (f.rear.value == "4x4" || f.rear.value == "motorcycle" || f.rear.value == "motorcycle_8x6" || f.rear.value == "motorcycle_7x5" || f.rear.value == "motorcycle_6x4")) ){

		type = "4x4_";

		//position for 4x4 plates

		plateTable.width = "270px";

		plateTable.height = "200px";

		innerPlateTable.width = "250px";

		innerPlateTable.height = "180px";

		//test for logo or none...

		if(sidelogo != "none"){

			// reg text...

			registration.style.width="215px";

			registration.style.height="120px";

			registration.style.marginLeft = "35px";

			// bottom text ...

			bottomLogo.style.marginLeft = "35px";

		} else {

			// reg text...

			registration.style.width="240px";

			registration.style.height="120px";

			registration.style.marginLeft = "0px";

			// bottom text ...

			bottomLogo.style.marginLeft = "0px";

		}

	} else {

		//position for normal size plates.

		type = "";

		plateTable.width = "470px";

		plateTable.height = "120px";

		innerPlateTable.width = "450px";

		innerPlateTable.height = "100px";

		if(sidelogo != "none"){

			// reg text...

			registration.style.width="405px";

			registration.style.height="60px";

			registration.style.marginLeft = "40px";

			// bottom text ...

			bottomLogo.style.marginLeft = "40px";

		} else {

			// reg text...

			registration.style.width="440px";

			registration.style.height="60px";

			registration.style.marginLeft = "0px";

			// bottom text ...

			bottomLogo.style.marginLeft = "0px";

		}

	}

	if(f.make.value != "none" && view != "old"){

		document.getElementById("blogo_image").src = "images/makes/" + view + "/" + f.make.value + ".gif";
		if(manlogoos)
		{
			document.getElementById("blogo_image2").src = "images/makes/" + view + "/" + f.make.value + ".gif";
			document.getElementById("mlogoprice").innerHTML = "&pound;2.00";
		}else{
			document.getElementById("blogo_image2").src = "images/makes/none.gif";
			document.getElementById("mlogoprice").innerHTML = "&pound;1.00";
		}

	} else {

		document.getElementById("blogo_image").src = "images/makes/none.gif";
		document.getElementById("blogo_image2").src = "images/makes/none.gif";
		document.getElementById("mlogoprice").innerHTML = "&pound;1.00";
	}

	plateTable.background = "images/"+view+"/" + type + sidelogo + plateborder + ".gif";

	printReg();

	printBottom();

	calculateCost();

}



function calculateCost(){

	cost = 0;

	f = document.platedesigner;

	order = f.order.value;

	type = f.type.value;

	if(order == "set"){

		cost = 22.99;

		if(type == "old"){

		cost = 34.99;

		}

	}

	else{

		cost = 14.99;

		if(type == "old"){

		cost = 21.99;

		}

	}

	if(f.bottomtext.value != ""){cost += 1.0;}

	if(f.type.value == "show"){
	
		if(f.sidelogo.value != "none"){cost += 3.0;}
	
	}
	
	if(f.type.value == "standard"){
	
		if(f.sidelogo2.value != "none"){cost += 3.0;}
	
	}

	if(f.make.value != "none"){
		cost += 1;
		if(f.manlogoos.checked){cost += 1;}
	}

	if(f.plateborder.value != ""){cost += 1;}

	if(f.bolts.checked){cost += 2.0;}

	if(f.screws.checked){cost += 2.0;}

	if(f.tape.checked){cost += 1;}

	if(f.font.selectedIndex>1)
	{
		cost += 2;
		showPlateExt(1);
	}else{
		showPlateExt(0);
	}
	
	if(f.font2.selectedIndex>1){cost += 2;}
	
	f.cost.value = cost.toPrecision(4);

	if (order == "front"){

		f.rear.disabled = true;

		f.front.disabled = false;

		f.view.options[0].selected = true;

		f.view.disabled = true;

	}

	else if (order == "rear"){

		f.front.disabled = true;

		f.rear.disabled = false;

		f.view.options[1].selected = true;

		f.view.disabled = true;

	}

	else {

		f.front.disabled = false;

		f.rear.disabled = false;

		f.view.disabled = false;

	}



}

		