function gotoCatchment(catchmentExtent){
  document.form.catchment.value = catchmentExtent;
	document.form.submit();
}

function pan(dx,dy)
{
	document.map.panX.value = dx;
	document.map.panY.value = dy;
	document.map.method.value = 'pan';
	document.map.submit();

}


 function zoom(factor)
 {
	document.map.relativezoom.value = factor;
	document.map.method.value = 'zoom';
	document.map.submit();
 }

 
 function mape(extent)

{

	document.map.method.value='setcontext';
	document.map.extent.value=extent;
	document.map.submit();
}

function openURL(url){
  window.open(url, 'STREAM_data', 'toolbar=yes,menubar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,width=600,height=500');
}

function openSiteList(){
  window.open('http://www.waterwatch.nsw.gov.au/servlet/WWServlet1','STREAM_data','location=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=500');
}

function openHelpPage(){
  window.open('http://www.waterwatch.nsw.gov.au/ww/streamhelp.html','STREAM_data','location=no,status=yes,scrollbars=yes,resizable=yes,width=650,height=600');
}

function do_submit(){
  document.map.submit();
}

function setButton(name){
  if(name == 'zoomin' || name == 'zoomout' || name == 'pan' || name == 'info'){
    document.map.defaultButton.value = name;
  }else{
    document.map.defaultButton.value = 'pan'; // default
  }
}

function zoomAndSetCentre(factor, x, y){
	document.map.relativezoom.value = factor;
	document.map.method.value = 'center';
	document.map.elements["setpoint.x"].value = x;
	document.map.elements["setpoint.y"].value = y;
	document.map.submit();
}

function setCurrentCatchment(i){
	document.map.currentCatchment.value = i;
}

function setCurrentLGA(i){
	document.map.currentLGA.value = i;
}

function promptErrorMessage(message){
	alert(message);
}

function checkErrorOnLoad(){
	if(document.map.errorString.value != ""){
		promptErrorMessage('Error: ' + document.map.errorString.value);
	}
	if(document.map.tooManySites == "true"){
		alert('There are too many sites in the current map view. Only the first 500 will be selectable');
	}
}

function checkScale(){
	if(document.map.scaleTooSmall.value == "true"){
		alert('The current zoom level is too small. Please zoom out to above 10km');
		
	}
	
}

function constructSiteList(str){
	myOtherWindow = open("", "SiteListWindow",'toolbar=yes,location=yes,width=600,height=500,status=yes,scrollbars=yes,resizable=yes');

	myOtherWindow.document.write(str);
}

