// Trembling Objects Script
// By Disenando.com, based on Virtual_Max Move Objects Script
// 
// Permission to use, copy, modify, and distribute this software and its documentation 
// for NON-COMMERCIAL purposes and  without fee is hereby granted provided that this 
// notice appears in all copies. 
//
// VIRTUAL MAX MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE 
// SOFTWARE, EITHER EXPRESS OR IMPLIED


var brOK=false;
var msie=false;
var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;

function checkbrOK() {
 if (aname.indexOf("Internet Explorer")!=-1) {
  if (aver>=4) brOK=navigator.javaEnabled();
  msie=true;
 }
 if (aname.indexOf("Netscape")!=-1) {
  if (aver>=4) brOK=navigator.javaEnabled();
 }
}

//var vmin=2;
//var vmax=5;
var vr=2;
var timer1;

var veces=1;
var maxveces=80; //menos d 5 seg

function Temblador(tmblname,width,height) {
 this.named=tmblname;
 this.limL=631;
 this.limR=645;
 this.w=width;
 this.h=height;
 this.xx=641;
 this.yy=51;
 this.timer1=null;
}

function moverTembl(tmblname) {
 if (brOK) {
  eval("tembl="+tmblname);
  if (tembl.xx>tembl.limR || tembl.xx<tembl.LimL) { //ok none
   if (tembl.xx>tembl.limR) {
    tembl.xx=tembl.xx-3*Math.random();
   }
   else {
    tembl.xx=tembl.xx+2*Math.random();
   }
  }
  else {
   var sup=Math.random();
   if (0.5>sup) {
    tembl.xx=tembl.xx-sup;
   }
   else {
    tembl.xx=tembl.xx+sup;
   }
  }

  if (document.layers) {
      eval('document.'+tembl.named+'.top ='+tembl.yy);
      eval('document.'+tembl.named+'.left='+tembl.xx);
      eval('document.'+tembl.named+'.visibility="show"');
  } 
  else if (document.all) {
      eval('document.all.'+tembl.named+'.style.pixelLeft='+tembl.xx);
      eval('document.all.'+tembl.named+'.style.pixelTop ='+tembl.yy);
      eval('document.all.'+tembl.named+'.style.visibility="visible"');
  }
  else if (document.getElementById) {
     document.getElementById(tembl.named).style.left=tembl.xx;
     document.getElementById(tembl.named).style.top =tembl.yy;
     document.getElementById(tembl.named).style.visibility ="visible";
  }
  if (veces<maxveces) {
  	tembl.timer1=setTimeout("moverTembl('"+tembl.named+"')",60);
  }
  veces++;
 }
}


function stopme(temblname)
{
 if(brOK) {
  //alert(temblname)
  eval("tembl="+temblname);
  if(tembl.timer1!=null) {
   clearTimeout(tembl.timer1)
  }
 }
}



