	//maps
	delimiter = " ";//str			- a string value that input data is separated with (<sp> or :)
	mapWd = 1440;//px			- width of map on page
	mapHt = 720;//px			- height of map on page
	trgWd = 14;//px			- icon width
	trgHt = 14;//px			- icon height
	mapW = 180;//deg	- left edge of map (in degrees)
	mapE = -180;//deg	- right edge of map (in degrees)
	mapN = 90;//deg	- top edge of map (in degrees)
	mapS = -90;//deg	- bottom edge of map (in degrees)
	mapOffsetX = 720;
	mapOffsetY = 360;

	mapItems = 65;
	lblLabel = new Array(mapItems);
	lblCoords = new Array(mapItems);
	lblType = new Array(mapItems);
	lblSiz = new Array(mapItems);

	//Major Albedo Features
	lblLabel[9] 	= "Acidalia Planitia";		lblCoords[9] 	= "N45 W030";	lblType[9] 		= "Maj"; lblSiz[9]	= "";
	lblLabel[10] 	= "Australe Mare";			lblCoords[10] 	= "S60 W010";	lblType[10] 	= "Maj"; lblSiz[10]	= "";
	lblLabel[11] 	= "Cerberus";				lblCoords[11] 	= "N15 E166";	lblType[11] 	= "Maj"; lblSiz[11]	= "";
	lblLabel[12] 	= "Chryse Planitia";		lblCoords[12] 	= "N18 W040";	lblType[12] 	= "Maj"; lblSiz[12]	= "";
	lblLabel[13] 	= "Cydonia";				lblCoords[13] 	= "N40 W000";	lblType[13] 	= "Maj"; lblSiz[13]	= "";
	lblLabel[14] 	= "Elysium	Planitia";		lblCoords[14] 	= "N14 E119";	lblType[14] 	= "Maj"; lblSiz[14]	= "";
	lblLabel[15] 	= "Hellas Basin";			lblCoords[15] 	= "S40 E070";	lblType[15] 	= "Maj"; lblSiz[15]	= "";
	lblLabel[16] 	= "Meridiani Terra";		lblCoords[16] 	= "S07 W356";	lblType[16] 	= "Maj"; lblSiz[16]	= "";
	lblLabel[17] 	= "Sabaea Terra";			lblCoords[17] 	= "S10 W331";	lblType[17] 	= "Maj"; lblSiz[17]	= "";
	lblLabel[18] 	= "Syrtis Major";			lblCoords[18] 	= "N10 W290";	lblType[18] 	= "Maj"; lblSiz[18]	= "";
	lblLabel[19] 	= "Utopia Planitia";		lblCoords[19] 	= "N48 W277";	lblType[19] 	= "Maj"; lblSiz[19]	= "";
	lblLabel[20] 	= "Xanthe Terra";			lblCoords[20] 	= "N04 W046";	lblType[20] 	= "Maj"; lblSiz[20]	= "";
	lblLabel[21] 	= "Arabia Terra";			lblCoords[21] 	= "N30 W330";	lblType[21] 	= "Maj"; lblSiz[21]	= "";
	lblLabel[22] 	= "Noachis Terra";			lblCoords[22] 	= "S45 W000";	lblType[22] 	= "Maj"; lblSiz[22]	= "";
	lblLabel[23] 	= "Aonia Terra";			lblCoords[23] 	= "S58 W095";	lblType[23] 	= "Maj"; lblSiz[23]	= "";
	lblLabel[24] 	= "Tyrrhena Terra";			lblCoords[24] 	= "S19 W289";	lblType[24]		= "Maj"; lblSiz[24]	= "";
	lblLabel[25] 	= "Promethei Terra";		lblCoords[25] 	= "S53 W262";	lblType[25]		= "Maj"; lblSiz[25]	= "";
	lblLabel[26] 	= "Cimmeria Terra";			lblCoords[26] 	= "S34 W215";	lblType[26] 	= "Maj"; lblSiz[26]	= "";
	lblLabel[27] 	= "Sirenum Terra";			lblCoords[27] 	= "S37 W160";	lblType[27] 	= "Maj"; lblSiz[27]	= "";
	lblLabel[28] 	= "Tempe Fossae";			lblCoords[28] 	= "N41 W070";	lblType[28] 	= "Maj"; lblSiz[18]	= "";
	lblLabel[29] 	= "Margaritifer Terra";		lblCoords[29] 	= "S16 W021";	lblType[29] 	= "Maj"; lblSiz[19]	= "";
	lblLabel[48] 	= "Vastitas Borealis";		lblCoords[48] 	= "N67 W180";	lblType[48] 	= "Std"; lblSiz[48]	= "";
	lblLabel[49] 	= "Daedalia Planum";		lblCoords[49] 	= "S14 W138";	lblType[49] 	= "Std"; lblSiz[49]	= "";
	lblLabel[50] 	= "Hesperia Planum";		lblCoords[50] 	= "S18 W252";	lblType[50] 	= "Std"; lblSiz[50]	= "";
	lblLabel[51] 	= "Lunae Planum";			lblCoords[51] 	= "N10 W067";	lblType[51] 	= "Std"; lblSiz[51]	= "";
	lblLabel[52] 	= "Erythraeum Planum";		lblCoords[52] 	= "S34 W65";	lblType[52] 	= "Std"; lblSiz[52]	= "";
	lblLabel[53] 	= "Argyre Basin";			lblCoords[53] 	= "S50 W040";	lblType[53] 	= "Maj"; lblSiz[53]	= "";
	lblLabel[57] 	= "Tharsis Bulge";			lblCoords[57] 	= "N10 W130";	lblType[57] 	= "Maj"; lblSiz[57]	= "";
	lblLabel[58] 	= "Arcadia Planitia";		lblCoords[58] 	= "N50 W165";	lblType[58] 	= "Maj"; lblSiz[58]	= "";
	lblLabel[59] 	= "Amazonis Planitia";		lblCoords[59] 	= "N25 W165";	lblType[59] 	= "Maj"; lblSiz[59]	= "";
	lblLabel[63] 	= "Isidis Planitia";		lblCoords[63] 	= "N14 E092";	lblType[63] 	= "Std"; lblSiz[63]	= "";
	
	//Major Relief Features
	lblLabel[1] 	= "Olympus Mons";			lblCoords[1] 	= "N18 W134";	lblType[1] 		= "Maj"; lblSiz[1]	= "pt";
	lblLabel[2] 	= "Pavonis Mons";			lblCoords[2] 	= "N00 W112";	lblType[2] 		= "Std"; lblSiz[2]	= "pt";
	lblLabel[3] 	= "Valles Marineris";		lblCoords[3] 	= "S09 W073";	lblType[3] 		= "Maj"; lblSiz[3]	= "";
	lblLabel[4] 	= "Elysium Mons";			lblCoords[4] 	= "N25 E147";	lblType[4] 		= "Std"; lblSiz[4]	= "pt";
	lblLabel[5] 	= "Antoniadi Crater";		lblCoords[5] 	= "S25 W151";	lblType[5] 		= "Min"; lblSiz[5]	= "pt";
	lblLabel[7] 	= "Hellespontus Montes";	lblCoords[7] 	= "S45 W317";	lblType[7] 		= "Std"; lblSiz[7]	= "pt";
	lblLabel[8] 	= "Ascraeus Mons";			lblCoords[8] 	= "N11 W105";	lblType[8] 		= "Std"; lblSiz[8]	= "pt";
	lblLabel[30] 	= "Schiaparelli crater";	lblCoords[30] 	= "S01 W343";	lblType[30] 	= "Maj"; lblSiz[30]	= "pt";
	lblLabel[61] 	= "Arsia Mons";				lblCoords[61] 	= "S10 W121";	lblType[61] 	= "Std"; lblSiz[61]	= "pt";
	lblLabel[62] 	= "Alba Patera";			lblCoords[62] 	= "N40 W106";	lblType[62] 	= "Maj"; lblSiz[62]	= "";
	lblLabel[65] 	= "Apollinaris Patera";		lblCoords[65] 	= "S09 W186";	lblType[65] 	= "Std"; lblSiz[65]	= "pt";

	//Man-made
	lblLabel[6] 	= "Spirit Rover";			lblCoords[6] 	= "S15 E170";	lblType[6] 		= "Spe"; lblSiz[6]	= "pt";
	lblLabel[54] 	= "Opportunity Rover";		lblCoords[54] 	= "S03 W007";	lblType[54] 	= "Spe"; lblSiz[54]	= "pt";
	lblLabel[55] 	= "Viking 2 Lander";		lblCoords[55] 	= "N48 W226";	lblType[55] 	= "Spe"; lblSiz[55]	= "pt";
	lblLabel[56] 	= "Viking 1 Lander";		lblCoords[56] 	= "N22 W048";	lblType[56] 	= "Spe"; lblSiz[56]	= "pt";
	lblLabel[60] 	= "Pathfinder Lander";		lblCoords[60] 	= "N19 W033";	lblType[60] 	= "Spe"; lblSiz[60]	= "pt";

	//Craters
	lblLabel[31] 	= "Huygens crater";			lblCoords[31] 	= "S14 W304";	lblType[31] 	= "Std"; lblSiz[31]	= "pt";
	lblLabel[32] 	= "Cassini crater";			lblCoords[32] 	= "N24 W328";	lblType[32] 	= "Std"; lblSiz[32]	= "pt";
	lblLabel[33] 	= "Tikhonravov crater";		lblCoords[33] 	= "N14 W324";	lblType[33] 	= "Std"; lblSiz[33]	= "pt";
	lblLabel[34] 	= "Antoniadi crater";		lblCoords[34] 	= "N22 W299";	lblType[34] 	= "Std"; lblSiz[34]	= "pt";
	lblLabel[35] 	= "Schroeter crater";		lblCoords[35] 	= "S02 W304";	lblType[35] 	= "Std"; lblSiz[35]	= "pt";
	lblLabel[36] 	= "Herschel crater";		lblCoords[36] 	= "S15 W230";	lblType[36] 	= "Std"; lblSiz[36]	= "pt";
	lblLabel[37] 	= "Koval'sky crater";		lblCoords[37] 	= "S30 W141";	lblType[37] 	= "Std"; lblSiz[37]	= "pt";
	lblLabel[38] 	= "Copernincus crater";		lblCoords[38] 	= "S50 W169";	lblType[38] 	= "Std"; lblSiz[38]	= "pt";
	lblLabel[39] 	= "Newton crater";			lblCoords[39] 	= "S41 W158";	lblType[39] 	= "Std"; lblSiz[39]	= "pt";
	lblLabel[40] 	= "Gusev crater";			lblCoords[40] 	= "S13 W189";	lblType[40] 	= "Std"; lblSiz[40]	= "pt";
	lblLabel[64] 	= "Lyot crater";			lblCoords[64] 	= "N50 W331";	lblType[64] 	= "Std"; lblSiz[64]	= "pt";
	

	//Minor Relief features
	lblLabel[41] 	= "Hecates Tholus";			lblCoords[41] 	= "N32 E150";	lblType[41] 	= "Std"; lblSiz[41]	= "pt";
	lblLabel[42] 	= "Albor Tholus";			lblCoords[42] 	= "N19 W210";	lblType[42] 	= "Std"; lblSiz[42]	= "pt";
	lblLabel[43] 	= "Tharsis Tholus";			lblCoords[43] 	= "N13 W091";	lblType[43] 	= "Std"; lblSiz[43]	= "pt";
	lblLabel[44] 	= "Ceraunius Tholus";		lblCoords[44] 	= "N24 W097";	lblType[44] 	= "Std"; lblSiz[44]	= "pt";
	lblLabel[45] 	= "Kasei Marineris";		lblCoords[45] 	= "S12 W071";	lblType[45] 	= "Std"; lblSiz[45]	= "pt";
	lblLabel[46] 	= "Ares Vallis";			lblCoords[46] 	= "N10 W023";	lblType[46] 	= "Std"; lblSiz[46]	= "pt";
	lblLabel[47] 	= "Nirgal Vallis";			lblCoords[47] 	= "S28 W042";	lblType[47] 	= "Std"; lblSiz[47]	= "pt";
  
 	//map functions

	function labelMap(inLayer){
		for (lblNum=1; lblNum<=mapItems; lblNum++){
			fsize = "12";
			if (lblType[lblNum] == "Maj") { fsize = "16"; }
			fcolor = "White"
			if (lblType[lblNum] == "Spe") { fcolor = "Yellow"; }
			document.write('<div id="lbl' + lblNum + '" style="position: absolute; color : ' + fcolor + '; font-weight: bold; white-space:nowrap; font-size: ' +  fsize + ';">');
				if (lblSiz[lblNum]=="pt"){//for all but largest features, show arrow
					document.write('<img src="images/mars_atlas/arrow.gif" width="5" height="8" alt="" border="0">');
				}
				document.write(lblLabel[lblNum])
			document.write('</div>');
		}
	}
	
	function setMaps(){

			// calculate physical xy position on graphical map,
							
			//initiate values
			mapWddeg=Math.abs(mapW-mapE)//deg - width of map (in degrees)
			mapHtdeg=Math.abs(mapN-mapS)//deg - height of map (in degrees)
	
			for (lblNum=1; lblNum<=mapItems; lblNum++){
				//store value from lblCoords.js
				inCoords = lblCoords[lblNum];
				//break single input coord into N + W
				latitude = inCoords.slice(1,inCoords.indexOf(" "))
				if (inCoords.slice(0,1)=="S") {latitude = 0-latitude }
				hemi = inCoords.slice(inCoords.indexOf(" ")+1,inCoords.indexOf(" ")+2)
				longitude = inCoords.slice(inCoords.indexOf(" ")+2,inCoords.length);
				if ( hemi=="W"){ // if  W
					if (longitude > 179){ //account for data with W>180
						longitude = 360 - longitude;
						hemi="E"
					}
				} 
				if ( hemi=="E"){ // if  W
					longitude = 0-longitude;
				}
				//convert degrees/decimal into pixels
				coordHrz = (mapW - longitude) * (mapWd/mapWddeg);
				coordVrt = (mapN - latitude) * (mapHt/mapHtdeg);
				if (lblSiz[lblNum]=="pt") {
					coordHrz += 19;
					coordVrt -= 7;
				}
				else{
					coordHrz -= 40;
					coordVrt -= 7;
				}
				
				//move icon
				moveDivTo('lbl' + lblNum, coordHrz, coordVrt)
			}
	}


function moveDivTo(divID, x, y){
	if (document.all) {
		divStyleObj(divID).posLeft = x ;
		divStyleObj(divID).posTop = y ;		
	} else {
		divStyleObj(divID).left = x ;
		divStyleObj(divID).top = y ;
	}
}

function divObj(divID){
	if (document.all){
		return document.all[divID] ;
	}else{
		return document.layers[divID] ;
	}
}
	
function divStyleObj(divID){
	if (document.all){
		return document.all[divID].style ;
	}else{
		return document.layers[divID] ;
	}
}


function init(){
	reFocus();
	//lblToggle('on');
	//gridToggle('off');
	setMaps();
	//reFocus();
	createRequestObject();
	if (FORM_DATA['map'] == 'albedo') { btnAlb(); }
	if (FORM_DATA['map'] == 'relief') {btnRel(); } 
	if (FORM_DATA['map'] == 'altitude') {btnAlt(); }
	//if not specified, map defaults to relief
	if (FORM_DATA['grid'] == 'on') {gridToggle('on');}
	//if not specified, grid defaults to off
	if (FORM_DATA['hirez'] == 'on') {hirezToggle('on');}
	//if not specified, grid defaults to off
	if (FORM_DATA['labels'] == 'off') {lblToggle('off');}
	//if not specified, labels defaults to on
}
	
function btnAlb(){
	albToggle('on')
	altToggle('off')
	relToggle('off')
	reFocus()
}
function btnRel(){
	relToggle('on')
	altToggle('off')
	albToggle('off')
	reFocus()
}
function btnAlt(){
	altToggle('on')
	albToggle('off')
	relToggle('off')
	
	reFocus()
}
function btnGrid(){
	if (grid.style.visibility == 'visible'){ gridToggle('off') }
	else{ gridToggle('on') }
}
function btnLabels(){
	if (labels.style.visibility == 'visible'){ lblToggle('off') }
	else{ lblToggle('on') }
}
function btnHirez(){
	if (hirez.style.visibility == 'visible'){ hirezToggle('off') }
	else{ hirezToggle('on') }
}

function keyIn(e){
	oEvent = event;
       oElement = event.srcElement;
       iKeyVal = event.keyCode;
	if (iKeyVal==65 || iKeyVal==97){ btnAlb(); }
	if (iKeyVal==82 || iKeyVal==114){ btnRel(); }
	if (iKeyVal==84 || iKeyVal==116){ btnAlt(); }
	if (iKeyVal==71 || iKeyVal==103){ btnGrid(); }
	if (iKeyVal==76 || iKeyVal==108){ btnLabels(); }
	if (iKeyVal==90 || iKeyVal==122){ btnHirez(); }
}	

function albToggle(inState){
	if (inState=='on'){
		albedo.style.visibility = 'visible';
		ctrlPanel.rdoMap[0].checked = true;
	}
	else {
		albedo.style.visibility = 'hidden';
	}
}
function relToggle(inState){
	if (inState=='on'){
		relief.style.visibility = 'visible';
		ctrlPanel.rdoMap[1].checked = true;
	}
	else {
		relief.style.visibility = 'hidden';
	}
}
function altToggle(inState){
	if (inState=='on'){	
		altitude.style.visibility = 'visible';
		ctrlPanel.rdoMap[2].checked = true;
	}
	else {
		altitude.style.visibility = 'hidden';
	}
}
function gridToggle(inState){
	if (inState=='on'){
		grid.style.visibility = 'visible';
		ctrlPanel.chkGrid.checked = true;
	}
	else {
		grid.style.visibility = 'hidden';
		ctrlPanel.chkGrid.checked = false;
	}
}
function lblToggle(inState){
	if (inState=='on'){
		labels.style.visibility = 'visible';
		ctrlPanel.chkLabels.checked = true;
	}
	else {
		labels.style.visibility = 'hidden';
		ctrlPanel.chkLabels.checked = false;
	}
}
function hirezToggle(inState){
	if (inState=='on'){
		hirez.style.visibility = 'visible';
		ctrlPanel.chkHirez.checked = true;
		gridToggle('off');
		lblToggle('off');
	}
	else {
		hirez.style.visibility = 'hidden';
		ctrlPanel.chkHirez.checked = false;
	}
}

function tipsToggle(inState){
	if (inState=='show'){
		tips.style.visibility = 'visible';
	}
	else {
		tips.style.visibility = 'hidden';
	}
}

function showCoords(inState){
	tipsToggle('hide');
	if (inState){
		//alert();
		moveDivTo("coords", window.event.offsetX+10 , window.event.offsetY+18);
		//convert screen coords to degrees
		coordX = window.event.offsetX*((mapW-mapE)/mapWd)-mapW
		if (coordX <0) { coordX= Math.abs(coordX); coordX = "W" + coordX; }
		else{ coordX = "E" + coordX; }
		coordY = window.event.offsetY*((mapN-mapS)/mapHt)-mapN
		if (coordY <0) { coordY= Math.abs(coordY); coordY = "N" + coordY; }
		else{ coordY = "S" + coordY; }
		coords.innerHTML = coordX + " " + coordY;
		coords.style.visibility = 'visible';
	}
	else{
		coords.style.visibility = 'hidden';
	}
}

function reFocus(){	document.focus(); }





function createRequestObject() { 

  FORM_DATA = new Object(); 
    // The Object ("Array") where our data will be stored. 

  separator = ','; 
    // The token used to separate data from multi-select inputs 

  query = '' + this.location; 
  qu = query 
    // Get the current URL so we can parse out the data. 
    // Adding a null-string '' forces an implicit type cast 
    // from property to string, for NS2 compatibility. 

  query = query.substring((query.indexOf('?')) + 1); 
    // Keep everything after the question mark '?'. 

  if (query.length < 1) { return false; }  // Perhaps we got some bad data? 

  keypairs = new Object(); 
  numKP = 1; 
    // Local vars used to store and keep track of name/value pairs 
    // as we parse them back into a usable form. 

  while (query.indexOf('&') > -1) { 
    keypairs[numKP] = query.substring(0,query.indexOf('&')); 
    query = query.substring((query.indexOf('&')) + 1); 
    numKP++; 
      // Split the query string at each '&', storing the left-hand side 
      // of the split in a new keypairs[] holder, and chopping the query 
      // so that it gets the value of the right-hand string. 
  } 

  keypairs[numKP] = query; 
    // Store what's left in the query string as the final keypairs[] data. 

  for (i in keypairs) { 
    keyName = keypairs[i].substring(0,keypairs[i].indexOf('=')); 
      // Left of '=' is name. 
    keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1); 
      // Right of '=' is value. 
    while (keyValue.indexOf('+') > -1) { 
      keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1); 
        // Replace each '+' in data string with a space. 
    } 

    keyValue = unescape(keyValue); 
      // Unescape non-alphanumerics 

    if (FORM_DATA[keyName]) { 
      FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue; 
        // Object already exists, it is probably a multi-select input, 
        // and we need to generate a separator-delimited string 
        // by appending to what we already have stored. 
    } else { 
      FORM_DATA[keyName] = keyValue; 
        // Normal case: name gets value. 
    } 
  } 

  return FORM_DATA; 
} 

  // This is the array/object containing the GET data. 
  // Retrieve information with 'FORM_DATA [ key ] = value'. 
  

// --> 


