/*
 *aimsParam.js
 */
var em_viewer_domain = "maps.cattco.org";
var em_viewer_path = "/website/tourism/";
var server = "http://maps.cattco.org";
var service = "Tourism";
var url = server + "/servlet/com.esri.esrimap.Esrimap?ServiceName=" + service + "&Form=False&ClientVersion=9.0";

var print_server = "http://maps.cattco.org";
var print_service = "TourismPrint";
var print_url = print_server + "/servlet/com.esri.esrimap.Esrimap?ServiceName=" + print_service + "&Form=False&ClientVersion=9.0";

var query_server = "http://maps.cattco.org/servlet/com.esri.esrimap.Esrimap";
var query_params = "ServiceName=" + service + "&CustomService=Query&Form=False&ClientVersion=9.0";
var query_url = query_server+"?"+query_params;

var domain_target = "http://www.EnchantedMountains.info";

var showGeocode=false;

var aPoints = new Array();

var vAXL_screen;
var vAXL_print;

var fShift_amt = 0.2;

var zoomFactor = 10;
// margin factor for zooming in on selected lines and polygons - based on feature width and height. . . margin will be selectMargin * width or height
var selectMargin = 25/100;
// margin margin factor for zooming in on selected points - based on full extent. . . margin will be selectPointMargin * fullWidth or fullHeight
var selectPointMargin = 25/1000;
var coordsDelimiter = " ";
var xHalf;
var yHalf;

// initial map extent
var startLeft = 1018436.47198914;
var startRight = 1223089.34355708;
var startTop = 926538.673695455;
var startBottom = 727851.898151483;
// maximum map extent
var minX_limit = 923131.3990667409;
var minY_limit = 686552.6481589254;
var maxX_limit = 1319417.4624184691;
var maxY_limit = 954511.1775729294;

/* checks to see if any current map variables
 * are out of the extents of the application

function checkFullExtent() {

		var xDistance1 = eRight - eLeft;
		var yDistance1 = eTop - eBottom;

		if (xDistance1>fullWidth) xDistance1 = fullWidth;
		if (yDistance1>fullHeight) yDistance1 = fullHeight;

		//alert("Adjusting extent to image proportions");
		if ((eLeft < limitLeft) && (eTop > limitTop)) {
			eLeft = limitLeft;
			eRight = limitRight;
		} else {
			if (eLeft < limitLeft) {
				eLeft = limitLeft;
				eRight = eLeft + xDistance1;
			} else if (eRight > limitRight) {
				eRight = limitRight;
				eLeft = eRight - xDistance1;
			}	
		}
		if ((eLeft < limitLeft) && (eTop > limitTop)) {
			eTop = limitTop;
			eBottom = limitBottom;
		} else {
			if (eTop > limitTop) {
				eTop = limitTop;	
				eBottom = eTop - yDistance1;
			} else if (eBottom < limitBottom) {
				eBottom = limitBottom;	
				eTop = eBottom + yDistance1;
			}	
		}

}
 */
//map div's location and size
var widthWin;
var heightWin;

//info("Inner Width=" + widthWin + " Inner Height=" + heightWin);
/*
var availWidth = screen.availWidth;
var availHeight = screen.availHeight;
alert("Available Width=" + availWidth + " Available Height=" + availHeight);
*/
var top;
var left;
var width;
var height;

var mtop, mleft, mwidth, mheight, mborder; // map sizes

function setWH() {
	if ( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		//info("Moz or other");
		heightWin = window.innerHeight;
		widthWin = window.innerWidth;
		widthWin = noScroll();
	} else if ( document.getElementById ) {
		//info("IE 6+");
		//IE 6+ in 'standards compliant mode'
		heightWin = document.documentElement.offsetHeight;
		widthWin = document.documentElement.offsetWidth;
		widthWin = noScroll();
	} else if ( document.body && ( document.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		//info("IE 4 compat");
		widthWin = document.body.clientWidth;
		heightWin = document.body.clientHeight;
		widthWin = noScroll();
	}
    top = 0;
    left = 0;
    width = widthWin - 2;
    height = heightWin  - 2;
}
function noScroll() {
	tmpWidthWin = widthWin - 20;
	if ( document.getElementById ) {
	    //is.ie5 || is.ie55 || is.ie6
		//document.documentElement.scroll = "no";
		//document.getElementsByTagName("body")[0].style.overflow="hidden";
	} else {
		//document.body.scroll = "no";
	}
	return tmpWidthWin;
}
setWH();
var border = 0;
var DivId = 'maparea';
//identify result div's location
var idLeft=0;
var idTop=0;
function getHTTPObject() {
    return Try.these(
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')},
      function() {return new XMLHttpRequest()}
    ) || false;
}
var isNav = (window.navigator.appName.toLowerCase().indexOf("netscape")>=0);
var isIE = (window.navigator.appName.toLowerCase().indexOf("microsoft")>=0);
var isWorking = false;
var minx, miny, maxx, maxy;

var oLoadingQ;
var image_label_ext = isIE?".gif":".png";
image_label_ext = ".png"; // force pngs when using filter for IE

var dir_label_letters = "graphics/letters/";
var dir_label_numbers = "graphics/numbers/";
var hide;
var show;
var iPoint_zindex;
var iPoint_zindex_x;
var aPoint_id = new Array();
var aPoint_layer_id = new Array();
var aPoint_latitude = new Array();
var aPoint_longitude = new Array();
var aPoint_name = new Array();
var aPoint_address = new Array();
var aPoint_city = new Array();
var aPoint_state = new Array();
var aPoint_zip = new Array();
var aPoint_phone = new Array();
var aPoint_web_site = new Array();
var aPoint_arc_point_id = new Array();
var aPoint_info = new Array();
var aPoint_x = new Array();
var aPoint_y = new Array();
var aPoint_hotlink = new Array();
var aPoint_show = new Array();
var aPoint_star = new Array();
var aPoint_sort = new Array();

//var bTOC_loaded = false;
var bMouseHelp_prev = false;
var bPointDebug = false;
var bPointsRefresh = false; // changes upon map requests
var oPointsContentDim = new Object(); // object dimensions
var point_prefix = "point_";
var point_padding_tb = 20; // point padding on top or bottom
var point_unique_id = 1;
var oPointFlagged = new Object(); // point that is flagged to be opened after a new map is created.
oPointFlagged['layerID'] = -1;
oPointFlagged['pointID'] = -1;
var pSquareSize = 39;
var point_info_close_width = 39;
var point_info_close_height = 39;
var point_info_expand_width = 174;
var point_info_expand_height = 182;

var iPoints_info = 0;
var geocode = false;
var bCookies;
var aCookies = new Array();
var cookie_prefix = "point_";
var cookie_id_prefix = "cookie_";
var cookie_split = "*x*";

var browser;

var theX, theY;
var x1, y1, x2, y2;
var zleft,zright,ztop,zbottom;
var mtop,mleft,mwidth,mheight,mborder;
var mapDivId = DivId;
var activeTool;
var dragging = false;
var panning = false;
var waitingForResponse = false;

if (document.layers) {
    hide = 'hide';
    show = 'show';
} else if (document.all) {
    hide = 'hidden';
    show = 'visible';
} else if (document.getElementById)	{
    hide = 'hidden';
    show = 'visible';
}

var aLetters = new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','ERR');
var bLabels_info = 0; // on screen labels
var bLabels_saved = 0; // saved locations labelled
var bLabels_search = 0; // Searched points are not labelled as they do not appear on screen

var drawScaleBar = true;
	// MapUnits=DEGREES,FEET,METERS
	// can MapUnits be changed by user?
var setMapUnits=true;
	// ScaleBarUnits=KILOMETERS,METERS,MILES,FEET
var ScaleBarBackground = "false";
var ScaleBarBackColor = "0,0,0";
var ScaleBarFontColor = "0,0,0";
var ScaleBarColor = "128,18,4";
var ScaleBarFont = "";
var ScaleBarStyle = "Regular";
var ScaleBarRound = "2";
var ScaleBarSize = "10";
var ScaleBarWidth = "6";
var ScaleBarPrecision = 2;
var numDecimals = ScaleBarPrecision;
	// Scale Bar 2
var drawScaleBar2 = false;
var ScaleBar2Units = "KILOMETERS";
var ScaleBar2Background = "false";
var ScaleBar2BackColor = "0,0,0";
var ScaleBar2FontColor = "0,0,0";
var ScaleBar2Color = "128,128,128";
var ScaleBar2Font = "";
var ScaleBar2Style = "Regular";
var ScaleBar2Round = "1";
var ScaleBar2Size = "9";
var ScaleBar2Width = "5";
var ScaleBar2Precision = 2;