/*<![CDATA[*/

function Load(id,mid,frame){
 // 70,87   230,286
 this.main=document.getElementById(id);
 this.addevt(document,'mousemove','MseMove');
 this.frame=document.createElement('DIV');
 this.frame.className='frame';
 document.body.appendChild(this.frame);
 this.magimg=document.getElementById(mid);
 this.magp=this.magimg.parentNode;
}

Load.prototype.MseMove=function(e){
 this.frame.style.visibility='hidden';
 this.magp.style.visibility='hidden';
 var mse=zxcMse(e),pos=zxcPos(this.main);
 if (mse[0]>pos[0]&&mse[0]<pos[0]+this.main.width&&mse[1]>pos[1]&&mse[1]<pos[1]+this.main.height){
  this.frame.style.left=Math.min(Math.max(mse[0]-this.frame.offsetWidth/2,pos[0]),pos[0]+this.main.offsetWidth-this.frame.offsetWidth)+'px';
  this.frame.style.top=Math.min(Math.max(mse[1]-this.frame.offsetHeight/2,pos[1]),pos[1]+this.main.offsetHeight-this.frame.offsetHeight)+'px';
  this.magimg.style.left=-(this.magimg.width-this.magp.offsetWidth)*(this.frame.offsetLeft-pos[0])/(this.main.width-this.frame.offsetWidth)+'px';
  this.magimg.style.top=-(this.magimg.height-this.magp.offsetHeight)*(this.frame.offsetTop-pos[1])/(this.main.height-this.frame.offsetHeight)+'px';
  this.frame.style.visibility='visible';
  this.magp.style.visibility='visible';
 }
}

Load.prototype.addevt=function(o,t,f,p){
 var oop=this;
 if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](e,p);}, false);
 else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](e,p); });
 else {
  var prev=o['on'+t];
  if (prev) o['on'+t]=function(e){ prev(e); oop[f](e,p); };
  else o['on'+t]=o[f];
 }
}

function zxcMse(ev){
 if(!ev) var ev=window.event;
 if (document.all) return [ev.clientX+zxcDocS()[0],ev.clientY+zxcDocS()[1]];
 return [ev.pageX,ev.pageY];
}

function zxcDocS(){
 if (!document.body.scrollTop) return [document.documentElement.scrollLeft,document.documentElement.scrollTop];
 return [document.body.scrollLeft,document.body.scrollTop];
}


function zxcPos(obj){
 var rtn=[0,0];
 while(obj){
  rtn[0]+=obj.offsetLeft;
  rtn[1]+=obj.offsetTop;
  obj=obj.offsetParent;
 }
 return rtn;
}


function Swap(){
 var args=Swap.arguments;
 for (var z0=0;z0<args.length;z0+=2){
  document.getElementById(args[z0]).src=args[z0+1];
 }
}

/*]]>*/

