function RegisterEventHandler (object, eventName, handler)
{
	if (object.attachEvent)
	object.attachEvent ('on' + eventName, handler);
	else if (object.addEventListener)
	object.addEventListener (eventName, handler, true);
}


function zoom(id_little,id_zwin,id_big)
{

this.little=document.getElementById(id_little);
this.big=document.getElementById(id_big);
this.zwin=document.getElementById(id_zwin);





this.xCoef=this.big.offsetWidth/this.little.offsetWidth
this.yCoef=this.big.offsetHeight/this.little.offsetHeight;

_mother=this;

this.initTrust=function(){_mother.zwin.style.opacity = 0;
_mother.zwin.style.filter = "alpha(opacity:0)";
_mother.zwin.style.display='block';

_mother.xTrust=_mother.little.offsetLeft+_mother.little.parentNode.offsetLeft+(_mother.zwin.offsetWidth/_mother.xCoef)/2;
_mother.yTrust=_mother.little.offsetTop+_mother.little.parentNode.offsetTop+(_mother.zwin.offsetHeight/_mother.yCoef)/2;

_mother.zwin.style.display='none';
_mother.zwin.style.opacity = 1;
_mother.zwin.style.filter = "alpha(opacity:100)";
}

this.initTrust();



this.zwin.style.display='none';
this.zwin.style.opacity = 1;
this.zwin.style.filter = "alpha(opacity:100)";



this.mmove=function(event){
_mother.big.style.left=((event.clientX+document.body.scrollLeft- _mother.xTrust)*-_mother.xCoef);
_mother.big.style.top=((event.clientY+document.body.scrollTop- _mother.yTrust)*-_mother.yCoef);
}

this.mout=function(event){
_mother.zwin.style.display='none';
}

this.mover=function(event){
_mother.zwin.style.display='block';
}


RegisterEventHandler (this.little, 'mouseover', this.mover);
RegisterEventHandler (this.little, 'mousemove', this.mmove);
RegisterEventHandler (this.little, 'mouseout', this.mout);
RegisterEventHandler (window, 'resize', this.initTrust);
}
