    function t(){
        this.timer=function(todo,time){clearTimeout(this.timeout);this.timeout=window.setTimeout(todo,time);}; 
        this.intervaler=function(todo,time){clearInterval(this.interval);this.interval=setInterval(todo,time);}       
    }    
    function opacity(el,start,stop,current,jump,interval){        
        var i=this;
        this.o={start:start,stop:stop,current:current,jump:jump};       
        this.time=new t();
        this.iFadeIn=function(){el.style.display='block';this.time.intervaler(function(){i.fadeIn();},interval);}
        this.iFadeOut=function(){this.time.intervaler(function(){i.fadeOut();},interval);}        
        this.fadeIn=function(){      
            if(this.o.current<this.o.stop){this.o.current+=this.o.jump;}
            this.apply(); 
            if(this.o.current>=this.o.stop){clearInterval(this.time.interval);}
        }
        this.fadeOut=function(){
            if(this.o.current>this.o.start){this.o.current-=this.o.jump;}
            this.apply(); 
            if(this.o.current<=this.o.start){
                clearInterval(this.time.interval);
                el.style.display='none';
            }        
        }
        this.apply=function(){
            try{el.filters.alpha.opacity=this.o.current;}catch(e){}
            el.style.opacity=this.o.current/100;        
        }        
    }
    function prodInfoZoom(){
        var refImage=$('reference1'),containerObj=$('info_image_con'),wrapZoom=$('wrapMainZoom');
        var obj1=$('zoomWindow'),obj2=$('zoomView');        
        newZoom=new infoZoom(refImage,obj1,obj2,containerObj,wrapZoom,3);                    
        containerObj.onmouseover=function(){newZoom.mouseOver();}        
        obj1.onmouseout=function(){newZoom.mouseOut();}      
    }
    function infoZoom(ref,obj1,obj2,bObj,aObj,zIn){
        this.fade1=new opacity(aObj,0,100,0,10,1);
        this.fade2=new opacity(obj1,0,50,0,10,1);
        this.zoomOffset=zIn;    
        this.pos={x:0,y:0};            
        this.ref=ref;
        this.bounds={x:ref.offsetWidth,y:ref.offsetHeight,xo:ref.offsetLeft,yo:ref.offsetTop};         
        var i=this; 
        this.mouseOver=function(){        
            document.onmousemove=function(event){
                var check=i.getTarget(event);
                if(check!==ref&&check!==obj1){i.mouseOut();return false;}
                try{
                    i.setZoom(obj1,'block');
                    i.setZoom(aObj,'block');
                }catch(err){}
                    i.fade1.iFadeIn();
                    i.fade2.iFadeIn()                                            
                try{i.doZoom(getRelPos(event,bObj),obj1);}catch(err){}                   
                try{i.mainImage(obj2);}catch(err){}                
            }    
        }
        this.mouseOut=function(){document.onmousemove=null;
            i.fade1.iFadeOut();
            i.fade2.iFadeOut();                                
        }
    }
    infoZoom.prototype.doZoom=function(coords,obj){          
        obj.style.left=coords.x-obj.offsetWidth/2+'px';
        obj.style.top=coords.y-obj.offsetHeight/2+'px';        
        if(obj.offsetLeft<this.bounds.xo){obj.style.left=this.bounds.xo+'px';}                                                      
        if(obj.offsetTop<this.bounds.yo){obj.style.top=this.bounds.yo+'px';}
        if(obj.offsetLeft+obj.offsetWidth>this.bounds.x+this.bounds.xo){obj.style.left=this.bounds.x+this.bounds.xo-obj.offsetWidth+'px';}
        if(obj.offsetTop+obj.offsetHeight>this.bounds.y+this.bounds.yo){obj.style.top=this.bounds.y+this.bounds.yo-obj.offsetHeight+'px';}
        this.pos.x=obj.offsetLeft;
        this.pos.y=obj.offsetTop;   
    }
    infoZoom.prototype.getTarget=function(event){var targ;
	    if(!event){var event=window.event;}
	    if(event.target){targ=event.target;}
	    else if(event.srcElement){targ=event.srcElement;}
	    if(targ.nodeType==3){targ=targ.parentNode;}return targ;
    }
    infoZoom.prototype.mainImage=function(obj){   
        obj.style.left=-(this.pos.x*this.zoomOffset)+'px';
        obj.style.top=-(this.pos.y*this.zoomOffset)+'px';
    }
    infoZoom.prototype.setZoom=function(obj,instr){obj.style.display=instr;}       
    infoZoom.prototype.setImageSrc=function(ref,bounds,src){             
        ref.src=src;
        this.bounds={x:bounds.offsetWidth,y:bounds.offsetHeight,xo:bounds.offsetLeft,yo:bounds.offsetTop};
    }
    function prodInfoZoom() {
        var refImage = $('reference1'), containerObj = $('info_image_con'), wrapZoom = $('wrapMainZoom');
        var obj1 = $('zoomWindow'), obj2 = $('zoomView');
        newZoom = new infoZoom(refImage, obj1, obj2, containerObj, wrapZoom, 2);
        containerObj.onmouseover = function () { newZoom.mouseOver(); }
        obj1.onmouseout = function () { newZoom.mouseOut(); }
    }
