function display_seating(init) {
	var start = init.innerHTML;
	var e = $('seating');
	
	if(start == "2-3") {
		var one = '<option value="2-3" selected="selected">2-3</option>';
	} else {
		var one = '<option value="2-3">2-3</option>';
	}	
	
	if(start == "4-5") {
		var two = '<option value="4-5" selected="selected">4-5</option>';
	} else {
		var two = '<option value="4-5">4-5</option>';
	}	
	
	if(start == "6-7") {
		var three = '<option value="6-7" selected="selected">6-7</option>';
	} else {
		var three = '<option value="6-7">6-7</option>';
	}	
	
	e.innerHTML = '<select name="how_many" id="how_many" class="refineDropDowns" onChange="select_seating(this.value);">' + one + two + three + '</select>';
	/*new Effect.Highlight(e);*/
}

function select_seating(num) {	
	var e = $('seating');	
	e.innerHTML = num;	
	update_results();
}



function display_lounge(init) {	
	var start = init.innerHTML;
	var e = $('lounge_seating');
	
	if(start == "Yes") {
		var one = '<option value="Yes" selected="selected">Yes</option>';
	} else {
		var one = '<option value="Yes">Yes</option>';
	}	
	
	if(start == "No") {
		var two = '<option value="No" selected="selected">No</option>';
	} else {
		var two = '<option value="No">No</option>';
	}	
	
	e.innerHTML = '<select name="lounge" id="lounge" class="refineDropDowns" onChange="select_lounge(this.value);">' + one + two + '</select>';
	/*new Effect.Highlight(e);*/
}

function select_lounge(seats) {
	var e = $('lounge_seating');
	e.innerHTML = seats;		
	update_results();
}

function display_reason(init) {
	var start = init.innerHTML;
	var e = $('reason_for_buying');
	
	if(start == "Health") {
		var one = '<option value="Health" selected="selected">Health-related</option>';
	} else {
		var one = '<option value="Health">Health-related</option>';
	}	
	
	if(start == "Lifestyle") {
		var two = '<option value="Lifestyle" selected="selected">Lifestyle</option>';
	} else {
		var two = '<option value="Lifestyle">Lifestyle</option>';
	}	
	
	if(start == "Investment") {
		var three = '<option value="Investment" selected="selected">Investment</option>';
	} else {
		var three = '<option value="Investment">Investment</option>';
	}	
	
	if(start == "Mixed") {
		var four = '<option value="Mixed" selected="selected">Mixed</option>';
	} else {
		var four = '<option value="Mixed">Mixed</option>';
	}	
	
	e.innerHTML = '<select name="reason" id="reason" class="refineDropDowns" onChange="select_reason(this.value);">' + one + two + three + four + '</select>';
	/*new Effect.Highlight(e);*/
}

function select_reason(reason) {
	var e = $('reason_for_buying');	
	e.innerHTML = reason;	
	update_results();
}

function display_location(init) {	
	var start = init.innerHTML;
	var e = $('location');
	
	if(start == "Deck") {
		var one = '<option value="Deck" selected="selected">Deck/Gazebo</option>';
	} else {
		var one = '<option value="Deck">Deck/Gazebo</option>';
	}	
	
	if(start == "Garden") {
		var two = '<option value="Garden" selected="selected">Garden</option>';
	} else {
		var two = '<option value="Garden">Garden</option>';
	}	
	
	if(start == "Cement") {
		var three = '<option value="Cement" selected="selected">Cement-Pad</option>';
	} else {
		var three = '<option value="Cement">Cement-Pad</option>';
	}	
	
	if(start == "In-Ground") {
		var four = '<option value="In-Ground" selected="selected">In-Ground</option>';
	} else {
		var four = '<option value="In-Ground">In-Ground</option>';
	}	
	
	e.innerHTML = '<select name="where" id="spa_location" class="refineDropDowns" onChange="select_location(this.value);">' + one + two + three + four + '</select>';
	/*new Effect.Highlight(e);*/
}

function select_location(location) {
	var e = $('location');	
	e.innerHTML = location;	
	update_results();
}

function display_stereo(init) {	
	var start = init.innerHTML;	
	var e = $('stereo');
	
	if(start == "Stereo") {
		var one = '<option value="Stereo" selected="selected">Stereo</option>';
	} else {
		var one = '<option value="Stereo">Stereo</option>';
	}	
	
	if(start == "Stereo &amp; MP3") {
		var two = '<option value="Stereo & MP3" selected="selected">Stereo & MP3</option>';
	} else {
		var two = '<option value="Stereo & MP3">Stereo & MP3</option>';
	}	
	
	if(start == "Stereo &amp; iPod") {
		var three = '<option value="Stereo & iPod" selected="selected">Stereo & iPod</option>';
	} else {
		var three = '<option value="Stereo & iPod">Stereo & iPod</option>';
	}	
	
	if(start == "Not Important") {
		var four = '<option value="Not Important" selected="selected">Not Important</option>';
	} else {
		var four = '<option value="Not Important">Not Important</option>';
	}	
	
	e.innerHTML = '<select name="where" id="audio" class="refineDropDowns" onChange="select_stereo(this.value);">' + one + two + three + four + '</select>';
	/*new Effect.Highlight(e);*/
}

function select_stereo(stereo) {
	var e = $('stereo');	
	e.innerHTML = stereo;	
	update_results();
}

function display_pricing_answer(init) {	
	var start = init.innerHTML;
	var e = $('pricing_answer');
	
	if(start == "Value") {
		var one = '<option value="Value" selected="selected">Value</option>';
	} else {
		var one = '<option value="Value">Value</option>';
	}	
	
	if(start == "Mid-Range") {
		var two = '<option value="Mid-Range" selected="selected">Mid-Range</option>';
	} else {
		var two = '<option value="Mid-Range">Mid-Range</option>';
	}	
	
	if(start == "Luxury") {
		var three = '<option value="Luxury" selected="selected">Luxury</select>';
	} else {
		var three = '<option value="Luxury">Luxury</select>';
	}	
	
	e.innerHTML = '<select name="pricing" id="audio" class="refineDropDowns" onChange="select_pricing_answer(this.value);">' + one + two + three + '</select>';
	/*new Effect.Highlight(e);*/
}

function select_pricing_answer(pricing_answer) {
	var e = $('pricing_answer');
	var fe = $('form_pricing');
	e.innerHTML = pricing_answer;	
	fe.value = pricing_answer;	
	update_results();
}

function update_results() {
	var lounge = $('lounge_seating');
	var seating = $('seating');	
	var reason = $('reason_for_buying');
	var location = $('location');	
	var stereo = $('stereo');
	var pricing_answer = $('pricing_answer');
	
	var url = 'dreamspa-backend.php';
    var pars = 'lounge='+escape(lounge.innerHTML)+'&how_many='+escape(seating.innerHTML)+'&reason='+escape(reason.innerHTML)+'&where='+escape(location.innerHTML)+'&audio='+escape(stereo.innerHTML)+'&pricing='+escape(pricing_answer.innerHTML);
    var target = 'results';
    var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});
}

function spa_details(name) {
	var url = 'dreamspa-details.php';
    var pars = 'spa_name='+escape(name);
    var target = 'results';
    var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});	
}

function requestInfo() {
	var e = $('spa_name');
	
	var url = 'info-jacuzzi.php';
    var pars = 'info='+escape(e.innerHTML);
    var target = 'results';
    var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});
}

function step3() {
	/*var e = $('step3link');
	var p = $('form_pricing');
	var e.innerHTML = "x";*/
	/*var e = $('form_tag');
	e.innerHTML = '<form name="results" id="results" action="step03.php" method="post">';
	document.results.submit();*/
}

function showTips(image) {
	switch(image) {
		case "s_contemporary":
			new Tip('s_contemporary', '<img alt="hot tub cabinet color sample contemporary" src="../images/cabinet_colors/sundance/contemporary_lrg.gif">', { 					
			fixed: true,
			title: 'Contemporary',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_terrastone":
			new Tip('s_terrastone', '<img alt="hot tub cabinet color sample terrastone" src="../images/cabinet_colors/sundance/terrastone_lrg.gif">', { 					
			fixed: true,
			title: 'Terrastone',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_sierra":
			new Tip('s_sierra', '<img alt="hot tub cabinet color sample sierra" src="../images/cabinet_colors/sundance/sierra_lrg.gif">', { 					
			fixed: true,
			title: 'Sierra',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_mahogany":
			new Tip('s_mahogany', '<img alt="hot tub cabinet color sample mahogany" src="../images/cabinet_colors/sundance/mahogany_lrg.gif">', { 					
			fixed: true,
			title: 'Mahogany',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});			
		break;
		
		case "s_birchwood":
			new Tip('s_birchwood', '<img alt="hot tub cabinet color sample birchwood" src="../images/cabinet_colors/sundance/birchwood_lrg.gif">', { 					
			fixed: true,
			title: 'Birchwood',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_coastal":
			new Tip('s_coastal', '<img alt="hot tub cabinet color sample coastal" src="../images/cabinet_colors/sundance/coastal_lrg.gif">', { 					
			fixed: true,
			title: 'Coastal',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		
		
		case "s_bluegrass":
			new Tip('s_bluegrass', '<img alt="hot tub shell color sample bluegrass" src="../images/shell_colors/sundance/bluegrass_lrg.gif">', { 					
			fixed: true,
			title: 'Bluegrass',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_celestite":
			new Tip('s_celestite', '<img alt="hot tub shell color sample celestite" src="../images/shell_colors/sundance/celestite_lrg.gif">', { 					
			fixed: true,
			title: 'Celestite',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		
		case "s_copper_sand":
			new Tip('s_copper_sand', '<img alt="hot tub shell color sample copper sand" src="../images/shell_colors/sundance/copper_sand_lrg.gif">', { 					
			fixed: true,
			title: 'Copper Sand',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_graphite":
			new Tip('s_graphite', '<img alt="hot tub shell color sample graphite" src="../images/shell_colors/sundance/graphite_lrg.gif">', { 					
			fixed: true,
			title: 'Graphite',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_oyster":
			new Tip('s_oyster', '<img alt="hot tub shell color sample oyster" src="../images/shell_colors/sundance/oyster_lrg.gif">', { 					
			fixed: true,
			title: 'Oyster',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_platinum":
			new Tip('s_platinum', '<img alt="hot tub shell color sample platinum" src="../images/shell_colors/sundance/platinum_lrg.gif">', { 					
			fixed: true,
			title: 'Platinum',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_sahara":
			new Tip('s_sahara', '<img alt="hot tub shell color sample sahara" src="../images/shell_colors/sundance/sahara_lrg.gif">', { 					
			fixed: true,
			title: 'Sahara',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_sand":
			new Tip('s_sand', '<img alt="hot tub shell color sample sand" src="../images/shell_colors/sundance/sand_lrg.gif">', { 					
			fixed: true,
			title: 'Sand',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "s_twilight":
			new Tip('s_twilight', '<img alt="hot tub shell color sample twilight" src="../images/shell_colors/sundance/twilight_lrg.gif">', { 					
			fixed: true,
			title: 'Twilight',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;		
		
		
		
		case "j_autumn_red":
			new Tip('j_autumn_red', '<img alt="hot tub cabinet color sample autumn red" src="../images/cabinet_colors/jacuzzi/autumn_red_lrg.gif">', { 					
			fixed: true,
			title: 'Autumn Red',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_harvest_wheat":
			new Tip('j_harvest_wheat', '<img alt="hot tub cabinet color sample harvest wheat" src="../images/cabinet_colors/jacuzzi/harvest_wheat_lrg.gif">', { 					
			fixed: true,
			title: 'Harvest Wheat',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_roasted_chestnut":
			new Tip('j_roasted_chestnut', '<img alt="hot tub cabinet color sample roasted chestnut" src="../images/cabinet_colors/jacuzzi/roasted_chestnut_lrg.gif">', { 					
			fixed: true,
			title: 'Roasted Chestnut',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_silverwood":
			new Tip('j_silverwood', '<img alt="hot tub cabinet color sample silverwood" src="../images/cabinet_colors/jacuzzi/silverwood_lrg.gif">', { 					
			fixed: true,
			title: 'Silverwood',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		case "j_tuscan_stone":
			new Tip('j_tuscan_stone', '<img alt="hot tub cabinet color sample tuscan stone" src="../images/cabinet_colors/jacuzzi/tuscan_stone_lrg.gif">', { 					
			fixed: true,
			title: 'Tuscan Stone',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		case "j_venetian_stone":
			new Tip('j_venetian_stone', '<img alt="hot tub cabinet color sample venetian stone" src="../images/cabinet_colors/jacuzzi/venetian_stone_lrg.gif">', { 					
			fixed: true,
			title: 'Venetian Stone',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		
		case "j_bluegrass":
			new Tip('j_bluegrass', '<img alt="hot tub shell color sample bluegrass" src="../images/shell_colors/jacuzzi/bluegrass_lrg.gif">', { 					
			fixed: true,
			title: 'Bluegrass',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_cobalt":
			new Tip('j_cobalt', '<img alt="hot tub shell color sample cobalt" src="../images/shell_colors/jacuzzi/cobalt_lrg.gif">', { 					
			fixed: true,
			title: 'Cobalt',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_desert_sand":
			new Tip('j_desert_sand', '<img alt="hot tub shell color sample desert_sand" src="../images/shell_colors/jacuzzi/desert_lrg.gif">', { 					
			fixed: true,
			title: 'Desert Sand',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_graphite":
			new Tip('j_graphite', '<img alt="hot tub shell color sample graphite" src="../images/shell_colors/jacuzzi/graphite_lrg.gif">', { 					
			fixed: true,
			title: 'Graphite',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_opal":
			new Tip('j_opal', '<img alt="hot tub shell color sample opal" src="../images/shell_colors/jacuzzi/opal_lrg.gif">', { 					
			fixed: true,
			title: 'Opal',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_platinum":
			new Tip('j_platinum', '<img alt="hot tub shell color sample platinum" src="../images/shell_colors/jacuzzi/platinum_lrg.gif">', { 					
			fixed: true,
			title: 'Platinum',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_sahara":
			new Tip('j_sahara', '<img alt="hot tub shell color sample sahara" src="../images/shell_colors/jacuzzi/sahara_lrg.gif">', { 					
			fixed: true,
			title: 'Sahara',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_sand":
			new Tip('j_sand', '<img alt="hot tub shell color sample sand" src="../images/shell_colors/jacuzzi/sand_lrg.gif">', { 					
			fixed: true,
			title: 'Sand',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
		
		case "j_silver_pearl":
			new Tip('j_silver_pearl', '<img alt="hot tub shell color sample silver pearl" src="../images/shell_colors/jacuzzi/silver_pearl_lrg.gif">', { 					
			fixed: true,
			title: 'Silver Pearl',
	 	 	offset: { x: 30, y: -112 },			
			effect: 'appear'			
		});		
		break;
	}	
}

function galleryPops(image, alt) {
	new Tip('gallery_hook', '<a href="javascript:void(0);" class="close"><img src="../images/design_gallery/gallery_'+image+'_lrg.jpg" alt="'+alt+'"></a>', { 										
			fixed: true,
			showOn: 'click',
			hideOn: { element: '.close', event: 'click'},
			closeButton: true,					
			offset: { x:-251, y:-298 },
			className: 'largePops',
			effect: 'appear'
	});		
}

function checkEmail() {
	var e = $('email_text');		
	var q = $('quick_email');
	var f = $('email_form');
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(q.value)){
		var url = 'includes/left-nav-email-send.php';
		var pars = 'quick_email='+escape(q.value);
		var target = 'email_text';
		var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars});
		f.style.display = "none";
		} else {
		e.innerHTML = "Please enter a valid email address.";			
	}
	
	//new Effect.Highlight(e);
}

function showContactForm(brochure) {	
	Lightview.show({ href: brochure, rel: 'ajax', title: 'Please fill out the form below to receive your free full-color brochure. *Indicates required fields.', options: { width: 460, height: 660 }});
}

function checkContactForm(id) {
	var valid = new Validation(id, {onSubmit:false}); // OR new Validation(document.forms[0]);
	var result = valid.validate();	
	if(result == true) {				
		if(id == "request_brochure") {
			var choice = $$('input:checked[type="radio"][name="brochure_type"]').pluck('value');
			if(choice == "jacuzzi") {
				submitContactForm(id, 1);
			} else if (choice == "sundance") {
				submitContactForm(id, 2);
			} else {
				submitContactForm(id, 1);									
				submitContactForm(id, 2);	
			}									
		} else {
			submitContactForm(id);									
		}
	}
}

function submitContactForm(id, num) {		
	if(id == "info_jacuzzi") { var url="includes/techbarn_jacuzzi.php"; }	
	if(id == "info_sundance") { var url="includes/techbarn_sundance.php"; }
	
	if(id == "request_brochure") {
		if(num == 1) {
			var url="includes/techbarn_jacuzzi.php";
		} else {
			var url="includes/techbarn_sundance.php";
		}
	}
	
	var result = $('form_container');
	var code = "";			
	new Ajax.Request(url, 
	{ method: 'POST',
		parameters: $(id).serialize(true),	 
	    onLoading: function(loading) {
			//result.style = "text-align:center;";
			//result.innerHTML = '<br><br><br><br><img src="images/lightview/loading.gif">';
		},
		onSuccess: function(transport) {	
		 code = transport.responseText;			
			//alert(code);
			if(code == "200") {
				//alert("hey");
				result.innerHTML = "<br><br><br><br>Your information has been successfully submitted.  Close this window to return to the site.  Thank you!";	
			} else {
				result.innerHTML = "<br><br><br><br>The form system is currently undergoing maintenance and cannot process your request at this time.  Please try again later.";	
			}
		}
	});		
}

function showEmailPopUp() {
	Lightview.show({ href: '/includes/emailPopUp.php', rel: 'ajax', title: 'Join Our Email List', options: { width: 300, height: 170 }});
}