// fills out the "where did you hear about us" <select> box options from MOSAIC 
function InitializeWhereHearOptions()   {
	var rawData, strA, strB, strC, WHelement;
	
	rawData = document.getElementById("wherehearoptions").innerHTML;
	
	// get rid of line breaks
	strA = rawData.replace(/\r\n/g, "");
	// make <P> tags lowercase to avoid browser differences (IE renders <P>, Firefox renders <p>)
	strA = strA.replace(/<\/P><P>/g, "</p><p>");
	// string to begin after "START" text
	pospos  = strA.indexOf("LISTSTART");
	strB = strA.substring(pospos + 9);
	// string to exclude finishing "END" text
	lenstrB = strB.length;
	strC = strB.substring(0, lenstrB - 11);

	// now create array and populate the <select> box		
	itemsarray = strC.split("</p><p>");
	WHelement = document.request_brochure.hear_about;
	for (i=1; i<itemsarray.length-1; i++)   {
		WHelement.options[i] = new Option(itemsarray[i], itemsarray[i]);
		}
}

//Limit the selection of brochures to 3
function countBrochures(id) {
	var intBrochureAmount = 0;
	for(i=1;i<=8;i++) {
		if(document.getElementById("brochure" + i).checked == true) {
			intBrochureAmount = intBrochureAmount + 1;
		}
	}
	if(intBrochureAmount > 3) {
		document.getElementById(id).checked = false;
		alert('In order to save trees, we limit requests to 3 brochures. If you would like to view added brochures, why not download an e-brochure?');
	}
}