<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs 
    height="230" scrolling="0"
    title="Haunted House"
    directory_title="Halloween Haunted House"
    description="An interactive Haunted House where you can post your own Halloween message (WARNING:there will be blood)"
    title_url="http://chronita.com/halloween/"
    screenshot="http://chronita.com/halloween/assets/scr-haunted.png"
    thumbnail="http://chronita.com/halloween/assets/scr-haunted-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" />
<Require feature="minimessage"/>
<Require feature='setprefs'/> 
  </ModulePrefs>
<UserPref name="fx" display_name="Function" datatype="enum" default_value="init">
     <EnumValue value="help" display_value="Help/About" />
     <EnumValue value="init" display_value="Go ahead... scare me." />
</UserPref>
<UserPref name="txt" display_name="Message" default_value="Boo!"/>
<UserPref name="sound" display_name="Sounds" datatype="enum">
  <EnumValue value="intro" display_value="Play Intro Only"/>
  <EnumValue value="play" display_value="Play Random Sounds"/>
  <EnumValue value="silent" display_value="Silent"/>
</UserPref>
<UserPref name="img" display_name="Background" datatype="enum" default_value="haunted-1.jpg">
  <EnumValue value="haunted-1.jpg" display_value="Pan"/>
  <EnumValue value="haunted-300-0.jpg" display_value="Whole House"/>
  <EnumValue value="haunted-300-1.jpg" display_value="Front Porch"/>
  <EnumValue value="haunted-300-2.jpg" display_value="Tree"/>
  <EnumValue value="haunted-300-3.jpg" display_value="Upstairs"/>
  <EnumValue value="haunted-300-4.jpg" display_value="Forest"/>
</UserPref>
<Content type="html" view="home">
<![CDATA[ 
<script type="text/javascript" src="/ig/proxy?url=http://echo3.net/allcta/browser_detect.js"></script>
<script>
_IG_Analytics("UA-248316-10","/module:haunted");
var proxy = '/ig/proxy?url=http://chronita.com/halloween/assets/';
var nSeq = 2;

var IAB = null;
var msg = null;
var bNoMsg = true;
var bPlay = false;
var bClearHelp = true;
var bNewOptions = false;
var bHalloween = false;
var timerID=0;
var timerIDsound=0;
var txt, img;

var loading = '';

var houseImg = new Image(); 

var nFrame = 5;
var arSounds = new Array();
arSounds[0] = 'sharpen';
arSounds[1] = 'hscream';
arSounds[2] = 'mlaugh';
arSounds[3] = 'door3';
arSounds[4] = 'knocking';

var arOpacity = new Array();
arOpacity[0]='';
arOpacity[1]='filter:alpha(opacity=20);-moz-opacity:.20;opacity:.20;';
arOpacity[2]='filter:alpha(opacity=30);-moz-opacity:.30;opacity:.30;';
arOpacity[3]='filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50;';
arOpacity[4]='filter:alpha(opacity=30);-moz-opacity:.30;opacity:.30;';
arOpacity[5]='filter:alpha(opacity=20);-moz-opacity:.20;opacity:.20;';
var arOpacities = new Array(null, 20, 30, 50, 30, 20);

// left, top, width, height, dx, dy, opacity
var arSeq = new Array();
var LEFT_IDX = 0, TOP_IDX = 1, WIDTH_IDX = 2, HEIGHT_IDX = 3, DX_IDX = 4, DY_IDX = 5, OPA_IDX = 6;
arSeq[0] = new Array(96, 0, 131, 180, 0, 0, 1);
arSeq[1] = new Array(96, 0, 149, 180, 0, 0, 1);
arSeq[2] = new Array(0, 0, 197, 180, 0, 0, 1);
arSeq[3] = new Array(75, 5, 226, 120, -14, 5, 1); // left to right, bottom to top
arSeq[4] = new Array(100, 20, 226, 120, -20, -10, 1); // left to right, top to bottom
arSeq[5] = new Array(120, 40, 123, 120, 10, -20, 1); // right to left, top to bottom
arSeq[6] = new Array(0, 0, 300, 180, 0, 0, 1);
arSeq[7] = new Array(-10, 0, 199, 180, 15, 0, 1);
arSeq[8] = new Array(100, 10, 109, 160, 0, 0, 1);
arSeq[9] = new Array(100, 20, 29, 120, 15, 0, 1);
arSeq[10] = new Array(0, 30, 82, 150, 40, -5, 1);
arSeq[11] = new Array(100, 10, 109, 162, 0, 0, 1);
arSeq[12] = new Array(50, 20, 84, 140, 15, 0, 1);
arSeq[13] = new Array(120, -25, 76, 100, 5, 20, 1);
arSeq[14] = new Array(100, 10, 127, 160, 0, 0, 1);
arSeq[15] = new Array(50, 10, 127, 160, 20, 2, 1);
arSeq[16] = new Array(100, 10, 143, 160, 0, 0, 1);
arSeq[17] = new Array(0, 0, 300, 180, 0, 3, 0);

var nSkull = 18;
arSeq[18] = new Array(105, 29, 88, 120, 0, 0, 0); // skull start
arSeq[19] = new Array(95, 25, 110, 150, 0, 0, 0);
arSeq[20] = new Array(85, 19, 131, 180, 0, 0, 0);
arSeq[21] = new Array(85, 0, 131, 180, 0, 0, 0);  // skull end

function randomize(lo,hi) { 
  return (lo + Math.floor(Math.random() * ((1 + hi) - lo)));
} 

function msgOff() {
  bNoMsg = true;
  // cookie this
  if (_args()['synd'] == 'ig') { 
    var prefs = new _IG_Prefs(__MODULE_ID__);
    //prefs.set("m7","0");
  } 
  return true;
}

function preLoad() {
  var rtn = true;

  var n = 0, html = new Array();
  for (img in arguments) {
    html.push('<img id="preload_img', n++, '" src="', proxy, img, '.gif">');
  } 
  
  var load = html.join('');
  if (load != loading) {
    var it = _gel('preload');
    if (it) {
      it.innerHTML = load;
      loading = load;
    }
    rtn = false;
  } else {
    for (var i = 0; i < n; i++) {
      var it = _gel('preload_img' + i);
      if (!it || !it.completed) {
        rtn = false;
        break;
      }
    }
  }

  return rtn;
}

function setOpacity(it, n) {
  it.style.filter = 'alpha(opacity=' + n + ')';
  it.style.opacity = n/100;
  it.style.MozOpacity = n/100;
}

function buildFrame(n, src, seq) {
  var rtn = null;
  var it = _gel('ghost');
  if (!it) {
    var html = new Array();
    html.push('<div id="ghost" class="ghost" style="');
    html.push('left:' + (arSeq[seq][LEFT_IDX] + (n * arSeq[seq][DX_IDX])) + 'px;');
    html.push('top:' + (arSeq[seq][TOP_IDX] + (n * arSeq[seq][DY_IDX])) + 'px;');
    if (arSeq[seq][OPA_IDX]) {
      html.push(' ', arOpacity[n * arSeq[seq][OPA_IDX]]);
    }
    html.push('">');
    html.push('<img id="ghost_img" alt=" " width="', arSeq[seq][WIDTH_IDX], '"');
    html.push(' height="', arSeq[seq][HEIGHT_IDX], '"');
    html.push(' src="', proxy, src, '"></div>');
    rtn = html.join('');
  } else {
    it.style.left = (arSeq[seq][LEFT_IDX] + (n * arSeq[seq][DX_IDX])) + 'px';
    it.style.top = (arSeq[seq][TOP_IDX] + (n * arSeq[seq][DY_IDX])) + 'px';
    setOpacity(it, arOpacities[seq]);

    it = _gel('ghost_img');
    if (it) {
      if (it.src != (proxy + src)) {
        it.src = proxy + src;
      }
      it.width = arSeq[seq][WIDTH_IDX];
      it.height = arSeq[seq][HEIGHT_IDX];
    }
  }
  return rtn;
}

function cycle() {
  if (timerID) {
    clearTimeout(timerID);
    timerID = 0;
  }

  var it;
  if (bClearHelp) {
    if (!houseImg.complete) { 
      timerID = setTimeout(cycle, 1000);
      return;
    } else {
      it = _gel('bgImg');
      if (it) {
        if (it.src != houseImg.src) {
          it.src = houseImg.src;
          timerID = setTimeout(cycle, 500);
          return;
        } else if (!it.complete) {
          timerID = setTimeout(cycle, 500);
          return;
        }
      }
    }

    it = _gel('help');
    if (it) {
      it.innerHTML = '';
    }

    if (bNewOptions) { 
      var say = 'There are new options in the Edit controls';
      if (_args()['synd'] == 'ig') {
        msg.createDismissibleMessage(say, msgOff);
      } else {
        msg.createTimerMessage(say, 15, msgOff);
      }
      bNoMsg = false;
    }

    if (houseImg.width > 310) {
      dx = (randomize(0, 1) ? 1 : -1);
      dy = (randomize(0, 1) ? 1 : -1);
      it = _gel('bgImg');
      if (it) {
        it.style.left = (randomize(0, 3) * dx) + Math.floor(-houseImg.width / 2) + 'px';
        it.style.top = (randomize(0, 3) * dy) + Math.floor(-houseImg.height / 2) + 'px';
        timerIDpan = setTimeout(pan, 1000);
      }
    }

    it = _gel('wrapper');
    if (it) {
      it.style.border = 'solid 2px #333333';
    }
    bClearHelp = false;
  }

  var v = (nFrame == 0 ? ' ' : null);
//nSeq = 18;
  if (nFrame > 0) {
    if (nSeq == 0) {
      if (!preLoad('scary-180', 'scary2-180')) { 
        timerID = setTimeout(cycle, 600);
        return;
      }
      if (nFrame != 1) {
// ghost sequence
        var src = 'scary' + (randomize(0, 1) ? '' : '2') + '-180.gif';
        v = buildFrame(nFrame, src, nSeq);
      }
    } else if (nSeq == 1) {
      if (!preLoad('lady-180')) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// vamp lady sequence
        v = buildFrame(nFrame, 'lady-180.gif', nSeq);
      }
    } else if (nSeq == 2) {
      if (!preLoad('veiled-180')) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// veiled lady sequence
        v = buildFrame(nFrame, 'veiled-180.gif', nSeq);
      }
    } else if (nSeq == 3) {
      if( !preLoad('shalott-180') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// shalott sequence
        v = buildFrame(nFrame, 'shalott-180.gif', nSeq);
      }
    } else if( nSeq==4 ) {
      if( !preLoad('bat-180') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// bat sequence
        v = buildFrame(nFrame, 'bat-180.gif', nSeq);
      }
    } else if( nSeq==5 ) {
      if( !preLoad('bat2-180') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// bat2 sequence
        v = buildFrame(nFrame, 'bat2-180.gif', nSeq);
      }
    } else if( nSeq==6 ) {
      if( !preLoad('web') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// spider web sequence
        v = buildFrame(nFrame, 'web.gif', nSeq);
      }
    } else if( nSeq==7 ) {
      if( !preLoad('lady2-180') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// lady2 sequence
        v = buildFrame(nFrame, 'lady2-180.gif', nSeq);
      }
    } else if( nSeq==8 ) {
      if( !preLoad('blaine2') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// blaine sequence
        arSeq[nSeq][DX_IDX] = ((randomize(0, 1) ? -1 : 1) * 4);
        arSeq[nSeq][DY_IDX] = ((randomize(0, 1) ? -1 : 1) * 2);
        v = buildFrame(nFrame, 'blaine2.gif', nSeq);
      }
    } else if( nSeq==9 ) {
      if( !preLoad('squid2') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// squid sequence
        v = buildFrame(nFrame, 'squid2.gif', nSeq);
      }
    } else if (nSeq == 10) {
      if (!preLoad('snake4')) {
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// snake sequence
        v = buildFrame(nFrame, 'snake4.gif', nSeq);
      }
    } else if( nSeq==11 ) {
      if( !preLoad('ball') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// ball sequence
        arSeq[nSeq][DX_IDX] = ((randomize(0, 1) ? -1 : 1) * 4);
        arSeq[nSeq][DY_IDX] = ((randomize(0, 1) ? -1 : 1) * 2);
        v = buildFrame(nFrame, 'ball.gif', nSeq);
      }
    } else if( nSeq==12 ) {
      if( !preLoad('pilot1') ) {
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// pilot sequence
        v = buildFrame(nFrame, 'pilot1.gif', nSeq);
      }
    } else if( nSeq==13 ) {
      if( !preLoad('bahama') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// clown sequence
        v = buildFrame(nFrame, 'bahama.gif', nSeq);
      }
    } else if( nSeq==14 ) {
      if( !preLoad('jack3') ) { 
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// jack sequence
        arSeq[nSeq][DX_IDX] = ((randomize(0, 1) ? -1 : 1) * 4);
        arSeq[nSeq][DY_IDX] = ((randomize(0, 1) ? -1 : 1) * 2);
        v = buildFrame(nFrame, 'jack3.gif', nSeq);
      }
    } else if( nSeq==15 ) {
      if( !preLoad('lady3') ) {
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// lady3 sequence
        v = buildFrame(nFrame, 'lady3.gif', nSeq);
      }
    } else if( nSeq==16 ) {
      if( !preLoad('pumpkin2') ) {
        timerID = setTimeout(cycle, 300);
        return;
      }
      if (nFrame != 1) {
// pumpkin sequence
        arSeq[nSeq][DX_IDX] = ((randomize(0, 1) ? -1 : 1) * 4);
        arSeq[nSeq][DY_IDX] = ((randomize(0, 1) ? -1 : 1) * 2);
        v = buildFrame(nFrame, 'pumpkin2.gif', nSeq);
      }
    } else if( nSeq==17 ) {
      if( !preLoad('splatter-1') ) {
        timerID = setTimeout(cycle, 600);
        return;
      } 
      if (nFrame != 1) {
// splatter sequence
        v = buildFrame(nFrame, 'splatter-1.gif', nSeq);
      }
    } else {
// skull sequence
      if( !preLoad('skull3-120','skull3-150','skull3-180') ) { 
        timerID = setTimeout(cycle(), 900);
        return;
      }
      if( nFrame==5 ) {
        v = buildFrame(nFrame, 'skull3-120.gif', nSkull);
      } else if( nFrame==4 ) {
        v = buildFrame(nFrame, 'skull3-150.gif', nSkull + 1);
      } else if( nFrame==3 ) {
        v = buildFrame(nFrame, 'skull3-180.gif', nSkull + 2);
      } else if( nFrame==2 ) {
        v = buildFrame(nFrame, 'skull3-180.gif', nSkull + 3);
      }
    }
    if (nFrame == 1 && txt.length > 0) {
      v = '<div class="boo" style="font-style: italic;">' + txt + '</div>';
    }
  }

  if (v) {
    var it = _gel('house');
    if (it) {
      it.innerHTML = v;
    }
  }

  if (nFrame == 0) {
    nFrame = 5;
    var ns = randomize(5, 10);
    if (bNoMsg) { 
      //var say = '<span class="link" onclick="popVad()">';
      //say += '<img align="absmiddle" src="http://echo3.net/vads/vad.png" height="16">&nbsp;scary videos</span>';
      var say = '<a target="_blank" href="http://chronita.com/halloween">';
      say += '<img border="0" align="absmiddle" src="http://echo3.net/vads/vad.png" height="16">';
      say += '&nbsp;<spa class="link">scary videos</span></a>';
      msg.createTimerMessage(say, 4);
    }
    timerID = setTimeout(cycle, 1000 * ns);
    nSeq = randomize(0,17);
  } else {
    nFrame = nFrame - 1;
    timerID = setTimeout(cycle, 500);
  }
}

var dx=1,dy=1;
var xMin = 0 - (800 - 300);
var yMin = 0 - (485 - 180);
function pan() { 
  if (timerIDpan) {
    clearTimeout(timerIDpan);
    timerIDpan = 0;
  }

  var it = _gel('bgImg');
  if (!it) {
    return;
  }
  var x = parseInt(it.style.left);
  if (isNaN(x)) {
    x = 0;
  }
  x += dx;
  if( x>0 ) { 
    x = 0; dx = 0 - dx; x += dx;
  } else if( x<xMin ) { 
    x = xMin; dx = 0 - dx; x += dx;
  }

  var y = parseInt(it.style.top);
  if (isNaN(y)) {
    y = 0;
  }
  y += dy;
  if( y>0 ) { 
    y = 0; dy = 0 - dy; y += dy;
  } else if( y<yMin ) { 
    y = yMin; dy = 0 - dy; y += dy;
  }

  it.style.left = x + 'px';
  it.style.top = y + 'px';
  
  timerIDpan = setTimeout(pan, 300);
}

function playSound(s) {
  if (timerIDsound) {
    clearTimeout(timerIDsound);
    timerIDsound = 0;
  }

  if (document.all) {
    var e = document.createElement('embed');
    e.src = proxy + 'wav/' + s + '.wav?v=7';
    e.autostart = 'true';
    e.loop = 'false';
    e.hidden = 'true';
  } else {
    var e = document.createElement('object');
    e.data = proxy + 'wav/' + s + '.wav?v=7';
    e.src = proxy + 'wav/' + s + '.wav?v=7';
    if (BrowserDetect.OS.indexOf('Windows') >= 0) {
      e.type = 'application/x-mplayer2';
    } else {
      e.type = 'audio/x-wav';
    }
    e.autoplay = '1';
    e.loop = '0';
    e.width = '0';
    e.height = '0';
  }
  document.body.appendChild(e);
  if (bPlay) { 
    timerIDsound = setTimeout(playRandomSound, 1000 * randomize(10, 45));
  }
}

function playRandomSound() { 
  var wav = arSounds[randomize(0, arSounds.length-1)];
  playSound(wav);
}

function getSize() {
  // find out what size iframe we are being displayed in
  if (self.innerWidth) {
    width = self.innerWidth;
    height = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientWidth) {
    width = document.documentElement.clientWidth;
    height = document.documentElement.clientHeight;
  } else if (document.body) {
    width = document.body.clientWidth;
    height = document.body.clientHeight;
  }
  var rtn = new Object();   
  rtn.width = width;
  rtn.height = height;
  return rtn;
}

function popVad() {
  window.open('http://echo3.net/vads/ghosts.php','vad',
     'status=0,toolbar=0,location=0,menubar=0,resizable=1,scrollbars=0,width=502,height=512');
}

function init() {
  BrowserDetect.init();

  IAB = getSize();
  var prefs = new _IG_Prefs(__MODULE_ID__);

  var fx = prefs.getString("fx"); 
  if( fx.length<1 ) fx = "init";
  if (fx!='help') {
    var it = _gel('help');
    if (it) {
      it.className = 'intro';
      it.innerHTML = 'Loading Spooky Stuff';
    }

    msg = new _IG_MiniMessage(__MODULE_ID__,_gel('more'));
    txt = prefs.getString("txt");
    if( txt=="[nomesg]" ) txt='';

    img = prefs.getString("img");
    if (img.length < 1) {
      img = "haunted-300-0.jpg";
    }
    houseImg.src = proxy + img;

    var v = '';
    var sound = prefs.getString('sound');
    if (sound != 'silent') { 
      if (sound == 'play') {
        bPlay = true;
      }
      playSound('children');
    }

    if (IAB.width > 300) {
      var it = _gel('wrapper');
      if (it) {
        it.style.left = Math.round((IAB.width - 300)/2);
      }
    }

    cycle();
  }
}

_IG_RegisterOnloadHandler(init);
</script>
<style>
BODY {margin:0;padding:0;background-color:#111111;}
.wrapper {position:absolute;left:0;top:7px;z-index:1;width:300px;height:180px;overflow:hidden;}
.intro {position:relative;left:0;top:0;z-index:0;height:184px;text-align:center;font-size:16pt;color:#ccccff;}
.more {border:solid 1px #000000;position:relative;left:0;top:6px;padding:6px;z-index:4;}
.house {position:absolute;left:0;top:0;z-index:2;}
.ghost {position:absolute;left:0;top:0;z-index:3;}
.boo {position:relative;left:0px;top:0px;z-index:4;font-size:24pt;font-style:italic;color:#ffffff;}
.help {color:#ffffff;background-color:#000000;font-family:Arial;font-size:10pt;height:180px;overflow-y:auto;padding:4px;}
.hiddenDiv {position:absolute;height:0;width:0;}
.link {font-size:11px;color:#ffff99;text-decoration:underline;cursor:pointer;}
.mmlib_table__MODULE_ID__ {background-color: #333333;}

</style>
<div id="help" class="help">
Thanks for trying this Google Gadget! Use the edit controls to choose your 
own title, background and scary message.
<p>
Most installations of the Haunted House don't work as well 
with Internet Explorer. (For example, the animations will 
not be as smooth and there may be some skipping in the sounds) 
If you are still using IE this would be a good time to switch 
to the <a style="color: #ff0000;" target="_top" 
href="http://echo3.net/firefox/?haunted">Firefox</a> browser.
<p>
Select the Function "Go ahead... scare me" to start the fun. 
Your message and various forms of spookiness will appear when 
least expected!
<p>
NEW in 2007: more sounds, more ghosts, panning background
<p>
TIP: if you leave the message blank it will default to <i>Boo!</i> 
so if you would prefer to display no message at all put [nomesg] 
in the <b>Message</b> field
<p>
<!--google_ad_section_start-->
Be sure to stick around (if you dare) because it can take a while for 
all the terrors of the Haunted House to be revealed. You should beware of:
<ul>
<li>Skeletons</li>
<li>Bats</li>
<li>Spiders</li>
<li>Vampires</li>
<li>the Veiled Lady</li>
<li>Snakes</li>
<li>Red Prince</li>
<li>the Lady of the Lake</li>
<li>Spooky ghosts</li>
<li>various Hobgoblins of the worst sort!</li>
<li>especially, BEWARE the Pumpkin</li>
</ul>
<p>
<p>
Also, be sure to take a look at the new
<a style="color: #ff0000;" target="_blank"
href="http://www.google.com/ig/add?moduleurl=http%3A%2F%2Fchronita.com%2Fcsg%2Fgadget.xml"
>Christmas Snow Globe</a>
<p>
The images of the Haunted House itself are used with the permission 
of the artist, Daniele Montella
<a style="color: #ff0000;" target="_blank" href="http://www.dan-ka.com/"
>http://www.dan-ka.com/</a>
<!--google_ad_section_stop-->
</div>
<center>
<div id="wrapper" class="wrapper">
<div id="house" class="house"></div>
<img id="bgImg" alt=" " 
style="position: relative; top:0; left:0; z-index:0;"
src="/ig/proxy?url=http://chronita.com/halloween/assets/blank.gif">
</div>
<div id="more" class="more"></div>
</center>
<div id="soundObj" class="hiddenDiv"></div>
<div id="preload" class="hiddenDiv"></div>
]]> 
   </Content> 
<Content type="html" view="canvas"> 
<![CDATA[ 
<head>
<style>
BODY {font-family;Arial;background-color:#eeeeff;}
.loading {font-size:24px;color:#666666;}
.control {background-color:#ffffff;}
.home_link {color:#0000ff;font-size:14px;text-decoration:underline;cursor:pointer;}
.cloaked {overflow:hidden;width:0;height:0;display:none;border:none;}
</style>
<script>
function goHome() {
  var supported_views = gadgets.views.getSupportedViews();
  //var params = {selected_tab : selected_tab};
  //gadgets.views.requestNavigateTo(supported_views['home'], params);
  gadgets.views.requestNavigateTo(supported_views['home']);
}
    
function doneLoading() {
  var it = _gel('loading');
  if (it) {
    it.className = 'cloaked';
  }
  it = _gel('home_link'); 
  if (it) {
    it.className = 'control';
  }
}

function canvas_init() {
  var url = null;
  try {
    var prefs = gadgets.views.getParams();
    if (prefs) {
    }
  } catch(err) {
  }

  if (!url) {
    url = 'http://chronita.com/halloween/';
  }
  var frm = document.createElement('iframe');
  frm.width = '100%';
  frm.height = '100%';
  frm.style.border = 'none';
  if (document.all) {
    setTimeout(doneLoading, 1000);
  } else {
    frm.onload = doneLoading;
  }
  frm.src = url;
  document.body.appendChild(frm);
}
_IG_RegisterOnloadHandler(canvas_init);
</script>
</head>
<body>
<div id="home_link" class="cloaked"><table><tr><td>
<div onclick="goHome()" class="home_link">&lt;&lt;&nbsp;back</div></td></tr></table></div>
<div id="loading" class="loading">Loading...</div>
</body>
]]> 
</Content> 
</Module>
