var resizeMap=false;

var mapWidth = 500;
var mapHeight = 350;
// loading-image size
var loadingWidth=112;
var loadingHeight=30;


//var smallMapWidth = 422;
//var smallMapHeight = 212;
//var largeMapWidth = 633;
//var largeMapHeight = 318;

/*
var fullMinx = -2500000.0;
var fullMaxx = 2500000.0;
var fullMiny = -1750000.0;
var fullMaxy = 1500000.0;
*/
var fullMinx = -5500000;
var fullMaxx = 2500000;
var fullMiny = -4500000;
var fullMaxy = 4000000;


var limitMinx = fullMinx;
var limitMaxx = fullMaxx;
var limitMiny = fullMiny;
var limitMaxy = fullMaxy;

var minx = fullMinx;
var miny = fullMiny;
var maxx = fullMaxx;
var maxy = fullMaxy;


var lMinx = minx;
var lMaxx = maxx;
var lMiny = miny;
var lMaxy = maxy;
var pointX = 0.0;
var pointY = 0.0;
var getGcs = false;
var fullAspectedMiny = fullMinx * mapHeight / mapWidth;
var fullAspectedMaxy = fullMaxy * mapHeight / mapWidth;
var fullWidth = Math.abs(fullMaxx - fullMinx);
var fullHeight = Math.abs(fullAspectedMaxy - fullAspectedMiny);
var mapScale=50000000;
var scale;
var hasError=false;


// zoom levels and default extents
var defaultServiceExtents = new Array();
one = new Array();
	one[0] = fullMinx;
	one[1] = fullMiny;
	one[2] = fullMaxx;
	one[3] = fullMaxy;
	one[4] = "ArcWeb:ESRI.Basemap.World";
	//one[5] = new Array(0.003,0.01,0.1,0.3,0.7,2,5.5,9,30,100);
	one[5] = new Array(1,7,26,57,500);//the 500% causes it to go to full extent
defaultServiceExtents[0] = one;
var zoomLevels = defaultServiceExtents[0][5];
// original extent info
var originalMinx = defaultServiceExtents[0][0];
var originalMiny = defaultServiceExtents[0][1];
var originalMaxx = defaultServiceExtents[0][2];
var originalMaxy = defaultServiceExtents[0][3];
var originalSet = 0;

// the current tool
var markers = "";
var whichTOOL = "zoominTOOL";
var whichZOOM = "5ZOOM";

// vars to save mouse position in pixel coordinates
var startX=0;
var startY=0;
var currentX=0;
var currentY=0;

// vars to save mouse position in map coordinates
var mapX = null; 
var mapY = null; 
var locatorMapX = null;
var locatorMapY = null;

// new extent
var newMinx = null;
var newMiny = null;
var newMaxx = null;
var newMaxy = null;

var actionInProgress = false;
var zoomBoxStyle = "mapservice-zoombox";
var extentBoxStyle = "mapservice-selectedarea";
var pointStyle = "mapservice-movepoint";
var positionLayerId = "mapHolder";
var eventLayerId = "theMapTop";
var zoomBoxId = "theZoomBox";
var extentBoxId = "theExtentBox";
var loadImageId = "theLoadingImg";


var placePositionLayerId = "placeNameHolder";
var pointValueId = "pointValueHolder";
var pointPositionLayerId = "pointPositionHolder";


var mapImageId = "theMap";
var mapImageId2 = "theMap2";
var mapImageName = "mapImageSrc";
var mapImageName2 = "mapImageSrc2";
var activeMapImage=1;

var datasource = "";

// the current tool
var currentMode = "";
var whichZOOM = "";

var imgPath = "images/maptools/";
var zoomBoxImage = "zoomin";
var zoomOutImage = "zoomout";
var panImage = "pan";
var extentImage = "select";
var extentAlertMsg = "You did not specify a valid geographic constraint. Please try again!";

//how many decimals we would like to have for coordinates
var decimalNum = 7;
var d = Math.pow(10, decimalNum);
