Err... Of course I forgot to attach it.

Sorry about that,
Kim
<search function="moonview">
  <name>Moon Viewer</name>
  <category>Reference<category>General</category></category>
  <contributor>Gregory Krohne</contributor>
  <link>http://www.fourmilab.ch/cgi-bin/uncgi/Earth/action?opt=-m&amp;img=MoonTopo.evif</link>
  <email>[EMAIL PROTECTED]</email>
  <description>
  View the Moon from Earth, the Sun, a named location, a given latitude and longitude, or your house. 
	See the moon on the night side, as a map, or in blue/white albedo.
	Use /popup mode to display the image in a popup window. Add your latitude/longitude coordinates to localprefs.js (user_lat, user_lon) to use
	that location with /me.
    <div class="helpboxDescLabels">Switches:</div>
    <table class="helpboxDescTable">
      <tr><td>/latitude</td><td> - </td><td>degrees, minutes, seconds</td></tr>
      <tr><td>/longitude</td><td> - </td><td>or decimal form</td></tr>
      <tr><td>/north|south</td><td> - </td><td>latitude direction</td></tr>
      <tr><td>/east|west</td><td> - </td><td>longitude direction</td></tr>
      <tr><td>/altitude</td><td> - </td><td>in kilometers</td></tr>
      <tr><td>/from:Earth|Sun|night_side</td><td> - </td><td>defaults to Earth</td></tr>
      <tr><td>/map</td><td> - </td><td>as a rectangular map</td></tr>
      <tr><td>/topography|albedo</td><td> - </td><td>defaults to topography</td></tr>
      <tr><td>/date|universal:[date,time]</td><td> - </td><td>date/time in universal format; defaults to now</td></tr>
      <tr><td>/julian:number</td><td> - </td><td>date/time in Julian format</td></tr>
      <tr><td>/image|size</td><td> - </td><td>Image width/height in pixels</td></tr>
      <tr><td>/no_night</td><td> - </td><td>Always looks "full"</td></tr>
      <tr><td>/city|location</td><td> - </td><td>A nearby city, instead of lat/lon</td></tr>
      <tr><td>/quick|me</td><td> - </td><td>Use my coordinates or zip code from localprefs.js.</td></tr>
      <tr><td>/popup</td><td> - </td><td>Just the image in its own popup window.</td></tr>
    </table>
    <div class="helpboxDescLabels">Examples:</div>
    <table class="helpboxDescTable">
      <tr><td>moonview 90 0</td></tr>
      <tr><td> - at the south pole, right now</td></tr>
      <tr><td>moonview /lat:21d18m21s /north /lon:157d51m36s /west</td></tr>
      <tr><td> - Hololulu, Hawaii</td></tr>
      <tr><td>moonview /city:Paris /date:[2000-01-01,00:00:00]</td></tr>
      <tr><td> - Paris at the turn of the century</td></tr>
      <tr><td>moonview /size:1024 /albedo</td></tr>
      <tr><td> - large blue/white image</td></tr>
      <tr><td>moonview /me /popup</td></tr>
      <tr><td> - view from your location (if you set it!) in a popup</td></tr>
    </table>
  </description>
  <form name="moonviewf"
        method="post"
        action="http://www.fourmilab.ch/cgi-bin/uncgi/Earth";>
    <input type="hidden" name="lat" value="" />
    <input type="hidden" name="ns" value="" />
    <input type="hidden" name="lon" value="" />
    <input type="hidden" name="ew" value="" />
    <input type="hidden" name="alt" value="" />
    <input type="hidden" name="img" value="MoonTopo.evif" />
    <input type="hidden" name="utc" value="2000-01-01 0:00:00" />
    <input type="hidden" name="jd" value="2451544.50000" />
    <input type="hidden" name="imgsize" value="320" />
    <input type="hidden" name="daynight" value="" />
    <input type="hidden" name="opt" value="" />
    <input type="hidden" name="date" value="" />
  </form>
  <script><![CDATA[
    function moonview(q)
    {
      if( nullArgs("moonview", q) )
        return;
			
			var gotCity = false;
			var quick = false;
			var popup = false;
			
			// Set date/time to now, by default
			document.moonviewf.date.value = "0";
			
      // Parse switches with parseArgs:
      var args = parseArgs(q, "latitude, longitude, north, south, east, west, altitude, from, map, topography, albedo, now, julian, universal, date, image, size, no_night, quick, me, popup, city, location");
      for (var iSwitch = 0; iSwitch < args.switches.length; iSwitch++)
      {
        switch( args.switches[iSwitch].name )
        {
          case "latitude":
						document.moonviewf.opt.value = "-l";
						document.moonviewf.lat.value = args.switches[iSwitch].value;
            break;
          case "longitude":
						document.moonviewf.opt.value = "-l";
						document.moonviewf.lon.value = args.switches[iSwitch].value;
            break;
          case "north":
						document.moonviewf.ns.value = "North";
            break;
          case "south":
						document.moonviewf.ns.value = "South";
            break;
          case "east":
						document.moonviewf.ew.value = "East";
            break;
          case "west":
						document.moonviewf.ew.value = "West";
            break;
          case "altitude":
						document.moonviewf.alt.value = args.switches[iSwitch].value;
            break;
          case "from":
						switch ( args.switches[iSwitch].value.toLowerCase() )
						{
							case "earth":
							case "e":
								document.moonviewf.opt.value = "-m";
								break;
							case "sun":
							case "s":
								document.moonviewf.opt.value = "-s";
								break;								
							case "night_side":
							case "night":
							case "n":
								document.moonviewf.opt.value = "-n";
								break;
							default:
								alert( "I can't find this viewing point: [" + args.switches[iSwitch].value + "]");
								break;
						}
            break;
          case "map":
						document.moonviewf.opt.value = "-p";
            break;
          case "topography":
						document.moonviewf.img.value = "MoonTopo.evif";
            break;
          case "albedo":
						document.moonviewf.img.value = "Moon.evif";
            break;
          case "julian":
						document.moonviewf.date.value = "2";
						document.moonviewf.jd.value = args.switches[iSwitch].value;
            break;
					case "now":
						document.moonviewf.date.value = "0";
						break;
          case "universal":
          case "date":
						// Parse out the date/time portion, however it was enclosed
						var pattern = /\d+[\/-]\d+[\/-]\d+/;
						var result = args.switches[iSwitch].value.match(pattern);
						if (result != null) {
							document.moonviewf.utc.value = result[0];
							pattern = /\d+:\d+[:\d+]?/;
							result = args.switches[iSwitch].value.match(pattern);
							if (result != null)
								document.moonviewf.utc.value += " " + result[0];
							document.moonviewf.date.value = "1";
						}
            break;
          case "image":
          case "size":
						document.moonviewf.imgsize.value = args.switches[iSwitch].value;
            break;
          case "no_night":
						document.moonviewf.daynight.value = "-d";
            break;
					case "quick":
					case "me":
						quick = true;
						break;
          case "popup":
						popup = true;
            break;
          case "city":
          case "location":
						gotCity = findCity( args.switches[iSwitch].value );
            break;
          default:
            break;
        }
      }
			
			if (args.q) {
				var parsed = args.q.split(/ /);
				document.moonviewf.opt.value = "-l";
				document.moonviewf.lat.value = parsed[0];
				document.moonviewf.lon.value = parsed[1];
			}
			
			if (quick )
				getMyLocation();
			
      if ( popup )
				doPopup();
			else
				submitForm(moonviewf);
    }
		
		function findCity(strCity) {
			
			var citiesURL = "http://www.fourmilab.ch/yoursky/cities.html";;
			
			// get the target city from the list
			var citiesXmlHttp = new ActiveXObject("Microsoft.XmlHttp");
			citiesXmlHttp.open("GET", citiesURL, false);
			citiesXmlHttp.send();
			
			var citiesBody = citiesXmlHttp.responseText;
			
			// parse out the city we want
			var cityRegExp = new RegExp(
					'<a href\\="\\/cgi\\-bin\\/uncgi\\/Yoursky\\?z\\=1\\&lat\\=(.*)\\&ns\\=(North|South)\\&lon\\=(.*)\\&ew\\=(East|West)">'
					+ '\\n?.*'
					+ strCity
					+ '.*'
					+ '<\\/a>', "i");
			var cityResult = cityRegExp.exec(citiesBody);
			if ( cityResult != null ) {
				document.moonviewf.opt.value = "-l";
				document.moonviewf.lat.value = cityResult[1];
				document.moonviewf.ns.value = cityResult[2];
				document.moonviewf.lon.value = cityResult[3];						
				document.moonviewf.ew.value = cityResult[4];
				return true;
			} else {
				alert("City [" + strCity + "] not found");
			}
			
			return false;
		}
		

		function doPopup() {
			// Build up the image URL
			// http://www.fourmilab.ch/cgi-bin/uncgi/Earth/action?opt=-m&img=MoonTopo.evif
			var strURL="http://www.fourmilab.ch/cgi-bin/uncgi/Earth/action";;
			if ( document.moonviewf.opt )
				strURL += "?opt=" + document.moonviewf.opt.value;
			else
				strURL += "?opt=" + document.moonviewf.opt.value;
			if ( document.moonviewf.lat.value != "" )
				strURL += "&lat=" + document.moonviewf.lat.value;
			if ( document.moonviewf.lon.value != "" )
				strURL += "&lon=" + document.moonviewf.lon.value;
			if ( document.moonviewf.ns.value != "" )
				strURL += "&ns=" + document.moonviewf.ns.value;
			if ( document.moonviewf.ew.value != "" )
				strURL += "&ew=" + document.moonviewf.ew.value;
			strURL += "&img=MoonTopo.evif";
				
			// Fetch the web page containing the image
			// This code block is from comx.xml
			var xmlHttp = new ActiveXObject("Microsoft.XmlHttp");
			xmlHttp.open("GET", strURL, false);
			xmlHttp.send();
			
			//get the response content from the remote site
			var strBody = xmlHttp.responseText;
			
			// parse out the image URL and size
			/*
			<img src="/earthview/cache/9985.jpg" ismap usemap="#zoommap" width=320 height=320>
			*/
			var objRegExp = new RegExp('<img src=.*?>', "i");
			var aResult = objRegExp.exec( strBody );
			var sTag = aResult[0];
			imgURL = sTag.match(/earthview\/cache\/\d+\.jpg/);
			var imgURL = "http://www.fourmilab.ch/"; + imgURL;
			aResult = sTag.match(/width=(\d+)/);
			var size = aResult[1];
			
      // make sure the popup height isnt larger than the display screen (like nonsequitur)
      var size = size > window.screen.availheight-38 ? window.screen.availheight-38 : size;
			if (imgURL != ""){
				var popupBodyCode = "<html><head></head><body><style>" + convertStylesToInline() + "img {vertical-align:top;text-align:left;}</style>";
				popupBodyCode += "<img src=" +imgURL +" width="+size+" height="+size+" border=0 alt=\"Moon View\" onclick='self.close()'; galleryimg='no' />";
				popupBodyCode += "</body></html>";
				var top=((screen.availheight-size)-38);
				var left=((screen.width-size)-10);
				popupImage = window.open('','_blank','toolbar=0,status=0,titlebar=0,location=0,directories=0,menuBar=0,scrollbars=auto,resizable=1,left='+left+',top='+top);
				popupImage.document.open();
				popupImage.document.write(popupBodyCode);
				popupImage.document.close();
				popupImage.document.title="Moon View";
				// The original numbers are correct for the interior window dimensions,
				// but we have to expand the window a little to account for borders,
				// title bar, and such.
				// These numbers where chosen empirically, so they may not look correct
				// on other desktops
				var windowW = Number(size) + 9;
				var windowH = Number(size) + 34;
				popupImage.resizeTo(windowW, windowH);
			}//if imgurl   
		}
		
		function getMyLocation() {
			
			// If the user has provided coordinates, just use them
			if ( typeof user_lat != "undefined" && user_lat != ""
				&& typeof user_lon != "undefined" && user_lon != "" ) {
				
				document.moonviewf.lat.value = user_lat;
				document.moonviewf.lon.value = user_lon;
				document.moonviewf.opt.value = "-l";

				return true;				
			}
			
			// See if the user gave us a zip code
			if (typeof user_zip != "undefined" && user_zip != "") {
				var strURL = "http://zipinfo.com/cgi-local/zipsrch.exe?ll=ll&zip="; + user_zip + "&Go=Go"

				var xmlHttp = new ActiveXObject("Microsoft.XmlHttp");
        xmlHttp.open("GET", strURL, false);
        xmlHttp.send();
				var strBody = xmlHttp.responseText;
				// <td align=center>30332</font></td><td align=center>33.7759</font></td><td align=center>84.3927</font></td></tr>
				var objRegExp = new RegExp('<td align=center>' + user_zip + '.*?</tr>', "i");
				var sRow = objRegExp.exec( strBody )[0];
				var aResult = sRow.match(/\d+\.\d+/g);

				document.moonviewf.opt.value = "-l";
				document.moonviewf.lat.value = aResult[0];
				document.moonviewf.lon.value = aResult[1];
				return true;
			}

			return false;
		}
  ]]></script>
  <copyright>
    The following applies if this file is included and distributed with Dave's Quick Search Deskbar:
    Copyright (c) 2002 David Bau; Distributed under the terms of the GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  </copyright>
  <created_by>
    This search file was initially created on 08/23/04 at 08:07:12
    by Dave's Quick Search Deskbar Search Wizard version 1.3,
    Copyright (c) 2002 Glenn Carr; Distributed under the terms of the GNU General Public License, Version 2
  </created_by>
</search>

Reply via email to