<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs
    title="Solar System"
    title_url="http://chronita.com/solar_system/"
    height="320"
    directory_title="Solar System"
    description="animated display of the relative positions of planets"
    screenshot="http://chronita.com/images/scr-solar.png"
    thumbnail="http://chronita.com/images/scr-solar-thm.png"
    author="Michael"
    author_email="mt1955@gmail.com"
    author_affiliation="Echo3 Online Services, LLC"
    author_photo="http://echo3.net/images/echo3.gif"
    author_link="http://chronita.com/google_gadgets/"
  >
<Require feature="views" />
<Require feature="analytics" />
</ModulePrefs>
<UserPref name="fx" display_name="Function" datatype="enum" default_value="help">
  <EnumValue value = "help" display_value="Help/About" />
  <EnumValue value = "go" display_value="Solar System" />
</UserPref>
<UserPref name="anim" display_name="Animate" default_value="true" datatype="bool"/>
<UserPref name="clock" display_name="Clock" default_value="false" datatype="bool"/>
<Content type="html" view="home,canvas">
<![CDATA[ 
<head>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-248316-10";
urchinTracker('/module:solar');
</script>
<script type="text/javascript">
var IE = (document.all ? true : false);
var NUM_PLANETS = 8;
var bClock = 0;
var bAnimate = 0;
var dDays = 0;
var now = new Date();
var arP = new Array();
var img_base = 'http://chronita.com/luna/s_img/';
var view_scale = 1; // .74
var bMaxed = 0;

//orbit,name,aphelion,perhelion,offset,date,semi-major,period,szIcon,start_angle
var arD = new Array();   
arD[0]=new Array( 10,"mercury",0.46669835,0.30749951  ,-4097 ,1,0.38709893,87.96934,4,0,0);
arD[1]=new Array( 30,"venus"  ,0.72823128,0.71843270  ,-4074 ,1,0.72333199,224.70069,10,0,310.8);
arD[2]=new Array( 60,"earth"  ,1.0167103335,0.9832898912,0     ,1,1.0000001124,365.256366,10,0,169.27);
arD[3]=new Array( 95,"mars"   ,1.66599116,1.38133346  ,-3971 ,1,1.52366231,686.9600,4,0,25.03);
arD[4]=new Array(130,"jupiter",5.46,4.95,-2800 ,1,5.20336301,4332.589,22,0,27.06);
arD[5]=new Array(190,"saturn" ,10.05350840,9.02063224  ,-1318 ,1,9.53707032,10756.1995,18,0,129.19);
arD[6]=new Array(220,"uranus" ,20.09647190,18.28605596 ,-14679,1,19.19126393,30707.4896,12,0,286.56);
arD[7]=new Array(230,"neptune",30.32713169,29.81079527 ,8472  ,1,30.06896348,60223.3528,12,0,310.27);
</script>
<script type="text/javascript">
function cacheImages(it) {
  if (it) {
    var ar = it.getElementsByTagName('img');
    for (var i = 0, n = ar.length; i < n; i++) {
      ar[i].src = _IG_GetCachedUrl(ar[i].src);
    }
  }
}

function fetch_SolarSystem(rsp) {
  var it = _gel('content');
  if (it) {
    it.innerHTML = (rsp ? rsp : 'The Solar System is missing. Please try again later.');
    loadSolar();
    cacheImages(it);
  }
}

function fetch_Help(rsp) {
  var it = _gel('content');
  if (it) {
    it.innerHTML = (rsp ? rsp : 'Help does not compute. Please try again later.');
    cacheImages(it);
  }
}

var boot_url = null;
var bLoaded_common = false;
var bLoaded_tick = false;
var bLoaded_excanvas = false;
function boot_SolarSystem() {
  if (!bLoaded_common) {
    bLoaded_common = true;
    var js = document.createElement('scr' + 'ipt');
    js.type = 'text/javascript';
    js.onload = boot_SolarSystem;
    js.src = _IG_GetCachedUrl('http://chronita.com/solar/common.js');
    document.body.appendChild(js);
  } else if (!bLoaded_tick) {
    bLoaded_tick = true;
    var js = document.createElement('scr' + 'ipt');
    js.type = 'text/javascript';
    js.onload = boot_SolarSystem;
    js.src = _IG_GetCachedUrl('http://chronita.com/solar/tick.js');
    document.body.appendChild(js);
  } else {
    _IG_FetchContent(boot_url, fetch_SolarSystem);
  }
}

function init() {
  var prefs = new _IG_Prefs();
  var anim = prefs.getBool('anim');
  var clock = prefs.getBool('clock');
  var fx = prefs.getString('fx');
  if (fx.length < 1) {
    fx = 'help';
  }
  if (fx == 'help') { 
    _IG_FetchContent('http://chronita.com/solar/help.html', fetch_Help);
  } else {
    if (IE) {
      var gadget_url = 'http://gmodules.com/ig/ifr?url=' + encodeURIComponent('http://chronita.com/luna/IE_solar.xml?v=1');
      window.location.href = gadget_url;
      return;
    } else {
      boot_url = 'http://chronita.com/solar/system.html?v=2';
      if (anim) {
        bAnimate = 1;
        dDays = 3;
      }
      if (clock) {
        bClock = 1;
      }
      boot_SolarSystem();
    }
  }
}
_IG_RegisterOnloadHandler(init);
</script>
<style>
BODY { margin:0;border:0; background-color: #000000; font-family: Verdana; }
CANVAS { border:1px solid #111111;}
A {color:blue;}
A:visted {color:blue;}
.help {background-color:#ffffff;font-size: 10pt;height: 97%; overflow-y: auto; padding: 4px;}
.space {position:relative;z-index:0;text-align:center;background-color:#111111;height:300px;overflow:hidden;}
.wrapper { text-align:center; background-color:#111111; height:290px; overflow:hidden; }
.date { font-family: Verdana; font-size:8pt; color: #f0f0ff; }
.pane { font-family: Verdana;
position: relative; left:25px; top: -260px; width: 200px; height:230px; z-index:1;
border: solid 4px #ffff99; background-color: #00cc99;
filter: alpha(opacity=75);-moz-opacity:.75;opacity:.75; }
.info { text-align: left; font-family: Verdana; color: #000000; padding: 4px;
width:200px; height: 230px; overflow-x: hidden; overflow-y: auto; }
.tip { position:absolute; left:0px; top:0px; display:block; cursor: pointer; }
.info_text { font-size: 8pt; }
.info_title { font-size: 10pt; font-weight:bold; padding-bottom: 4px; }
.field { text-align:right; white-space: nowrap; }
.foot_note { color: #ffffff; margin-top: 10px; font-size: 8pt; }
.clock { font-size:14pt; font-family: Verdana, sans serif; color: #00ff00; }
.cloaked { display:block; width:0; height:0; overflow:hidden; }
.scale {color:#cccccc;font-family:Verdana;font-size:6pt;text-align:center;cursor:pointer;}
.mscale {text-align:center;cursor:default;background-color:#333333;font-family:Verdana;font-size:10pt;font-weight:bold;}
</style>
</head>
<body>
<div id="content">Loading...</div>
<p style="height:600px;"></p>
</body>
]]> 
</Content> 
</Module>
