var vmin=2;

var vmax=5;

var timer1;


function iecompattest(){

   return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body

}

function Chip(chipname,width,height,xx,yy){

  //#me alignment

    this.named=chipname;

    this.vx=vmin+vmax;

    this.vy=vmin+vmax;

    this.w=width+20;

    this.h=height;

    this.xx=xx;

    this.yy=yy;

    //this.xx=852;     //first position

    //this.yy=150;     //first position

    this.timer1=null;

}

function movechip(chipname){

  if (document.getElementById){

    eval("chip="+chipname);

    if (window.innerWidth || window.opera){

      pageX=window.pageXOffset;

      pageW=window.innerWidth-40;

      pageY=window.pageYOffset;

      pageH=window.innerHeight-20;

    }else if (document.body){

      pageX=iecompattest().scrollLeft;

      pageW=iecompattest().offsetWidth-40;

      pageY=iecompattest().scrollTop;

      pageH=iecompattest().offsetHeight-20;

    }

    chip.vx=pageX;

    chip.vy=pageY;    

    if(chip.yy<=pageY+pageH-chip.h){

      //follow on up

      chip.yy+=pageY;
    }

    if(chip.yy>=pageY+pageH-chip.h){

      //follow on down

      chip.yy=pageY+pageH-chip.h;

    }

    document.getElementById(chip.named).style.left=chip.xx+"px";

    document.getElementById(chip.named).style.top=chip.yy+"px";

    chip.timer1=setTimeout("movechip('"+chip.named+"')",20);

  }

}


var vmin=2;

var vmax=5;

var timer1;


function iecompattest(){

   return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body

}

function Chip(chipname,width,height,xx,yy){

  //#me alignment

    this.named=chipname;

    this.vx=vmin+vmax;

    this.vy=vmin+vmax;

    this.w=width+20;

    this.h=height;

    this.xx=xx;

    this.yy=yy;

    //this.xx=852;     //first position

    //this.yy=150;     //first position

    this.timer1=null;

}

function movechip(chipname){

  if (document.getElementById){

    eval("chip="+chipname);

    if (window.innerWidth || window.opera){

      pageX=window.pageXOffset;

      pageW=window.innerWidth-40;

      pageY=window.pageYOffset;

      pageH=window.innerHeight-120;

    }else if (document.body){

      pageX=iecompattest().scrollLeft;

      pageW=iecompattest().offsetWidth-40;

      pageY=iecompattest().scrollTop;

      pageH=iecompattest().offsetHeight-120;

    }

    chip.vx=pageX;

    chip.vy=pageY;    

    if(chip.yy<=pageY+pageH-chip.h){

      //follow on up

      chip.yy+=pageY;

    }

    if(chip.yy>=pageY+pageH-chip.h){

      //follow on down

      chip.yy=pageY+pageH-chip.h;

    }

    document.getElementById(chip.named).style.left=chip.xx+"px";

    document.getElementById(chip.named).style.top=chip.yy+"px";

    chip.timer1=setTimeout("movechip('"+chip.named+"')",20);

  }

}

function Chip1(chipname,width,height,xx,yy){

  //#me alignment

    this.named=chipname;

    this.vx=vmin+vmax;

    this.vy=vmin+vmax;

    this.w=width+20;

    this.h=height;

    this.xx=xx;

    this.yy=yy;

    //this.xx=852;     //first position

    //this.yy=150;     //first position

    this.timer1=null;

}

function movechip1(chipname){

  if (document.getElementById){

    eval("chip1="+chipname);

    if (window.innerWidth || window.opera){

      pageX=window.pageXOffset;

      pageW=window.innerWidth-40;

      pageY=window.pageYOffset;

      pageH=window.innerHeight-160;

    }else if (document.body){

      pageX=iecompattest().scrollLeft;

      pageW=iecompattest().offsetWidth-40;

      pageY=iecompattest().scrollTop;

      pageH=iecompattest().offsetHeight-180;

    }

    chip1.vx=pageX;

    chip1.vy=pageY;    

    if(chip1.yy<=pageY+pageH-chip.h){

      //follow on up

      chip1.yy+=pageY;

    }

    if(chip1.yy>=pageY+pageH-chip.h){

      //follow on down

      chip1.yy=pageY+pageH-chip.h;

    }

    document.getElementById(chip1.named).style.left=chip1.xx+"px";

    document.getElementById(chip1.named).style.top=chip1.yy+"px";

    chip.timer1=setTimeout("movechip1('"+chip1.named+"')",20);

  }

}

