function Personalize() {

	var person1 = eval("document.getElementById('line1')");
		//the div holding the first line over the image

	var person2 = eval("document.getElementById('line2')");
		//the div holding the second line over the image

	var person3 = eval("document.getElementById('line3')");
		//the div holding the third line over the image (if any)

	var person1dp = eval("document.getElementById('line1dp')");
		//the div holding the first line over the image

	var person2dp = eval("document.getElementById('line2dp')");
		//the div holding the second line over the image

	var line2;
		//the second input box over the image

	var line3;
		//the third input box over the image

	var textLine1 = eval("document.getElementById('txtLine1')");
		//the Line one textbox for user input

	var textLine2 = eval("document.getElementById('txtLine2')");
		//the Line two textbox for user input

	var textLine3 = eval("document.getElementById('txtLine3')");
		//the Line three textbox for user input

	var formObj = eval("document.frmOrderInfo");
		//the form object

	switch(document.getElementById('txtType').value){
		case "Desk Plate":
			line2 = eval("document.getElementById('textBoxWood2')");
			if(textLine2.value == "")
			{
				formObj.txtPerson1.value = formObj.txtLine1.value;
					//give the value of the firstline textbox to the first textbox over the image

				formObj.txtPerson2.value = formObj.txtLine2.value;
					//give the value of the secondline textbox to the second textbox over the image

				person1dp.style.top = "15px";
					//positions the first div over the image to be in the center
		
			}
			else if(textLine1.value != "" && textLine2.value != ""){
				formObj.txtPerson1.value = formObj.txtLine1.value;
					//give the value of the secondline textbox to the second textbox over the image

				formObj.txtPerson2.value = formObj.txtLine2.value;
					//give the value of the secondline textbox to the second textbox over the image

				person1dp.style.top = "0px";
					//positions the first div over the image to be in the center

				person2dp.style.top = "60px";
					//positions the first div over the image to be in the center
			}
			else if(textLine1.value == "" && textLine2.value != ""){
				formObj.txtPerson1.value = formObj.txtLine1.value;
					//give the value of the secondline textbox to the second textbox over the image

				formObj.txtPerson2.value = formObj.txtLine2.value;
					//give the value of the secondline textbox to the second textbox over the image

				person1dp.style.top = "0px";
					//positions the first div over the image to be in the center

				person2dp.style.top = "60px";
					//positions the first div over the image to be in the center
			}
			
			break;

		case "Name Tags":
			formObj.txtPerson1.value = formObj.txtLine1.value;
					//give the value of the firstline textbox to the first textbox over the image

			formObj.txtPerson2.value = formObj.txtLine2.value;
					//give the value of the second line textbox to the second textbox over the image

			formObj.txtPerson3.value = formObj.txtLine3.value;
					//give the value of the second line textbox to the second textbox over the image

			break;

		case "Door Tags":
			formObj.txtPerson1.value = formObj.txtLine1.value;
					//give the value of the firstline textbox to the first textbox over the image

			formObj.txtPerson2.value = formObj.txtLine2.value;
					//give the value of the second line textbox to the second textbox over the image

			break;

		case "Door Schedule":
			formObj.txtRoom.value = formObj.txtRoomNumber.value;
					//give the value of the room number textbox to the room number textbox over the image
					
			formObj.txtPerson1.value = formObj.txtLine1.value;
					//give the value of the first line of the name tag textbox to the first line of the name tag textbox over the image
			
			formObj.txtPerson2.value = formObj.txtLine2.value;
					//give the value of the second line of the name tag textbox to the second line of the name tag textbox over the image
					
			break;

	}
}

function chngNamePlatePict(){
	var bgImage = eval("document.images['bgImg']");
	var cboColor = eval("document.frmOrderInfo.cboColorNamePlate");
	var line1 = eval("document.getElementById('textBoxGold1')");
	var line2 = eval("document.getElementById('textBoxGold2')");
	var line3 = eval("document.getElementById('textBoxGold3')");
	
	switch(cboColor.value)
	{
		default:
			alert(cboColor.value);
			bgImage.src = "images/gold_name_plate_w_logo.jpg";
			line1.style.color = "000000";
			line2.style.color = "000000";
			line3.style.color = "000000";
			break;
			
		case "gold":
			bgImage.src = "images/gold_name_plate_w_logo.jpg";
			line1.style.color = "000000";
			line2.style.color = "000000";
			line3.style.color = "000000";
			break;

		case "silver":
			bgImage.src = "images/silver_name_plate_w_logo.jpg";
			line1.style.color = "000000";
			line2.style.color = "000000";
			line3.style.color = "000000";
			break;

		case "white":
			bgImage.src = "images/white_name_plate_w_logo.jpg";
			line1.style.color = "000000";
			line2.style.color = "000000";
			line3.style.color = "000000";
			break;

		

	}
}

function changeDoorTagColor(){
	var bgImage = eval("document.images['bgImg']");
	var line1 = eval("document.getElementById('textBoxGold1dt')");
	var line2 = eval("document.getElementById('textBoxGold2dt')");
	
	switch(document.frmOrderInfo.cboColorDoorTags.value)
	{
		case "wood":
			bgImage.src = "images/med_door_plate.jpg";
			line1.style.color = "white";
			line2.style.color = "white";
			break;

		case "white":
			bgImage.src = "images/white_door_tag.gif";
			line1.style.color = "003399";
			line2.style.color = "003399";
			break;

		default:
			bgImage.src = "images/med_door_plate.jpg";
			line1.style.color = "white";
			line2.style.color = "white";
			break;

	}
	
}

function changeBuilding(bldg){
	var bgImage = eval("document.images['bgImg']");
	var smImage = eval("document.images['smImg']");
	var zoom = eval("document.getElementById('zoom')");
	var form = eval("document.frmOrderInfo");
	var cboBuilding = document.frmOrderInfo.cboBuilding;
	var building = cboBuilding.value;
	
	var colorSelect = eval("document.getElementById('colorSelect')");
	var curColorLabel = eval("document.getElementById('curColorLabel')");
	var cboColor = eval("document.getElementById('cboColor')");
	
	var cboTextColor = eval("document.getElementById('cboTextColor')");
	
	var line1 = eval("document.getElementById('textLine1ds')");
	var line2 = eval("document.getElementById('textLine2ds')");
	var roomDS = eval("document.getElementById('roomDS')");
	var roomNum = eval("document.getElementById('roomNum')");
	var roomInput = eval("document.getElementById('roomInput')");
	
	var personalize1 = eval("document.getElementById('txtLine1')");
	var personalize2 = eval("document.getElementById('txtLine2')");
	var personLine1 = eval("document.getElementById('personLine1')");
	var personLine2 = eval("document.getElementById('personLine2')");
		
	if(building == "mc"||building=="hart"||building=="snow"||building=="taylor")
	{
	/*alert("tan");*/
		bgImage.src = "images/tan_schedule.gif";
		smImage.style.visibility = "hidden";
		zoom.style.visibility = "hidden";
		line1.style.visibility = "hidden";
		line2.style.visibility = "hidden";
		roomDS.style.visibility = "visible";
		roomNum.style.visibility = "visible";
		roomInput.style.visibility = "visible";
		
		colorSelect.style.visibility = "hidden";
		curColorLabel.style.visibility = "hidden";
		cboColor.style.visibility = "hidden";
		cboTextColor.style.visibility = "hidden";
		
		personalize1.style.visibility = "hidden";
		personalize2.style.visibility = "hidden";
		personLine1.style.visibility = "hidden";
		personLine2.style.visibility = "hidden";
	}
	else if(building=="ricks"||building=="hinkley"||building=="benson"||building=="healthCenter"||building=="spori"||building=="library")
	{
	/*alert("black");*/
		bgImage.src = "images/door_plate.gif";
		smImage.style.visibility = "hidden";
		zoom.style.visibility = "hidden";
		line1.style.visibility = "hidden";
		line2.style.visibility = "hidden";
		roomDS.style.visibility = "visible";
		roomNum.style.visibility = "visible";
		roomInput.style.visibility = "visible";
		
		colorSelect.style.visibility = "hidden";
		curColorLabel.style.visibility = "hidden";
		cboColor.style.visibility = "hidden";
		cboTextColor.style.visibility = "hidden";
		
		personalize1.style.visibility = "hidden";
		personalize2.style.visibility = "hidden";
		personLine1.style.visibility = "hidden";
		personLine2.style.visibility = "hidden";
	}
	else if(building == "austin")
	{
	/*alert("tan or black");*/
		bgImage.src = "images/tan_schedule.gif";
		smImage.style.visibility = "hidden";
		zoom.style.visibility = "hidden";
		line1.style.visibility = "hidden";
		line2.style.visibility = "hidden";
		roomDS.style.visibility = "visible";
		roomNum.style.visibility = "visible";
		roomInput.style.visibility = "visible";
		
		colorSelect.style.visibility = "hidden";
		cboTextColor.style.visibility = "hidden";
		curColorLabel.style.visibility = "visible";
		cboColor.style.visibility = "visible";
		
		personalize1.style.visibility = "hidden";
		personalize2.style.visibility = "hidden";
		personLine1.style.visibility = "hidden";
		personLine2.style.visibility = "hidden";
	}
	else if(building == "kirkham"||building == "clarke"||building == "smith"||building == "romney"||building == "rigby"||building == "livestock")
	{
	/*alert("metal");*/
		bgImage.src = "images/door_schedule_blue.gif";
		smImage.src = "images/door_schedule_blue_cropped_white.gif";
		smImage.style.visibility = "visible";
		zoom.style.visibility = "visible";
		
		line1.style.visibility = "visible";
		line2.style.visibility = "visible";
		roomDS.style.visibility = "hidden";
		roomNum.style.visibility = "hidden";
		roomInput.style.visibility = "hidden";
		
		colorSelect.style.visibility = "visible";
		curColorLabel.style.visibility = "visible";
		cboColor.style.visibility = "visible";
		cboTextColor.style.visibility = "visible";
		
		personalize1.style.visibility = "visible";
		personalize2.style.visibility = "visible";
		personLine1.style.visibility = "visible";
		personLine2.style.visibility = "visible";
	}
	else if(building =="agScience")
	{
	/*alert("rust only");*/
		bgImage.src = "images/door_schedule_rust.gif";
		smImage.src = "images/door_schedule_rust_cropped_white.gif";
		smImage.style.visibility = "visible";
		zoom.style.visibility = "visible";
		
		line1.style.visibility = "visible";
		line2.style.visibility = "visible";
		roomDS.style.visibility = "hidden";
		roomNum.style.visibility = "hidden";
		roomInput.style.visibility = "hidden";
		
		colorSelect.style.visibility = "visible";
		curColorLabel.style.visibility = "hidden";
		cboColor.style.visibility = "hidden";
		cboTextColor.style.visibility = "visible";
		
		personalize1.style.visibility = "visible";
		personalize2.style.visibility = "visible";
		personLine1.style.visibility = "visible";
		personLine2.style.visibility = "visible";
	}
	else
	{
	/*alert("default");*/
		bgImage.src = "images/door_plate.gif";
		smImage.style.visibility = "hidden";
		zoom.style.visibility = "hidden";
		line1.style.visibility = "hidden";
		line2.style.visibility = "hidden";
		roomDS.style.visibility = "visible";
		roomNum.style.visibility = "visible";
		roomInput.style.visibility = "visible";
		
		colorSelect.style.visibility = "hidden";
		curColorLabel.style.visibility = "hidden";
		cboColor.style.visibility = "hidden";
		cboTextColor.style.visibility = "hidden";
		
		personalize1.style.visibility = "hidden";
		personalize2.style.visibility = "hidden";
		personLine1.style.visibility = "hidden";
		personLine2.style.visibility = "hidden";
	}
	
	var lists = new Array();

	lists['austin'] = new Array();
	lists['austin'][0] = new Array(
		'Tan',
		'Black');
	lists['austin'][1] = new Array(
		'tan',
		'black');
	
	lists['agScience']  = new Array();
	lists['agScience'][0]  = new Array('Rust');
	lists['agScience'][1]  = new Array('rust');
	
	lists['undefined'] = new Array();
	lists['undefined'][0] = new Array('Blue', 'Rust');
	lists['undefined'][1] = new Array('blue', 'rust');
	
	//Populate the list with the values in the appropriate array
	var list = lists[bldg.options[bldg.selectedIndex].value];
	if (list == undefined){list = lists['undefined'];}
	
	//Next empty the address list 
	deleteList(cboColor);
	
	//Then, populate the apartment list
	fillList(cboColor, list);
}

function changeColor(){
	var bgImage = eval("document.images['bgImg']");
	var smImage = eval("document.images['smImg']");
	var color = document.getElementById('cboColor').value;
	var line1 = eval("document.getElementById('textLine1ds')");
	var line2 = eval("document.getElementById('textLine2ds')");
	var roomNum = eval("document.getElementById('roomDS')");
	
	switch(color){
		case "blue":
			bgImage.src = "images/door_schedule_blue.gif";
			smImage.src = "images/door_schedule_blue_cropped_white.gif";
			break;
		case "rust":
			bgImage.src = "images/door_schedule_rust.gif";
			smImage.src = "images/door_schedule_rust_cropped_white.gif";
			break;
		case "tan":
			bgImage.src = "images/tan_schedule.gif";
			break;
		case "black":
			bgImage.src = "images/door_plate.gif";
			break;
	}
}

function changeText(color){
	var smImage = eval("document.images['smImg']");
	var cboColor = eval("document.getElementById('cboColor')");
	var form = eval("document.frmOrderInfo");
	var line1 = eval("document.getElementById('textLine1ds')");
	var line2 = eval("document.getElementById('textLine2ds')");
	var bg;
	
	switch(color.value){
		case "whiteBlack":
			line1.style.color = "black";
			line2.style.color = "black";
			bg="white";
			break;
			
		case "whiteBlue":
			line1.style.color = "003399";
			line2.style.color = "003399";
			bg="white";
			break;
			
		case "wood":
			line1.style.color = "white";
			line2.style.color = "white";
			bg="wood";
			break;
	}
	switch(cboColor.value){
		case "blue":
			smImage.src = "images/door_schedule_blue_cropped_" + bg + ".gif";
			break;
		case "rust":
			smImage.src = "images/door_schedule_rust_cropped_" + bg + ".gif";
			break;
	}
}

function loadAll()
{
	Personalize();
	changeBuilding(document.frmOrderInfo.cboBuilding);
	changeColor();
	changeText(eval("document.getElementById('cboTextColor')"));
	document.getElementById('textLine1ds').value = "";
	document.getElementById('textLine2ds').value = "";
}

function deleteList(lst){
  // Removes items in the listbox.  This clears the listbox so that it can be repopulated.
  while (lst.options.length) lst.options[0]=null;
}

function fillList(lst, opt){
  //opt[0] holds the text to be displayed
  //opt[1] holds the values of each option
  for( i = 0; i < opt[0].length; i++ ){

    //Creates a new option menu for the listbox
    //  from the array opt
    option = new Option( opt[0][i], opt[1][i] );
    
    // Adds the value to the end of the options
    lst.options[lst.length] = option;
  }
  // preselect option 0

  lst.selectedIndex=0;
}