var selectedregion = "";
var imgLoad = new Array(21);
// preload images
for (var i=1; i<=21; i++){
	imgLoad[i] = new Image();
	if (i>0 && i<15) {
		// north island
		imgLoad[i].src = "images/map-north-" + i + ".gif";
	} else if (i>14 && i<22) {
		// south island
		imgLoad[i].src = "images/map-south-" + i + ".gif";
	}		
}
// map image swapping
function DoSelectRegion(rid){
	document.formsearch.RegionID[rid-1].checked = true;
	selectedregion = rid;
}
function DoShowRegion(rid){
	if (rid>0 && rid<15) {
		// north island
		document['map-north'].src = "images/map-north-" + rid + ".gif";
	} else if (rid>14 && rid<22) {
		// south island
		document['map-south'].src = "images/map-south-" + rid + ".gif";
	}
}
function DoResetMap(){
	if (selectedregion != "") {
		if (selectedregion>0 && selectedregion <15) {
			// north island
			document['map-north'].src = "images/map-north-" + selectedregion + ".gif";
			document['map-south'].src = "images/map-south.gif";
		} else if (selectedregion>14 && selectedregion<22) {
			// south island
			document['map-south'].src = "images/map-south-" + selectedregion + ".gif";
			document['map-north'].src = "images/map-north.gif";
		}				
	} else {
		document['map-north'].src = "images/map-north.gif";
		document['map-south'].src = "images/map-south.gif";
	}
}