function loadme_continued() {
	//$id('centering').style.backgroundImage="url('images/8002bgn.jpg')";
	setevent('sheep1','onmousedown','sheep');
	setevent('sheep2','onmousedown','sheep');
	setevent('sheep3','onmousedown','sheep');
	window.int_TJPfloat=setInterval("TJPfloat();",50);
}
// moving things
var movesbat=0; var batdir=1;
var maxsheep=3;
function movebat1() {
	var b = document.getElementById('bat');
  if(!b.style.left) { b.style.left='181px'; b.style.top='12px'; }
  var l = parseInt(b.style.left);
  if(batdir==0 && l==290) batdir=-1;
  if(batdir==0) batdir=1;
	movebat();
}
function movebat() {
	var b = document.getElementById('bat');
  movesbat++;
  var l = parseInt(b.style.left);
  if(l>290) {l=290; movesbat=99; batdir=0;}
  if(l<180) {l=180; movesbat=99; batdir=0;}
	b.style.left = l+batdir+'px';
	if(movesbat<20) window.setTimeout('movebat()',40);
	else movesbat=0;
}
var stivar=new Array();
var jumpvar=new Array();
var smokevar=0;
var shipvar=0;
function $id(id) {
  return document.getElementById(id);
}
function setTI(todos,interval) {
  if(stivar[todos].length == 0) {delete stivar[todos];return false;}
  eval(stivar[todos].shift());
  setTimeout('setTI('+todos+','+interval+')',interval);
}
function setevent(id,event,fn) {
  $id(id).setAttribute(event,fn+'(event,this);');
  if(navigator.userAgent.indexOf('MSIE')>-1) {
   eval("$id('"+id+"')."+event+" = function() {"+fn+"(event,this);}");
   //$id('id').onclick = function() {TJPhandlemouse(event,this);}
  }
}
function sheep(evt,obj) {
	//var evt = evt?evt:window.event?window.event:null; if(!evt) { return false; }
  hop(obj.id,0,-10-18*Math.random(),8);
}
function hop(id,ymin,ymax,steps) {
  if(jumpvar[id]) {return false}
  $id(id).style.backgroundPosition=-(id.substr(5,1)-1)*32+'px 0';
  var tmp=new Array();
  var out='';
  for(var i=0;i<steps;i++) {
    ts=Math.sin((i/(steps-1))*Math.PI);    
    ty=Math.floor(ymin+(ymax-ymin)*ts);
    tmp[i]="$id('"+id+"').style.marginTop='"+ty+"px';";    
    if(i == 0) {
      tmp[i]+="jumpvar['"+id+"']=1;";
    }
    if(i == steps-1) {
      tmp[i]+="delete jumpvar['"+id+"'];";
      tmp[i]+="$id('"+id+"').style.backgroundPosition='-"+(id.substr(5,1)-1)*32+"px -32px';";
    }
  }
  var ttt=Math.random();
  stivar[ttt]=tmp;
  setTI(ttt,50);
}
function TJPfloat() {
  var sy=Math.floor(Math.sin(smokevar)*10+10);
  var sx=Math.floor(Math.cos(smokevar)*3+3);
  smokevar+=.05; if(smokevar>2*Math.PI) {smokevar-=2*Math.PI;}
  if($id('buoy')) {
    sy=Math.floor(Math.sin(shipvar)*3+3);
    sx=Math.floor(Math.cos(shipvar)*1+1);
    $id('buoy').style.margin=-sy+'px 0 0 '+sx+'px';
    //$id('s_ship_top').style.height=(80+sy)+'px';
    shipvar+=.1; if(shipvar>2*Math.PI) {shipvar-=2*Math.PI;}
    if(Math.random()>.8) {
      for(si=1;si<=maxsheep;si++) {
        if(Math.random() > .95) {
          $id('sheep'+si).style.backgroundPosition=-(si-1)*32+'px -64px';
        } else
        if(Math.random() > .7) {
          $id('sheep'+si).style.backgroundPosition=-(si-1)*32+'px -32px';
        }
      }
    }
  }
}

