// aimsCustom.js
/*
*  JavaScript template file for ArcIMS HTML Viewer
*		dependent on aimsXML.js, ArcIMSparam.js, aimsCommon.js, aimsMap.js,
*		aimsLayers.js, aimsDHTML.js
*		aimsClick.js, aimsNavigation.js,
*/

// global variables
	aimsCustomPresent=false;
	// change these to send XML response to custom function.
	// use numbers >= 1000 and match in useCustomFunction()
	// defaults are defined in aimsXML.js and use standard functions
	
	// xml response mode for selection
	selectXMLMode = 6;
	// xml response mode for identify
	identifyXMLMode = 7;
	// xml response mode for query
	queryXMLMode = 8;
	// xml response mode for find
	findXMLMode = 14;
	// xml response mode hyperlink
	hyperlinkXMLMode = 15;




// custom function for handling clicks 
// 		flow redirected here when
//		toolMode set to >=1000
function customMapTool(e) {
				if (toolMode == 1001) {
						// insert code here
						return false;
					
				}
				if (toolMode == 1002) {
						// insert code here

				}

}

// send  XML response to custom function
//		flow  redirected here when
//		XMLMode >=1000
function useCustomFunction(theReply) {

	if (XMLMode==1001) {
		// insert code here

	} else if (XMLMode==1002) {
		// insert code here
	} else {
		alert(msgList[55] + XMLMode + msgList[56]);
	}
	hideLayer("LoadData");
}

// add custom stuff to Map XML request. . . between selection and geocode
function addCustomToMap1(){
	var customString = "";
		customString += '<LAYER type="image" name="Bodega Bay Quad" visible="true" id="49">\n';
		customString += '<DATASET name="BodegaBay.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Cambria Quad" visible="true" id="50">\n';
		customString += '<DATASET name="Cambria.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Cape Mendocino Quad" visible="true" id="51">\n';
		customString += '<DATASET name="Capemendocino.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Coalinga Quad" visible="true" id="52">\n';
		customString += '<DATASET name="Coalinga.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Covelo Quad" visible="true" id="53">\n';
		customString += '<DATASET name="Covelo.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Garberville Quad" visible="true" id="54">\n';
		customString += '<DATASET name="Garberville.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Healdsburg Quad" visible="true" id="55">\n';
		customString += '<DATASET name="Healdsburg.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Lakeport Quad" visible="true" id="56">\n';
		customString += '<DATASET name="Lakeport.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Lodi Quad" visible="true" id="57">\n';
		customString += '<DATASET name="Lodi.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Monterey Quad" visible="true" id="58">\n';
		customString += '<DATASET name="Monterey.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Napa Quad" visible="true" id="59">\n';
		customString += '<DATASET name="Napa.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Palo Alto Quad" visible="true" id="60">\n';
		customString += '<DATASET name="Paloalto.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Paso Robles Quad" visible="true" id="61">\n';
		customString += '<DATASET name="Pasorobles.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Point Arena Quad" visible="true" id="62">\n';
		customString += '<DATASET name="Pointarena.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Point Sur Quad" visible="true" id="63">\n';
		customString += '<DATASET name="Pointsur.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Red Bluff Quad" visible="true" id="64">\n';
		customString += '<DATASET name="Redbluff.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Sacramento Quad" visible="true" id="65">\n';
		customString += '<DATASET name="Sacramento.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="San Francisco Quad" visible="true" id="66">\n';
		customString += '<DATASET name="Sanfrancisco.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="San Jose Quad" visible="true" id="67">\n';
		customString += '<DATASET name="Sanjose.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Stockton Quad" visible="true" id="68">\n';
		customString += '<DATASET name="Stockton.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Ukiah Quad" visible="true" id="69">\n';
		customString += '<DATASET name="Ukiah.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="image" name="Willows Quad" visible="true" id="70">\n';
		customString += '<DATASET name="Willows.tif" type="image" workspace="jai_ws-0" />\n';
		customString += '<IMAGEPROPERTIES transcolor="255,255,255" />\n';
		customString += '</LAYER>\n';
		customString += '<LAYER type="featureclass" name="Water" visible="true" id="71">\n';
		customString += '<DATASET name="water" type="polygon" workspace="shp_ws-34" />\n';
		customString += '<SIMPLERENDERER>\n';
		customString += '<SIMPLEPOLYGONSYMBOL fillcolor="156,203,255" boundary="false" />\n';
		customString += '</SIMPLERENDERER>\n';
		customString += '</LAYER>\n';
	return customString;
}

// add custom stuff to Map XML request. . . between clickpoints and copyright
function addCustomToMap2(){
	var customString = "";

	return customString;
}

// add custom stuff to Map XML request. . . under modeOnMap
function addCustomToMap3(){
	var customString = "";
		/*
		customString += '<LAYER type="ACETATE" name="theMode">\n';
		customString += '<OBJECT units="PIXEL">\n<TEXT coord="5,' + (iHeight-10) + '" label="This is a test">\n';
		customString += '<TEXTMARKERSYMBOL fontstyle="BOLD" fontsize="12" font="ARIAL" fontcolor="' + modeMapColor + '" ';
		customString += 'threed="TRUE" glowing="' + modeMapGlow + '" />\n</TEXT>\n</OBJECT>';
		customString += '\n</LAYER>\n';
		alert(customString);
		*/
	return customString;
}

// add custom stuff to Map XML request. . . on top of everything
function addCustomToMap4(){
	var customString = "";

	return customString;
}

// extract layers to download
function extractIt() {
	hideLayer("measureBox");
	alert(msgList[51]);
}

