function goPage(form) {
	if (form.RRNameSelector.selectedIndex == 0) { // When Marks option box was used
	    window.location.href = 'http://www.rrmerchandise.com/'+RRMark[form.RRMarkSelector.selectedIndex-1]+'Select.htm';
	    }  
	else { // When Names option box was used
		for (i = 0; i < RRName.length; i++){
			if (RR[i][1] == RRName[form.RRNameSelector.selectedIndex-1]){
			    window.location.href = 'http://www.rrmerchandise.com/'+RR[i][0]+'Select.htm';
			}
	    }
	}
}

function buildOptionBox(NamesOrMarks){
//--NamesOrMarks=0: Marks -- NamesOrMarks=1: Names--
	if (NamesOrMarks==1){ // When option box with Names
		RRName = new Array();
		for (i=0; i < RR.length; i++){
			RRName[i]=RR[i][1];
		}
		RRName.sort();
		OptionItem=RRName;
	}
	else { // When option box with Marks
		RRMark = new Array();
		j = 0;
		for (i=0; i < RR.length; i++){
			if (RR[i][2]==1){
				RRMark[j]=RR[i][0];
				j++;
			}
		}
	RRMark.sort();
	OptionItem=RRMark;
	}
	document.write('<option>'+'Select...');
    for (i = 0; i < OptionItem.length; i++) {
	    document.write('<option class="item">' + OptionItem[i]);
    }
}

// -------------------------------------------------------------------------------------------------------------

function designMenuBuilder(){
	document.write('<img src="images/RRLogos.GIF" width="145" height="120" title="<- Please select a product by selecting your favorite railroad first" align="right">');
	document.write('<p class="module">Please select the railroad of your choice;</p>');
	document.write('<br>');
	document.write('<p class="module"><font color="#008000">...by name:</font></p>');
	document.write('<form>');
	document.write('<select name = "RRNameSelector" style="width: 240px" onChange = "goPage(this.form)">');
	document.write('<script language = "JavaScript">');
	document.write('buildOptionBox(1)');
	document.write('</script>');
	document.write('</select>');
	document.write('<br><br>');
	document.write('<p class="module"><font color="#008000">...by reporting mark:</font></p>');
	document.write('<select name = "RRMarkSelector" style="width: 120px" onChange = "goPage(this.form)">');
	document.write('<script language = "JavaScript">');
	document.write('buildOptionBox(0)');
	document.write('</script>');
	document.write('</select>');
	document.write('<a style="color: #008000; text-decoration: none; font-size: 85%" href="Products.htm">');
	document.write('<font face="Webdings"> 4</font>more options...</a>');
	document.write('</form>');
}

