<!--

var winW;
var winH;
var top_border;
var bottom_border;
var left_border;
var right_border;
var amountToMove = 10;
var x_motion = "plus";
var y_motion = "plus";
var stop_flag=1;
var theStopTimeout;
var statusMessage = "For more information, call 1.800.766.6615 (U.S.) or 1.650.381.3395 (International)";

function RunFromTop(the_div,time) {
   window.status = statusMessage;
   clearTimeout(theStopTimeout);
   RunBounce(the_div,time);
   ChangeDirection();
}

function RunBounce(the_div,time) {
   //childwindow=window.open("","childwindow","resizable,width=200,height=700");
   stop_flag=0;
   theStopTimeout = setTimeout("stop_flag = 1;",time);
   Bounce(the_div);
}


function ChangeDirection() {
   var randomX = Math.floor(Math.random()*10);
   var randomY = Math.floor(Math.random()*10);
   if (randomX > 5) {
      x_motion = "plus";
   } else {
      x_motion = "minus";
   }
   if (randomY > 5) {
      y_motion = "plus";
   } else {
      y_motion = "minus";
   }
}

function Bounce(the_div) {
 if (stop_flag==0) {
   FindWindowSize();
   if (window.document.all) {
      var divBounceString = "window.document.all." + the_div + ".style";
   }
   else if (window.document.layers) {
      var divBounceString = "window.document.layers['" + the_div + "']";
   }

   divBounceString = eval(divBounceString);

   if (x_motion == "plus") {
      divBounceString.left = parseInt(divBounceString.left) + amountToMove;
   } else {
      divBounceString.left = parseInt(divBounceString.left) - amountToMove;
   }

   if (y_motion == "plus") {
      divBounceString.top = parseInt(divBounceString.top) + amountToMove;
   } else {
      divBounceString.top = parseInt(divBounceString.top) - amountToMove;
   }

   if (parseInt(divBounceString.left) > right_border) {
      x_motion = "minus";
   } else if (parseInt(divBounceString.left) < left_border) {
      x_motion = "plus";
   }

   if (parseInt(divBounceString.top) > bottom_border) {
      y_motion = "minus";
   } else if (parseInt(divBounceString.top) < top_border) {
      y_motion = "plus";
   }
   //childwindow.document.write(the_div + "/" + x_motion + "/" + y_motion + right_border + "/" + bottom_border + "<br>");
   //childwindow.document.write(the_div + "/" + x_motion + "/" + y_motion + parseInt(divBounceString.left) + "/" + parseInt(divBounceString.top)+ "<br>");
   the_div_string = "Bounce('" + the_div + "');";
   theTimeOut = setTimeout(the_div_string,100);
   theSlowDownTimeOut = setTimeout("clearTimeout('theTimeOut');",50);
   //childwindow.document.write("theTimeOut " + theTimeOut + "<br>");
   //childwindow.document.write("theSlowDownTimeOut" + theTimeOut + "<br>");
 }
}

function FindWindowSize() {
   if (parseInt(navigator.appVersion)>3) {
      if (navigator.appName=="Netscape") {
         winW = window.innerWidth-40;
         winH = window.innerHeight-40;
         SetBoundary();
      } else if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = window.document.body.clientWidth-75;
         winH = window.document.body.clientHeight-75;
         SetBoundary();
      } else {
         //alert("navigator application not supported");
      }
   } else {
      //alert("navigator version not supported");
   }
}

function SetBoundary() {
   top_border = 0;
   bottom_border = winH;
   left_border = 0;
   right_border = winW;
   
}

function GoToPage(link,time) {
   link_string = "window.location='" + link + "';";
   theTimer = setTimeout(link_string,time);
}

//-->