<!--
Base = new Image();
Base.src = '/map/nldmap8.gif';
CurrentBase = new Image();
CurrentBase.src = '/map/nldmap8.gif';


var CurrentSelectedCode = "";

var mapnld = new Image();
var mapakl = new Image();
var mapwai = new Image();
var maptar = new Image();
var mapbop = new Image();
var mapghb = new Image();
var mapwlg = new Image();
var mapmaw = new Image();
var mapnlm = new Image();
var mapcby = new Image();
var mapwct = new Image();
var mapscb = new Image();
var mapogo = new Image();
var mapsld = new Image();

mapnld.src = '/map/nldmap8.gif';
mapakl.src = '/map/aklmap8.gif';
mapwai.src = '/map/waimap8.gif';
maptar.src = '/map/tarmap8.gif';
mapbop.src = '/map/bopmap8.gif';
mapghb.src = '/map/ghbmap8.gif';
mapmaw.src = '/map/mawmap8.gif';
mapwlg.src = '/map/wlgmap8.gif';
mapnlm.src = '/map/nlmmap8.gif';
mapcby.src = '/map/cbymap8.gif';
mapwct.src = '/map/wctmap8.gif';
mapscb.src = '/map/scbmap8.gif';
mapogo.src = '/map/ogomap8.gif';
mapsld.src = '/map/sldmap8.gif';


function drawImage() {
var mapnumber = document.form1.location_id.selectedIndex;
switch (mapnumber)
{
        case 0:
                var mapname = 'nldmap8.gif';
                break;
case 20:
                var mapname = 'aklmap8.gif';
                break;
case 2:
                var mapname = 'aklmap8.gif';
                break;
case 3:
                var mapname = 'aklmap8.gif';
                break;
case 4:
                var mapname = 'aklmap8.gif';
                break;
case 5:
                var mapname = 'aklmap8.gif';
                break;
case 6:
                var mapname = 'aklmap8.gif';
                break;
case 7:
                var mapname = 'waimap8.gif';
                break;
case 8:
                var mapname = 'bopmap8.gif';
                break;
case 9:
                var mapname = 'ghbmap8.gif';
                break;
case 10:
                var mapname = 'tarmap8.gif';
                break;
case 11:
                var mapname = 'mawmap8.gif';
                break;
case 12:
                var mapname = 'wlgmap8.gif';
                break;
case 13:
                var mapname = 'nlmmap8.gif';
                break;
case 14:
                var mapname = 'wctmap8.gif';
                break;
case 15:
                var mapname = 'cbymap8.gif';
                break;
case 16:
                var mapname = 'scbmap8.gif';
                break;
case 17:
                var mapname = 'ogomap8.gif';
                break;
case 18:
                var mapname = 'sldmap8.gif';
                break;
case 19:
                var mapname = 'allmap8.gif';
                break;
default:
                var mapname = 'nldmap8.gif';
}
document.write('<img name="Base" src="/map/'+mapname+'" border="0" onMouseOut="Base.src=CurrentBase.src; return false" usemap="#BaseMap">');
CurrentBase.src="/map/" + mapname;
}


function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}


function select_item(name, value) {
this.name = name;
this.value = value;
}

function get_selection(select_object) {
        contents = new select_item();

for(var i=0;i<select_object.options.length;i++)
if(select_object.options[i].selected == true) {
contents.value = select_object.options[i].value;
}

return contents;
}

function get_objvalue(select_object, code) {
        contents = new select_item();

for(var i=0;i<select_object.options.length;i++)
if(select_object.options[i].value == code) {
contents.value = select_object.options[i].value;
}

return contents;
}

function makeselectchange(form, code, selname) {
        var select_object = MM_findObj(selname)
        select_object.value = code;
}

function makemapname(form) {
        selection = get_selection(form.location_id);
        var tla=selection.value;

        var selIndex = form.location_id.selectedIndex;

				/* switch (true) {
        	case selIndex == 0: region_code = "all";break;
        	case selIndex == 1: region_code = "nisl";break;
        	case selIndex >= 2 && selIndex <= 8: region_code = "akl";break;
        	case selIndex >= 9 && selIndex <= 13: region_code = "bop";break;
        	case selIndex >= 14 && selIndex <= 18: region_code = "ghb";break;
        	case selIndex >= 19 && selIndex <= 21: region_code = "akl";break;
        	case selIndex >= 22 && selIndex <= 25: region_code = "nld";break;
        	case selIndex >= 26 && selIndex <= 29: region_code = "tar";break;
        	case selIndex >= 30 && selIndex <= 33: region_code = "wai";break;
        	case selIndex >= 34 && selIndex <= 38: region_code = "wlg";break;
        	case selIndex == 39: region_code = "sisl";break;
        	case selIndex >= 40 && selIndex <= 42: region_code = "cby";break;
        	case selIndex >= 43 && selIndex <= 46: region_code = "nlm";break;
        	case selIndex >= 47 && selIndex <= 49: region_code = "ogo";break;
        	case selIndex >= 50 && selIndex <= 52: region_code = "scb";break;
        	case selIndex >= 53 && selIndex <= 56: region_code = "sld";break;
        	case selIndex >= 57 && selIndex <= 58: region_code = "wct";break;
        } */
				
				switch (true) {
        	case selIndex == 0: region_code = "all";break;
        	case selIndex == 1: region_code = "nisl";break;
        	case selIndex >= 2 && selIndex <= 5: region_code = "nld";break;
        	case selIndex >= 5 && selIndex <= 12: region_code = "akl";break;
					case selIndex >= 13 && selIndex <= 16: region_code = "wai";break;
					case selIndex >= 17 && selIndex <= 21: region_code = "bop";break;
					case selIndex >= 22 && selIndex <= 26: region_code = "ghb";break;
        	case selIndex >= 27 && selIndex <= 30: region_code = "tar";break;
					case selIndex >= 31 && selIndex <= 33: region_code = "maw";break;
        	case selIndex >= 34 && selIndex <= 37: region_code = "wlg";break;
        	case selIndex == 38: region_code = "sisl";break;
        	case selIndex >= 39 && selIndex <= 42: region_code = "nlm";break;
					case selIndex >= 43 && selIndex <= 45: region_code = "cby";break;
        	case selIndex >= 46 && selIndex <= 48: region_code = "ogo";break;
        	case selIndex >= 49 && selIndex <= 50: region_code = "wct";break;
        	case selIndex >= 51 && selIndex <= 54: region_code = "sld";break;
        	case selIndex >= 55 && selIndex <= 57: region_code = "scb";break;
        }

//        var mapname = region_code+'map8.gif';

	var mapname = CurrentSelectedCode + 'map8.gif';


        CurrentBase.src="/map/" + mapname;
}

function setCurrCode(select) {
	
	var location_id = select.options[select.selectedIndex].value;

	$.post(
		"/scripts/get_map_code.ajax.php", 
		{loc_id: location_id},
		function(xml) {
			CurrentSelectedCode = $("code", xml).text();
			makemapname(select.form);
			Base.src=CurrentBase.src;
		}, 
		'xml'
		);



}

function swapbase(image) {
        CurrentBase.src= "/map/" + image;
}

function locselect(value) {
	if (typeof value == 'number') {
		$("#location_id option[@value='"+value+"']").attr('selected','selected');
	} else {
		valueindex = $("#location_id option:contains('"+value+"'):first").attr('selected','selected');
	}
}

//-->
