// *********************************************************
  function ZoomToFull() {
    document.frmNavigation.Cmd.value = 'ZOOMFULL';
    document.frmNavigation.target="";
    document.frmNavigation.action = sApplication;
	document.frmNavigation.submit();
  }


  function ActivateLandmark() {
    document.frmNavigation.Cmd.value = 'SNAPSHOT';
    document.frmNavigation.ShowWhat.value = 'LANDMARK';
    document.frmNavigation.target="";
    document.frmNavigation.action = sApplication;
	document.frmNavigation.submit();
  }
  
  function ActivateOrtho(imgPrefix) {
//	Used by SingleClick Client except Basic Viewer
//	imgPrefix is optional... used by Chameleon Interface
	if (imgPrefix == null) {
		imgPrefix = "";
	}	
	    document.frmNavigation.Cmd.value = 'ORTHO';
	    if (document.frmNavigation.Orthophoto.value == 'YES') {
	    document.frmNavigation.Orthophoto.value = "";
	    } else {
	    document.frmNavigation.Orthophoto.value = 'YES';
	    }
	    
	    document.frmNavigation.target="";
	    document.frmNavigation.action = sApplication;
		showLayer("loadLayer");
		document.frmNavigation.submit();
}
// *********************************************************

  function ActivateZoomIn(imgPrefix) {
  //Used by SingleClick Client except Basic Viewer
  //imgPrefix is optional... used by Chameleon Interface
	if (imgPrefix == null) {
		imgPrefix = "";
		}	
    setToolImage('ZOOMIN','2',imgPrefix); 
    document.frmNavigation.Cmd.value = 'ZOOMIN';
    document.frmNavigation.target="";
    document.frmNavigation.action = sApplication;
  }
  
  function ActivateZoomOut(imgPrefix) {
  //Used by SingleClick Client except Basic Viewer
  //imgPrefix is optional... used by Chameleon Interface
	if (imgPrefix == null) {
		imgPrefix = "";
		}	
    setToolImage('ZOOMOUT','2',imgPrefix); 
    document.frmNavigation.Cmd.value = 'ZOOMOUT';
    document.frmNavigation.target="";
    document.frmNavigation.action = sApplication;
  }
  
  function ActivatePan(imgPrefix) {
  //Used by SingleClick Client except Basic Viewer
  //imgPrefix is optional... used by Chameleon Interface
	if (imgPrefix == null) {
		imgPrefix = "";
		}	
    setToolImage('PAN','2',imgPrefix); 
    document.frmNavigation.Cmd.value = 'PAN';
    document.frmNavigation.target="";
    document.frmNavigation.action = sApplication;
  }
  
  function ActivateIdentify(targetwin,imgPrefix) {
  //Used by SingleClick Client except Basic Viewer
  //imgPrefix is optional... used by Chameleon Interface
	if (imgPrefix == null) {
		imgPrefix = "";
		}	
    setToolImage('IDENTIFY','2',imgPrefix); 
    document.frmNavigation.Cmd.value = 'IDENTIFY';
    document.frmNavigation.target = "";
    document.frmNavigation.action = sApplication;	
  }
  
function PopOut(sURL,sTitle,iHeight,iWidth,ynScroll,ynResize) {
	var objWin;
	objWin = window.open(sURL, sTitle, "height="+iHeight+",width="+iWidth+",scrollbars="+ynScroll+",resizeable="+ynResize+"");
	if (parseInt(navigator.appVersion) >=4) objWin.window.focus();
}

function PopOut2(sURL,sTitle,ynScroll,ynResize) {
	var objWin2;
	objWin2 = window.open(sURL, sTitle, "scrollbars="+ynScroll+",resizeable="+ynResize+"");
	if (parseInt(navigator.appVersion) >=4) objWin2.window.focus();
}

// show help
function showHelp(sURL){
	if (typeof helpWin == 'undefined'){
		helpWin = window.open(sURL, "Help", "width=700,height=500,toolbar=0,menubar=0,scrollbars=1,resizable=1,left=340,top=0");
		helpWin.opener = self;
	} else {
		if (helpWin.closed){
			helpWin = window.open(sURL, "Help", "width=700,height=500,toolbar=0,menubar=0,scrollbars=1,resizable=1,left=340,top=0");
			helpWin.opener = self;
		} else {			
			helpWin.focus();
		}
	}
}


// Show Detail
//function ShowDetail(sURL) {
//  var detailWin;
//  detailWin = window.open(sURL, "Detail", "width=700,height=500,toolbar=0,menubar=0,scrollbars=1,resizable=1,left=340,top=0");
//}

function ShowDetail(reefsite) {
    document.frmNavigation.reefsite.value = reefsite;
	document.frmNavigation.action = "reefsite_detail.asp";
	document.frmNavigation.target = "_blank";
	document.frmNavigation.submit();
}

function ShowAllDetail(reeftype, reefdepth) {
    document.frmNavigation.reeftype.value = reeftype;
    document.frmNavigation.reefdepth.value = reefdepth;
	document.frmNavigation.action = "Allreef_detail.asp";
	document.frmNavigation.target = "_blank";
	document.frmNavigation.submit();
}

// Show Picture Detail
function showCaseDetails(s){
  win = window.open("sex_detail.asp?case="+s, "Case", "width=250,height=300,scrollbars=1,resizable=1,toolbar=0,menubar=1");
}

function setToolImage(tool, mode, prefix) {

	//Used by Graphical Button Clients.
	//prefix is an optional argument to the image file name.
	if (prefix == null) {
		prefix = "";
		}
	var imageFile = 'images/' + prefix + tool + mode + '.gif';	

	// Dull all images first.
	document.ZOOMIN.src = 'images/'+ prefix +'zoomin1.gif';
	document.ZOOMOUT.src = 'images/'+ prefix +'zoomout1.gif';
	document.PAN.src = 'images/'+ prefix +'pan1.gif';
	document.IDENTIFY.src = 'images/'+ prefix +'identify1.gif';

	//Then brighten the passed tool.
	if (tool == "ZOOMIN") {
		document.ZOOMIN.src = imageFile;
		document.B_ACTIVETOOL.src = 'images/'+ 'at_zoomin2.gif';
		}
	if (tool == "ZOOMOUT") {
		document.ZOOMOUT.src = imageFile;
		document.B_ACTIVETOOL.src = 'images/'+ 'at_zoomout2.gif';
		}
	if (tool == "PAN") {
		document.PAN.src = imageFile;
		document.B_ACTIVETOOL.src = 'images/'+ 'at_pan2.gif';
		}
	if (tool == "IDENTIFY") {
		document.IDENTIFY.src = imageFile;
		document.B_ACTIVETOOL.src = 'images/'+ 'at_identify2.gif';
		}
}

if (document.images) {
	locate_1 = new Image();
	locate_1.src = "images/locate_1.gif";
	locate_2 = new Image();
	locate_2.src = "images/locate_2.gif";

	RefreshMap_1 = new Image();
	RefreshMap_1.src = "images/RefreshMap_1.gif";
	RefreshMap_2 = new Image();
	RefreshMap_2.src = "images/RefreshMap_2.gif";
	
	AdvSearch_1 = new Image();
	AdvSearch_1.src = "images/AdvSearch_1.gif";
	AdvSearch_2 = new Image();
	AdvSearch_2.src = "images/AdvSearch_2.gif";
}

function swap(OBJ, newImg) {
	if (document.images){
		if (document.images) document[OBJ].src = eval(newImg + ".src");
	}
}

function showApp(theApp) {

var QS

	if(theApp == "propmap"){
		showLayer("loadLayer");

		QS = "?Cmd=ZOOMIN"
		
		QS = QS + "&MinX=" + document.frmNavigation.MinX.value;
		QS = QS + "&MaxX=" + document.frmNavigation.MaxX.value;
		QS = QS + "&MinY=" + document.frmNavigation.MinY.value;
		QS = QS + "&MaxY=" + document.frmNavigation.MaxY.value;

//		theMapURL = "http://S0140103/website/myneighborhood/presentation/simplyred/"+theApp+".asp?Cmd=ZOOMIN&MinX="+theMinX+"&MinY="+theMinY+"&MaxX="+theMaxX+"&MaxY="+theMaxY;
//		theMapURL = "http://s0140103/propsearch/propmap.asp";
		theMapURL = "http://s0140103/propsearch/"+theApp+".asp"+QS;
		document.location = theMapURL;
	} else {

		showLayer("loadLayer");
		
		QS = "?Cmd=INIT"

		QS = QS + "&ExtentLeft=" + document.frmNavigation.MinX.value;
		QS = QS + "&ExtentRight=" + document.frmNavigation.MaxX.value;
		QS = QS + "&ExtentBottom=" + document.frmNavigation.MinY.value;
		QS = QS + "&ExtentTop=" + document.frmNavigation.MaxY.value;

		if (!document.frmNavigation.GeocodeLabel.value == "") {
			QS = QS + "&GeoLabelFlag=" + escape(document.frmNavigation.GeoLabelFlag.value);
			QS = QS + "&GeocodeLabel=" + escape(document.frmNavigation.GeocodeLabel.value);
			QS = QS + "&GeocodePoint_X=" + escape(document.frmNavigation.GeocodePoint_X.value);
			QS = QS + "&GeocodePoint_Y=" + escape(document.frmNavigation.GeocodePoint_Y.value);
		}

		QS = QS + "&HN1="  + escape(document.frmNavigation.HN1.value);
		QS = QS + "&Dir1=" + escape(document.frmNavigation.Dir1.value);
		QS = QS + "&StN1=" + escape(document.frmNavigation.StN1.value);
		QS = QS + "&StT1=" + escape(document.frmNavigation.StT1.value);
		QS = QS + "&ZC1=" + escape(document.frmNavigation.ZC1.value);
		
		QS = QS + "&LM=" + escape(document.frmNavigation.LM.value);
		
		QS = QS + "&IDir1=" + escape(document.frmNavigation.IDir1.value);
		QS = QS + "&IStN1=" + escape(document.frmNavigation.IStN1.value);
		QS = QS + "&IStT1=" + escape(document.frmNavigation.IStT1.value);
		
		QS = QS + "&IDir2=" + escape(document.frmNavigation.IDir2.value);
		QS = QS + "&IStN2=" + escape(document.frmNavigation.IStN2.value);
		QS = QS + "&IStT2=" + escape(document.frmNavigation.IStT2.value);

		var url
	//	url = "http://alboj001/MyNeighborhood3_IN46/presentation/Simplyred/"
	//	url = url + name + ".asp" + QS;
		url = theApp + ".asp" + QS;
		document.location = url;
	}
}

