//marine warning map

function warningLinks(){
	var locations=new Array('NSW','VIC','QLD','WA', 'SA', 'TAS',  'NT');
	var locationslength=locations.length;
	if(document.getElementById('m-warnings').firstChild.nodeValue !=""){
	var result = document.getElementById('m-warnings').firstChild.nodeValue;
	//strip any white space
	result=result.replace(/^\s+|\s+$/g,"");
	var states=result.split(/\s*,\s*/); 
	var stateslength=states.length;
		for (i=0; i<stateslength;i++){
			thisstate = states[i]; 
			for (j=0;j<locationslength;j++){
				if(thisstate == locations[j]){
				//show respective graphic
				document.getElementById('warningmap'+ (j*1+1)).style.visibility = 'visible';
				} 
			}
		}
	}
}

window.onLoad=addEvent(window, 'load', warningLinks);

function addEvent(obj,evt,fn){
if(obj.addEventListener)
	obj.addEventListener(evt, fn, false);
	else if(obj.attachEvent)
		obj.attachEvent('on' + evt,fn);
}