// aimsOptions.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
*/

aimsOptionsPresent=true;

var setSelectPointMargin=false;

var setShowXYs=false;
var setListAllLayers=false;
var setPanFactor=false;
//zoom factors for v.3
var zoomFactor = 2
var setZoomFactor=false;
var setPixelTolerance=false;
var setMapColor=false;
var setZoomBoxColor=false;
var setSelectColor=false;
var setNorthArrowType = false;
var setDecimals=false;
// default selection color when reset to default
var defaultSelectColor="255,255,0"
// color of highlighted feature in decimal RGB format
var setHighlightColor=false;
// default highlight color when reset to default
var defaultHightlightColor="255,0,0"



// write out option form
function writeOptionForm() {
	//if ((allowOptions) && (parent.QueryFrame!=null)) {
	if (allowOptions){
		//parent.TextFrame.document.open();
		var Win1;
		if ((useExternalWindow) || (!useQueryFrame)) {
			Win1 = window.open("","OptionWindow","width=575,height=200,scrollbars=yes,resizable=yes");
		} else {
			Win1 = parent.QueryFrame;
			Win1.document.open();
		}
		Win1.document.writeln('<html><meta http-equiv="Content-Type" content="text/html; charset=' + charSet + '"><head><title>Options Menu</title>');
		Win1.document.write('<scri');
		Win1.document.writeln('pt language="javascript">');
		Win1.document.writeln('function setOption() {');
		Win1.document.writeln('var theForm = document.forms[0];');
		Win1.document.writeln('var theIndex = theForm.theOptions.selectedIndex;');
		Win1.document.writeln('var theURL = theForm.theOptions.options[theIndex].value;');
		Win1.document.writeln('document.location = "' + appDir + '" + theURL;');
		Win1.document.writeln('}');
		Win1.document.write('</scri');
		Win1.document.writeln('pt>');
		Win1.document.writeln('</head>');
		Win1.document.writeln('<body bgcolor="black" topmargin=0 leftmargin=0 rightmargin=0 text="White" onload="window.focus()">');
		Win1.document.writeln('<div align="center"><form>');
		Win1.document.writeln('<table width=100% cellpadding="2" cellspacing="0">');
		Win1.document.writeln('	<tr><td bgcolor="black" align="center"><font face="Arial" size="-1"><b>Options</b></font></td></tr>');
		Win1.document.writeln(' <tr><td><br></td></tr>');
		Win1.document.writeln(' <tr><td align="center">');
		Win1.document.writeln(' <select name="theOptions">');
		//if (setMapUnits) {
		//	Win1.document.writeln('<option value="setUnits.htm?optionForm=true">Map and Display Units');
		//}
		if (setWMS) {
			Win1.document.writeln('<option value="../common/setWMS.htm">Set WMS Capabilities');
		}
				
		if ((setWMSBGnd)&&(enableWMS)) {
			Win1.document.writeln('<option value="../common/setWMSBGnd.htm">Set WMS Bacground Level');
		}

		if (setDebug) {
			Win1.document.writeln('<option value="../common/setDebug.htm">Set Debug Level');
		}

		if (setFancyTable) {
			Win1.document.writeln('<option value="../common/setFancyTable.htm">Set Query Table Format');
		}

		if (setSelectPointMargin) {
			Win1.document.writeln('<option value="../common/setZoomMargin.htm">Zoom to Point Extent');
		}
		if (setPanFactor) {
			Win1.document.writeln('<option value="../common/setPan.htm">Arrow Button Pan Distance');
		}
		if (setPixelTolerance) {
			Win1.document.writeln('<option value="../common/setPixelTolerance.htm">Search Tolerance');
		}
		if (setListAllLayers) {
			Win1.document.writeln('<option value="../common/setLayerList.htm">LayerList Style');
		}
		if (setShowXYs) {
			Win1.document.writeln('<option value="../common/setXYDisplay.htm">Display Map Coordinates');
		}
		if (setDecimals) {
			Win1.document.writeln('<option value="../common/setDecimals.htm">Number of Decimals');
		}
		if (setMapColor) {
			Win1.document.writeln('<option value="../common/setMapColors.htm">Map Background Color');
		}
		if (setSelectColor) {
			Win1.document.writeln('<option value="../common/setSelectColor.htm">Select Color');
		}
		if (setHighlightColor) {
			Win1.document.writeln('<option value="../common/setHighlightColor.htm">Highlight Color');
		}
		//if (!isNav5up) {
			if (setZoomBoxColor) {
				Win1.document.writeln('<option value="../common/setZoomBoxColor.htm">ZoomBox Color');
			}
		//}
		if (setNorthArrowType) {
			Win1.document.writeln('<option value="../common/setNorthArrowType.htm">Set North Arrow Type');
		}
		Win1.document.writeln('</select>');
		Win1.document.writeln('</td></tr>');
		Win1.document.writeln('<tr><td><br></td></tr>');
		Win1.document.writeln(' <tr align="center"><td>');
		Win1.document.writeln('&nbsp;<input type=button value="Set Option" onclick="setOption()">');
		if (useExternalWindow) 
			Win1.document.writeln('&nbsp;<input type=button value="Close Window" onclick="window.close()">');
		else 
			Win1.document.writeln('&nbsp;<input type=button value="Close Menu" onclick="document.location=\'' + appDir + 'SubMenu.htm\'">');
		Win1.document.writeln('</td>');
		Win1.document.writeln('</tr></table>');
		Win1.document.writeln('<font face="Arial" size="-1">Select the Option to change and click on Set.</font>');
		Win1.document.writeln('<br>');
		Win1.document.writeln('</div></body></html>');
		Win1.document.close();
		Win1=null;

	} else {
		alert("Cannot set options.");
	}
}

