var x;
var modelName;
function populate(arrayname) {
	for (i=0;i<arrayname.length;i++) {
		if (arrayname[i].slice(0,4)=="<h2>"){
			x = arrayname[i];
			modelName = x.substring(4);
			/* to accomodate the way that the Forest River Salem Hemispehere 5th-Wheels & Travel-Trailers are both entered simply as "Salem Hemispehere" by the field techs, and to ensure that floorplans still show up on the unitDetail pages */
			if (modelName == "Salem Hemisphere 5th Wheel" || modelName == "Salem Hemisphere Travel Trailer") {
				modelName = "Salem Hemisphere";
			};
			/* to accomodate the way that the Forest River Wildcat 5th-Wheels & Travel-Trailers are both entered simply as "Wildcat" by the field techs, and to ensure that floorplans still show up on the unitDetail pages */
			if (modelName == "Wildcat 5th Wheel" || modelName == "Wildcat Travel Trailer") {
				modelName = "Wildcat";
			};
			/* to accomodate the way that the McKenzie Starwood 5th-Wheels & Travel-Trailers are both entered simply as "Starwood" by the field techs, and to ensure that floorplans still show up on the unitDetail pages */
			if (modelName == "Starwood LX 5th Wheel" || modelName == "Starwood LX Travel Trailer") {
				modelName = "Starwood LX";
			};
			/* to accomodate the way that the McKenzie Starwood LE 5th-Wheels & Travel-Trailers are both entered simply as "Starwood LE" by the field techs, and to ensure that floorplans still show up on the unitDetail pages */
			if (modelName == "Starwood LE 5th Wheel" || modelName == "Starwood LE Travel Trailer") {
				modelName = "Starwood LE";
			};
			/* to accomodate the way that the McKenzie Starwood 5th-Wheels & Travel-Trailers are both entered simply as "Starwood" by the field techs, and to ensure that floorplans still show up on the unitDetail pages */
			if (modelName == "Starwood 5th Wheel" || modelName == "Starwood Travel Trailer") {
				modelName = "Starwood";
			};
			/* to accomodate the way that the Attitude ToyHaulers are entered simply as "Attitude" by the field techs, and to ensure that floorplans still show up on the unitDetail pages */
			if (modelName == "Toy Haulers" || modelName == "Attitude Toy Haulers") {
				modelName = "Attitude";
			};
			altmodelName = modelName.replace(/ /,"_");
			document.writeln(x + "<a name=\"" + altmodelName + "\">&nbsp;<\/a><\/h2>");
		}else{
			document.writeln("<p><span>" + arrayname[i] + "<\/span><br \/>");
			document.writeln("<a href=\"../floorplans/" + modelName + "_" + arrayname[i] + ".jpg\" onclick=\"return popImage(this.href,\'" + arrayname[i] + "\');\"><img src=\"../floorplans/thumbnails/" + modelName + "_" + arrayname[i] + "a.jpg\" alt=\"" +modelName + " " + arrayname[i] + " Floorplan \" /><\/a>");
			document.writeln("<\/p>");
		}
	}
}
