	function SaveOpt()
	{
		setCookie("height", document.searchForm.option2.options[document.searchForm.option2.selectedIndex].value, 24 * 60 * 60);

		return 1;
	}

	function SelList(List, Value)
	{
		for(i = 0; i < List.options.length; i++){
			if(List.options[i].value == Value){
				List.selectedIndex = i;
				return;
			}
		}
		List.selectedIndex = 0;
	}

function checkForm(mode) {
	var v=parseFloat(document.searchForm.option4.value);
	if (mode != 'size') {
		if (!v) {
			alert('Input operating voltage.');
			return(false);
		} else if ((v<1) && (v>42)) {
			alert('Inputted voltage is out of range.');
			return(false);
		} else {
			document.searchForm.BTN_SIZE.value='';
			document.searchForm.BTN_ALL.value='GO';
			return(true);
		}
	} else if ((!document.searchForm.option1.options[document.searchForm.option1.selectedIndex].value)
				&& (!document.searchForm.option2.options[document.searchForm.option2.selectedIndex].value)
				&& (!document.searchForm.option3.options[document.searchForm.option3.selectedIndex].value))
	{
		if (mode == 'size') {
			alert('Input motor size.');
		} else {
			alert('Input/Select value.');
		}
		return(false);
	} else {
		document.searchForm.BTN_SIZE.value='GO';
		document.searchForm.BTN_ALL.value='';
		return(true);
	}
}

function checkVoltage() {
	var v=parseFloat(document.searchForm.option4.value);
	if (v < 1) {document.searchForm.option4.value = '1'}
	if (v > 42) {document.searchForm.option4.value = 42}
	if (!v) {document.searchForm.option4.value = ''}
}

function init() {
	if (document.searchForm.figure[0].checked) {
		DefoOpt();
	} else if (document.searchForm.figure[1].checked) {
		FlatOpt();
	} else if (document.searchForm.figure[2].checked) {
		DefoOpt();
	}

	height = getCookie("height");
	if(height != ""){
		SelList(document.searchForm.option2, height);
	}
}

function FlatOpt()
{
	var initSelect = document.searchForm.h_option2.value;
	with(document.searchForm.option2) {
		var len = options.length;
		while(len) {
			len--;
			options[len] = null;
		}
		options[0] = new Option("Not-designated", "");
		options[1] = new Option("- 10", "0,10");
		options[2] = new Option("10 - 15", "10,15");
		options[3] = new Option("15 - 18", "15,18");
		options[4] = new Option("18 - ", "18,999999");
		if (initSelect>0 && initSelect<5) {
			selectedIndex = initSelect;
		} else {
			selectedIndex = 0;
		}
	}
}

function DefoOpt()
{
	with(document.searchForm.option2) {
		var len = options.length;
		while(len) {
			len--;
			options[len] = null;
		}
		options[0] = new Option("You can not designate this item.", "");
		selectedIndex = 0;
	}
	document.searchForm.h_option2.value='';
}

function setSelect1() {
	var i;
	for (i = 0; i < document.searchForm.figure.length; i++) {
	if (document.searchForm.figure[i].checked) {
	document.searchForm.h_figure.value = document.searchForm.figure[i].value;
		}
	}
}
function setSelect2() {
	document.searchForm.h_option1.value = document.searchForm.option1.options[document.searchForm.option1.selectedIndex].value;
}
function setSelect3() {
	document.searchForm.h_option2.value = document.searchForm.option2.options[document.searchForm.option2.selectedIndex].value;
}
function setSelect4() {
	document.searchForm.h_option3.value = document.searchForm.option3.options[document.searchForm.option3.selectedIndex].value;
}
