var prd=20;            	//period in mlsec
var steps=10;           //count of steps
var ypuistart=0;      	//y coord for popup image - start
var ypuiend=0;        	//y coord for popup image - end
var brdr=2;             //width of border popup image
var shdww=10;           //width of shadow popup image
var w1=250;
var w2=300;
var tmr, cntr, imgpp, v, cnv, d, imgpuh, imgpuw, offsL, offsT, obj;

function show_popupimg(e){
	var evnt = e || window.event;
	obj=evnt.currentTarget || evnt.srcElement;
	imgpp=document.getElementById("popupimg");
	cnv=document.getElementById("canva");
	if(imgpp.style.visibility=='visible' && imgpp.src.lastIndexOf(obj.src.substr(obj.src.lastIndexOf("/")+1).substr(1))<=0) {
        v=false;
        window.clearInterval(tmr);
        cnv.style.visibility='hidden';
        imgpp.style.visibility='hidden';
        imgpp.src='';
    }
	
	if(v && (evnt.clientY>0 && evnt.clientX>0)) return false;
	var rt=obj.width/obj.height;
	imgpuw=w1;                                            					//set initial width for popup image
	if(obj.width>obj.height) imgpuw=w2;             						//set again width for popup image
	imgpuh=imgpuw/rt;

	offsL=document.body.scrollLeft+evnt.clientX;
	offsT=document.body.scrollTop+evnt.clientY;

	imgpp.style.width="1px";
	imgpp.style.height='1px';
	imgpp.style.left=offsL;
	imgpp.style.top=offsT;
	imgpp.src=obj.src.substr(0,obj.src.lastIndexOf("/")+1);
	imgpp.src+=obj.src.substr(obj.src.lastIndexOf("/")+1).substr(1);
	imgpp.style.visibility='visible';
	cntr=1;
	v=false;
	tmr=window.setInterval("tmr_proc()",prd);
}

function hide_popupimg(e){
        var evnt=e || window.event;
        var obj=evnt.currentTarget || evnt.srcElement;
        var loffs=obj.offsetLeft+obj.parentNode.offsetLeft+obj.parentNode.parentNode.offsetLeft;
        var toffs=obj.offsetTop+obj.parentNode.offsetTop+obj.parentNode.parentNode.offsetTop;
        if(v && evnt.clientX>loffs && evnt.clientX<(loffs+obj.width) && evnt.clientY>toffs && evnt.clientY<(toffs+obj.height)) return false;
        v=false;
        window.clearInterval(tmr);
        cnv.style.visibility='hidden';
        imgpp.style.visibility='hidden';
        imgpp.src='';
}

function tmr_proc(){
        if(cntr>steps) {
                v=true;
                window.clearInterval(tmr);
                cnv.style.width=parseInt(imgpp.style.width)+(shdww*2+brdr*2)+'px';              //set width for shadow
                cnv.style.height=parseInt(imgpp.style.height)+(shdww*2+brdr*2)+'px';    		//set height for shadow
                cnv.style.visibility='visible';
                cnv.style.left=offsL+'px';
                cnv.style.top=offsT+'px';
                imgpp.style.left=parseInt(cnv.style.left)+shdww+brdr-2+'px';
                imgpp.style.top=parseInt(cnv.style.top)+shdww+brdr+'px';
                imgpp.style.border=brdr+'px white solid';
                return;
        }
        imgpp.style.width=cntr*parseInt(imgpuw/steps)+'px';
        imgpp.style.height=cntr*parseInt(imgpuh/steps)+'px';
        cntr+=1;
}

<!-- BLOCK ERROR SCRIPT

function blockError(){return true;}
	window.onerror = blockError;

function w(str){
	document.write(str);
}

// -->


