var hostNm = document.location.host; 
var svURL  = "http://" + hostNm + "/servlet/com.esri.esrimap.Esrimap?ServiceName="; //serverURL
var app_dir = "mimaps"; //Name of the folder that the app is in, below /ArcIMS/Website/  *** Hard coded in toolbar.htm and asp/rsc_otherreport.asp ***
var mapSv = "land_property"; //Default Map Service for startup
var IPAservice = "plan_landuse"; //Name of the mapservice used by IPA functionality
var LandlyrNm="Cad Areas and Lot Text"; //Name of the cadastre layer used for queries/searches/identify etc
var RoadlyrNm="Roads"; //Name of the road layer for road name searches

var imsURL = svURL+mapSv;
var imsQueryURL = '';
var childWindows = new Array();
childWindows.length = 0;
var zoomBoxColor = '#ff0000';
var textColour = '#FFFFFF';
var tableColour = '#FFFFFF';
var hasTOC = true;

//ORIGINAL PRE AMALGAMATION LIMITS
//var startLeft = 643487.0;
//var startRight = 867532.0;
//var startTop = 7748905.0;
//var startBottom = 7620710.0;

//extended 100 km east (limitright) to cater for islands GS apr 2003
//var limitLeft = 643487.0;
//var limitRight = 867532.0;
//var limitTop = 7748905.0;
//var limitBottom = 7620710.0;

//NEW LIMITS FOR AMALGMATION
var startLeft = 611286.0;
var startRight = 867532.0;
var startTop = 7748905.0;
var startBottom = 7589864.0;

var limitLeft = 611286.0;
var limitRight = 867532.0;
var limitTop = 7748905.0;
var limitBottom = 7589864.0;

var photos_on=false;
// New for MiMAPS September 2005. Dan Clark ESRI Australia
var isGet_Layout = false;
var isGet_Extract = false;
var extlist=""; 
var currentExtName="Land and Property";
var inActiveQueryLyr="";
var hasInActiveQueryLyr=false;
var idString="";

// Array to define group layers. syntax is (number of elements in array, mapservice, group name/label, layers in group etc)
var grpLayerArray = new Array();
grpLayerArray[0] = new Array(5,"servs_infrastructure","Water","Water Points","Water Lines");
grpLayerArray[1] = new Array(7,"servs_infrastructure","Sewer","Sewer Main","Sewer Manhole","Sewer Pumpstation","Sewer Jumpup");
var justclickedgroup=false; 

// Array of layer names that are in group layers
var layerIsGrouped = new Array();
layerIsGrouped[0] = "Water Points";
layerIsGrouped[1] = "Water Lines";
layerIsGrouped[2] = "Sewer Manhole";
layerIsGrouped[3] = "Sewer Pumpstation";
layerIsGrouped[4] = "Sewer Jumpup";
layerIsGrouped[5] = "Sewer Main";

//Array of layer to be hidden from the toc
var hideFromToc = new Array();
hideFromToc[0]="Town Text";
hideFromToc[1]="Island Text";
hideFromToc[2]="dotrlyl";
hideFromToc[3]="Main Road Network";
hideFromToc[4]="Qld Loc Gov Areas";
hideFromToc[5]="Qld and MCC Areas";
hideFromToc[6]="MCC Mainland and Islands";
hideFromToc[7]="Ocean Background";
hideFromToc[8]="Airport Noise Exposure Area";
hideFromToc[9]="Airport Obstacle Limitation Surface Area";


//Array of layers with labels. Syntax is "Layer Name,Label Layer Name,Label Layer Name, etc"
var layerHasLabel = new Array();
layerHasLabel[0] = "Cadastre,Cad Areas and Plan Text,Cad Areas and Lot Text";
//layerHasLabel[1] = "Roads,Road Names";
layerHasLabel[1] = "Contours,Contour Hts";
layerHasLabel[2] = "Water Lines,Water Line IDs,Water Line Lengths";
layerHasLabel[3] = "Sewer Main,Sewer Line IDs,Sewer Line Lengths";
layerHasLabel[4] = "Sewer Manhole,Manhole Ids";
layerHasLabel[5] = "Sewer Pumpstation,Pump Stn Ids";
layerHasLabel[6] = "Sewer Jumpup,Jump Up Dists,Jump Up Ids";
layerHasLabel[7] = "MCC Parks,MCC Park Names";
//layerHasLabel[8] = "Roads,Road Names";

var no_query=new Array();
no_query[0]="House Numbers";
no_query[1]="Dogs";
no_query[2]="Government Property";
no_query[3]="Town Text";
no_query[4]="Island Text";
no_query[5]="dotrlyl";
no_query[6]="Main Road Network";
no_query[7]="Qld Loc Gov Areas";
no_query[8]="Qld and MCC Areas";
no_query[9]="MCC Mainland and Islands";
no_query[10]="Ocean Background";
no_query[11]="Open Drains";
no_query[12]="Commercial and Residential Interface";
no_query[13]="Sewer Detail Sheet Index";
no_query[14]="Sewer Photo Sheet Index";
no_query[15]="Airport Safety Zone";
no_query[16]="Tourist Areas";
no_query[17]="Flood and Inundation";
no_query[18]="Acid Sulfate Soils";
no_query[19]="Landscape Character";
no_query[20]="Bushfire Management";
no_query[21]="Reclamation Limits (Walkerston)";
no_query[22]="Public Toilets";
no_query[23]="Airport Noise Exposure Area";
no_query[24]="Airport Obstacle Limitation Surface Area";
no_query[25]="Good Quality Agricultural Land";
no_query[26]="Steep Land";
no_query[27]="Disability Parking";
no_query[28]="Road Name Labels";
no_query[29]="Evacuation Routes";
no_query[30]="Evacuation Area - Brown";
no_query[31]="Evacuation Area - Pink";
no_query[32]="Evacuation Area - Orange";
no_query[33]="Evacuation Area - Grey";
no_query[34]="Evacuation Area - Purple";

var thelayervariable="";
var searchlayertype="";
var SearchQueryString="";
var is_roads=false;
var MapUnits = "Metres";
var ScaleBarUnits = "Metres";

//Mackay for markup
var currentshape="line";
var currentcolor="#FFFFFF";
var currentsize="1";
var currentstring="";
var currenttype="";
var linedrawing=false;
var linedrawfirst=true;
var linefirstpoint="";
var linedraw_Str="";
var linedraw_Pts=0;
var linelinepoints=0;
var linedraw_Points="";
draw_loaded=false;

//for point coordinate projection
var project_pts=new Array();
var project_pts_count=0;
var projectmp=0;

//************************************************
//ppunter October 2009
var is_newimageon=false;
//End Changes ppunter October 2009
//************************************************

// variables for map pixel offset from upper left corner of frame
var hspc = 0;
var vspc = 0;
//panning factor for arrow buttons
var panFactor = 0.85;
//zoom factors for v.3
var zoomFactor = 2;

// margin factor for f73g in on selected lines and polygons - based on feature width and height. . . margin will be selectMargin * width or height
var selectMargin = 0.25;
// margin margin factor for f73g in on selected points - based on full extent. . . margin will be selectPointMargin * fullWidth or fullHeight
var selectPointMargin = 0.025;

// show the scale factor
var showScalePercent=false;

// Calculated scale
var calcScale=0;
// display coords in status line
var showXYs=true;
var scrollFromTopTOC = 0;

var numDecimals = 3;

// setup test for Nav 4.0
var isIE = false;
var isNav = (navigator.appName.indexOf("Netscape")>=0);
var isNav4 = false;
var isIE4 = false;
var is5up = false;
if (isNav) {
	if (parseFloat(navigator.appVersion)<5) {
		isNav4=true;
		//alert("Netscape 4.x or older");
	} else {
		is5up = true;
	}
} else {
	isIE4=true;
	isIE=true;
	if ((navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE 6")>0) || (navigator.appVersion.indexOf("MSIE 7")>0)) {
		isIE4 = false;
		is5up = true;
	}
}

// index of initial active layer. . . if more than or equal to layer count top layer used
var actLyrIndex=8;  //Current Land layer
var toggleVisible = true;
var webParams = "";
if (parent.MapFrame!=null) {
	webParams = parent.document.location.search;
} else {
	webParams = document.location.search;
}
var pixelTolerance=4;
var highlightColor="255,0,0";
var checked = false;
function checkParams() {
	appDir = f57(document.location.pathname);
	getCommandLineParamsPre();
		if (isNav4) {
			document.captureEvents(Event.MOUSEMOVE);
			document.captureEvents(Event.MOUSEDOWN);
			document.captureEvents(Event.MOUSEUP);
		}
		document.onmousemove = f75;
		document.onmousedown = f12;
		document.onmouseup = f11;
	f10("f73");
	startMap(); 
}