﻿	function change_subtype(chosen_fence) {
		fence = (ddlFenceType[ddlFenceType.selectedIndex].value);
		document.form.ddlFenceSubType.options.length = 1
		document.form.height.options.length = 1
		document.form.style.options.length = 1
		document.preview.src = "images/preview.jpg"
		if (fence == "Cedar"){
			document.form.ddlFenceSubType.options[1] = new Option("Picket")
			document.form.ddlFenceSubType.options[2] = new Option("Semi Private")
			document.form.ddlFenceSubType.options[3] = new Option("Privacy")
		}	
		if (fence == "Vinyl"){
			document.form.ddlFenceSubType.options[1] = new Option("Picket")
			document.form.ddlFenceSubType.options[2] = new Option("Semi Private")
			document.form.ddlFenceSubType.options[3] = new Option("Privacy")
		}	
		if (fence == "Ornamental"){
			document.form.ddlFenceSubType.options[1] = new Option("Steel")
			document.form.ddlFenceSubType.options[2] = new Option("Aluminum")
		}	
		if (fence == "Chain Link"){
			document.form.ddlFenceSubType.options[1] = new Option("Vinyl Coated")
			document.form.ddlFenceSubType.options[2] = new Option("Galvanized")
		}	
		if (fence == "Split Rail"){
			document.form.ddlFenceSubType.options[1] = new Option("N/A - Select Here")
		}	
		if (fence == "Welded Wire"){
			document.form.ddlFenceSubType.options[1] = new Option("N/A - Select Here")
		}	
		if (fence == "Hemlock Board"){
			document.form.ddlFenceSubType.options[1] = new Option("N/A - Select Here")
		}	
	}
	
	function change_height(chosen_subtype) {
		subtype = ddlFenceSubType.selectedIndex
		document.form.height.options.length = 1
		document.form.style.options.length = 1
		document.preview.src = "images/preview.jpg"
		if (fence == "Cedar"){
			if (subtype == 1){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("4 ft")
				document.form.height.options[3] = new Option("5 ft")
				document.form.height.options[4] = new Option("6 ft")
				document.form.height.options[5] = new Option("8 ft")
			}
			if (subtype == 2){
				document.form.height.options[1] = new Option("4 ft")
				document.form.height.options[2] = new Option("5 ft")
				document.form.height.options[3] = new Option("6 ft")
				document.form.height.options[4] = new Option("8 ft")
			}
			if (subtype == 3){
				document.form.height.options[1] = new Option("4 ft")
				document.form.height.options[2] = new Option("5 ft")
				document.form.height.options[3] = new Option("6 ft")
				document.form.height.options[4] = new Option("8 ft")
			}
		}	
		if (fence == "Vinyl"){
			if (subtype == 1){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("4 ft")
				document.form.height.options[3] = new Option("5 ft")
				document.form.height.options[4] = new Option("6 ft")
			}
			if (subtype == 2){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("4 ft")
				document.form.height.options[3] = new Option("5 ft")
				document.form.height.options[4] = new Option("6 ft")
			}
			if (subtype == 3){
				document.form.height.options[1] = new Option("4 ft")
				document.form.height.options[2] = new Option("5 ft")
				document.form.height.options[3] = new Option("6 ft")
				document.form.height.options[4] = new Option("7 ft")
				document.form.height.options[5] = new Option("8 ft")
			}
		}	
		if (fence == "Ornamental"){
			if (subtype == 1){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("3.5 ft")
				document.form.height.options[3] = new Option("4 ft")
				document.form.height.options[4] = new Option("4.5 ft")
				document.form.height.options[5] = new Option("5 ft")
				document.form.height.options[6] = new Option("6 ft")
				document.form.height.options[7] = new Option("7 ft")
				document.form.height.options[8] = new Option("8 ft")
			}
			if (subtype == 2){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("3.5 ft")
				document.form.height.options[3] = new Option("4 ft")
				document.form.height.options[4] = new Option("4.5 ft")
				document.form.height.options[5] = new Option("5 ft")
				document.form.height.options[6] = new Option("6 ft")
				document.form.height.options[7] = new Option("7 ft")
				document.form.height.options[8] = new Option("8 ft")
			}
		}	
		if (fence == "Chain Link"){
			if (subtype == 1){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("4 ft")
				document.form.height.options[3] = new Option("5 ft")
				document.form.height.options[4] = new Option("6 ft")
				document.form.height.options[5] = new Option("8 ft")
			}
			if (subtype == 2){
				document.form.height.options[1] = new Option("3 ft")
				document.form.height.options[2] = new Option("4 ft")
				document.form.height.options[3] = new Option("5 ft")
				document.form.height.options[4] = new Option("6 ft")
				document.form.height.options[5] = new Option("8 ft")
			}
		}	
		if (fence == "Split Rail"){
			document.form.height.options[1] = new Option("3 ft")
			document.form.height.options[2] = new Option("4 ft")
			document.form.height.options[3] = new Option("5 ft")
		}	
		if (fence == "Welded Wire"){
			document.form.height.options[1] = new Option("3 ft")
			document.form.height.options[2] = new Option("4 ft")
			document.form.height.options[3] = new Option("5 ft")
			document.form.height.options[4] = new Option("6 ft")
		}	
		if (fence == "Hemlock Board"){
			document.form.height.options[1] = new Option("3 ft")
			document.form.height.options[2] = new Option("4 ft")
			document.form.height.options[3] = new Option("5 ft")
		}	
		
	}
	
	function change_style(chosen_height) {
		height = chosen_height.selectedIndex
		document.form.style.options.length = 1
		document.preview.src = "images/preview.jpg"
		if (fence == "Cedar"){
			if (subtype == 1){
				document.form.style.options[1] = new Option("Spaced Board")
				document.form.style.options[2] = new Option("Spaced Picket")
			}
			if (subtype == 2){
				document.form.style.options[1] = new Option("Encased Spaced Board")
				document.form.style.options[2] = new Option("Shadowbox")
			}
			if (subtype == 3){
				document.form.style.options[1] = new Option("Solid Picket")
				document.form.style.options[2] = new Option("Solid Board")
				document.form.style.options[3] = new Option("Solid Picket w/ Lattice Topper")
				document.form.style.options[4] = new Option("Solid Picket w/ Balust")
				document.form.style.options[5] = new Option("Solid Board w/ Lattice Topper")
				document.form.style.options[6] = new Option("Solid Board w/ Balust")
			}
		}	
		if (fence == "Vinyl"){
			if (subtype == 1){
				document.form.style.options[1] = new Option("Baron")
				document.form.style.options[2] = new Option("Countess")
				document.form.style.options[3] = new Option("Monarch")
				document.form.style.options[4] = new Option("Princeton")
				document.form.style.options[5] = new Option("Victorian")
				if (height == 1){
					document.form.style.options[6] = new Option("Cape Cod")
					document.form.style.options[7] = new Option("Yorkshire")
					document.form.style.options[8] = new Option("Charleston")
					document.form.style.options[9] = new Option("Canterbury")
					document.form.style.options[10] = new Option("Manchester")
				}
				if (height == 2){
					document.form.style.options[6] = new Option("Cape Cod")
					document.form.style.options[7] = new Option("Yorkshire")
					document.form.style.options[8] = new Option("Charleston")
					document.form.style.options[9] = new Option("Canterbury")
					document.form.style.options[10] = new Option("Manchester")
					document.form.style.options[11] = new Option("Providence")
					document.form.style.options[12] = new Option("Danbury")
					document.form.style.options[13] = new Option("Rothbury")
					document.form.style.options[14] = new Option("New Castle")
				}
				if (height == 3){
					document.form.style.options[6] = new Option("Cape Cod")
					document.form.style.options[7] = new Option("New Castle")
					document.form.style.options[8] = new Option("Normandy")
				}
				if (height == 4){
					document.form.style.options[6] = new Option("New Castle")
					document.form.style.options[7] = new Option("Normandy")
				}
			}
			if (subtype == 2){
				document.form.style.options[1] = new Option("Imperial")
				if (height == 3){
				document.form.style.options[2] = new Option("Columbia")
				document.form.style.options[3] = new Option("Millbrook")
				}
				if (height == 4){
				document.form.style.options[2] = new Option("Columbia")
				document.form.style.options[3] = new Option("Millbrook")
				}
			}
			if (subtype == 3){
				if (height == 1){
				document.form.style.options[1] = new Option("Chesterfield")
				}
				if (height == 2){
				document.form.style.options[1] = new Option("Chesterfield")
				document.form.style.options[2] = new Option("Norfolk")
				}
				if (height == 3){
				document.form.style.options[1] = new Option("Chesterfield")
				document.form.style.options[2] = new Option("Norfolk")
				document.form.style.options[3] = new Option("Huntington")
				document.form.style.options[4] = new Option("Lexington")
				document.form.style.options[5] = new Option("Westminster")
				}
				if (height == 4){
				document.form.style.options[1] = new Option("Galveston")
				}
				if (height == 5){
				document.form.style.options[1] = new Option("Galveston")
				}
			}
		}	
		if (fence == "Ornamental"){
			if (subtype == 1){
				document.form.style.options[1] = new Option("2 Rail Crimp Top")
				document.form.style.options[2] = new Option("2 Rail Flat Top")
				document.form.style.options[3] = new Option("2 Rail Smooth Top")
				document.form.style.options[4] = new Option("3 Rail Crimp Top")
				document.form.style.options[5] = new Option("3 Rail Flat Top")
				document.form.style.options[6] = new Option("3 Rail Smooth Top")
				document.form.style.options[7] = new Option("Pool Fence")
			}
			if (subtype == 2){
				document.form.style.options[1] = new Option("Bennington")
				document.form.style.options[2] = new Option("Berkshire")
				document.form.style.options[3] = new Option("Essex")
				document.form.style.options[4] = new Option("Saybrook")
				document.form.style.options[5] = new Option("Newport")
				document.form.style.options[6] = new Option("Citadel")
				document.form.style.options[7] = new Option("Horizon")
				document.form.style.options[8] = new Option("Falcon")
				document.form.style.options[9] = new Option("Storrs")
				document.form.style.options[10] = new Option("Derby")
			}
		}	
		if (fence == "Chain Link"){
			if (subtype == 1){
				document.form.style.options[1] = new Option("9 Gauge Green")
				document.form.style.options[2] = new Option("9 Gauge Black")
			}
			if (subtype == 2){
				document.form.style.options[1] = new Option("9 Gauge")
				document.form.style.options[2] = new Option("11.5 Gauge")
			}
		}	
		if (fence == "Split Rail"){
			if (height == 1){
				document.form.style.options[1] = new Option("2 Rail Split Rail")
				document.form.style.options[2] = new Option("2 Rail Split Rail w/ Welded Wire")
				document.form.style.options[3] = new Option("2 Rail Round Rail")
			}
			if (height == 2){
				document.form.style.options[1] = new Option("3 Rail Split Rail")
				document.form.style.options[2] = new Option("3 Rail Split Rail w/ Welded Wire")
				document.form.style.options[3] = new Option("3 Rail Round Rail")
			}
			if (height == 3){
				document.form.style.options[1] = new Option("4 Rail Split Rail")
				document.form.style.options[2] = new Option("4 Rail Split Rail w/ Welded Wire")
			}
		}	
		if (fence == "Welded Wire"){
			document.form.style.options[1] = new Option("Galvanized")
			document.form.style.options[2] = new Option("Vinyl Coated - Black")
			document.form.style.options[3] = new Option("Vinyl Coated - Green")
		}	
		if (fence == "Hemlock Board"){
			document.form.style.options[1] = new Option("2 Rail")
			document.form.style.options[2] = new Option("3 Rail")
			document.form.style.options[3] = new Option("4 Rail")
		}	
		
	}
	
	function change_image(chosen_style) {
		style = chosen_style.selectedIndex
		document.preview.src = "images/preview.jpg"
		if (fence == "Cedar"){
			if (subtype == 1){
				if (style == 1){
					document.preview.src = "images/cedar_sp_picket_board.jpg"
				}
				if (style == 2){	
					document.preview.src = "images/cedar_sp_picket.jpg"
				}
			}
			if (subtype == 2){
				if (style == 1){
					document.preview.src = "images/cedar_sempriv_encased.jpg"
				}
				if (style == 2){
					document.preview.src = "images/cedar_sempriv_shadow.jpg"
				}
			}
			if (subtype == 3){
				if (style == 1){
					document.preview.src = "images/cedar_priv_pick.jpg"
				}
				if (style == 2){
					document.preview.src = "images/cedar_priv_board.jpg"
				}
				if (style == 3){
					document.preview.src = "images/cedar_priv_pick_lattice.jpg"
				}
				if (style == 4){
					document.preview.src = "images/cedar_priv_pick_balust.jpg"
				}
				if (style == 5){
					document.preview.src = "images/cedar_priv_lattice.jpg"
				}
				if (style == 6){
					document.preview.src = "images/cedar_priv_balust.jpg"
				}
			}
		}	
		if (fence == "Vinyl"){
			if (subtype == 1){
				if (style == 1){
					document.preview.src = "images/pvc_baron.jpg"
				}
				if (style == 2){
					document.preview.src = "images/pvc_countess.jpg"
				}
				if (style == 3){
					document.preview.src = "images/pvc_monarch.jpg"
				}
				if (style == 4){
					document.preview.src = "images/pvc_princeton.jpg"
				}
				if (style == 5){
					document.preview.src = "images/pvc_victorian.jpg"
				}
				if (height == 1){
					if (style == 6){
						document.preview.src = "images/pvc_capecod.jpg"
					}
					if (style == 7){
						document.preview.src = "images/pvc_yorkshire.jpg"
					}
					if (style == 8){
						document.preview.src = "images/pvc_charleston.jpg"
					}
					if (style == 9){
						document.preview.src = "images/pvc_canterbury.jpg"
					}
					if (style == 10){
						document.preview.src = "images/pvc_manchester.jpg"
					}
				}
				if (height == 2){
					if (style == 6){
						document.preview.src = "images/pvc_capecod.jpg"
					}
					if (style == 7){
						document.preview.src = "images/pvc_yorkshire.jpg"
					}
					if (style == 8){
						document.preview.src = "images/pvc_charleston.jpg"
					}
					if (style == 9){
						document.preview.src = "images/pvc_canterbury.jpg"
					}
					if (style == 10){
						document.preview.src = "images/pvc_manchester.jpg"
					}
					if (style == 11){
						document.preview.src = "images/pvc_providence.jpg"
					}
					if (style == 12){
						document.preview.src = "images/pvc_danbury.jpg"
					}
					if (style == 13){
						document.preview.src = "images/pvc_rothbury.jpg"
					}
					if (style == 14){
						document.preview.src = "images/pvc_newcastle.jpg"
					}
				}
				if (height == 3){
					if (style == 6){
						document.preview.src = "images/pvc_capecod.jpg"
					}
					if (style == 7){
						document.preview.src = "images/pvc_newcastle.jpg"
					}
					if (style == 8){
						document.preview.src = "images/pvc_normandy.jpg"
					}
				}
				if (height == 4){
					if (style == 6){
						document.preview.src = "images/pvc_newcastle.jpg"
					}
					if (style == 7){
						document.preview.src = "images/pvc_normandy.jpg"
					}
				}
			}
			if (subtype == 2){
					if (style == 1){
						document.preview.src = "images/pvc_imperial.jpg"
					}
				if (height == 3){
					if (style == 2){
						document.preview.src = "images/pvc_columbia.jpg"
					}
					if (style == 3){
						document.preview.src = "images/pvc_millbrook.jpg"
					}
				}
				if (height == 4){
					if (style == 2){
						document.preview.src = "images/pvc_columbia.jpg"
					}
					if (style == 3){
						document.preview.src = "images/pvc_millbrook.jpg"
					}
				}
			}
			if (subtype == 3){
				if (height == 1){
					if (style == 1){
						document.preview.src = "images/pvc_chesterfield.jpg"
					}
				}
				if (height == 2){
					if (style == 1){
						document.preview.src = "images/pvc_chesterfield.jpg"
					}
					if (style == 2){
						document.preview.src = "images/pvc_norfolk.jpg"
					}
				}
				if (height == 3){
					if (style == 1){
						document.preview.src = "images/pvc_chesterfield.jpg"
					}
					if (style == 2){
						document.preview.src = "images/pvc_norfolk.jpg"
					}
					if (style == 3){
						document.preview.src = "images/pvc_huntington.jpg"
					}
					if (style == 4){
						document.preview.src = "images/pvc_lexington.jpg"
					}
					if (style == 5){
						document.preview.src = "images/pvc_westminster.jpg"
					}
				}
				if (height == 4){
					if (style == 1){
						document.preview.src = "images/pvc_galveston.jpg"
					}
				}
				if (height == 5){
					if (style == 1){
						document.preview.src = "images/pvc_galveston.jpg"
					}
				}
			}
		}	
		if (fence == "Ornamental"){
			if (subtype == 1){
				if (style == 1){
						document.preview.src = "images/ornimental_steel_2_rail_crimp_top.gif"
				}
				if (style == 2){
						document.preview.src = "images/ornimental_steel_2_rail_flat_top.gif"
				}
				if (style == 3){
						document.preview.src = "images/ornimental_steel_2_rail_smooth_top.gif"
				}
				if (style == 4){
						document.preview.src = "images/ornimental_steel_3_rail_crimp_top.gif"
				}
				if (style == 5){
						document.preview.src = "images/ornimental_steel_3_rail_flat_top.gif"
				}
				if (style == 6){
						document.preview.src = "images/ornimental_steel_3_rail_smooth_top.gif"
				}
				if (style == 7){
						document.preview.src = "images/ornimental_steel_pool_fence.gif"
				}
			}
			if (subtype == 2){
				if (style == 1){
						document.preview.src = "images/ornimental_aluminum_Bennington.jpg"
				}
				if (style == 2){
						document.preview.src = "images/ornimental_aluminum_Berkshire.jpg"
				}
				if (style == 3){
						document.preview.src = "images/ornimental_aluminum_Essex.jpg"
				}
				if (style == 4){
						document.preview.src = "images/ornimental_aluminum_Saybrooke.jpg"
				}
				if (style == 5){
						document.preview.src = "images/ornimental_aluminum_Newport.jpg"
				}
				if (style == 6){
						document.preview.src = "images/ornimental_aluminum_Citadel.jpg"
				}
				if (style == 7){
						document.preview.src = "images/ornimental_aluminum_Horizon.jpg"
				}
				if (style == 8){
						document.preview.src = "images/ornimental_aluminum_Falcon.jpg"
				}
				if (style == 9){
						document.preview.src = "images/ornimental_aluminum_Storrs.jpg"
				}
				if (style == 10){
						document.preview.src = "images/ornimental_aluminum_Derby.jpg"
				}
			}
		}
	}
