var trigger=0
var vis=0
function initthumb()
	{
		document.onmousemove = sniff
		document.onmouseup = sniff
		document.onmousedown = sniff
		if (document.layers){document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP)}
		if (document.all)dopic('dummy','',1,1,1,1)
	}
function sniff(e){
		if (document.layers) {var mousex=e.pageX; var mousey=e.pageY;fx=mousex;fy=mousey;}
		else if (document.all) {var mousex=event.x; var mousey=event.y+document.body.scrollTop;fx=mousex;fy=mousey}
				}		
function dopic(name,auto,picx,picy)
{
	if (vis == 0) 
		{
			var oldpicx=100;
			var oldpicy=100;
			var rahmen='silver'
			var alttext="Кликните на фотографии для закрытия"
					if (trigger!=1)
						{
						trigger=1 // There is a layer now!
						// Create hidden layer (Netscape)
							if(document.layers){
								document.layers['picarea'] = new Layer(1);
								document.layers['picarea'].left = oldpicx;
								document.layers['picarea'].top = oldpicy;
								document.layers['picarea'].height = 20;
								document.layers['picarea'].visibility = "hidden";
							}
							else if (document.all){
								document.body.insertAdjacentHTML("BeforeEnd",'<DIV ID="picarea" STYLE="z-index:200;position:absolute;left:"+picx+";top:"+picy></DIV>');
							}
						}
					if (trigger != 0){
						if (document.layers){document.layers['picarea'].visibility="hide"}
						if (document.all){picarea.style.visibility="hidden"}
					}
			content="<a href=\"javascript:clearpic()\" style=\"color:"+rahmen+"\"><img src=\"";
			content=content+name+"\" name=\"pic\" alt=\""+alttext+"\" border=1";
			content=content+"></A>";
				if (document.layers) {
					sprite=document.layers['picarea'].document;
  					sprite.open();
					sprite.write(content);
					sprite.close();
					if (picx != null && auto == ''){ 
						document.layers['picarea'].left = picx;
						document.layers['picarea'].top = picy;
					}
					if (auto != "")
						{ 
						xw=document.layers['picarea'].document.images['pic'].width 
						yw=document.layers['picarea'].document.images['pic'].height
						newpicx = fx - (xw/2)
					    newpicy = fy - (yw/2)
							if (picx) {newpicx=newpicx + picx}
							if (picy) {newpicy=newpicy + picy} 
						document.layers['picarea'].left = newpicx;
						document.layers['picarea'].top = newpicy;
						}
					document.layers['picarea'].visibility="show";
					vis=1
				 }

				if (document.all) {
					document.all['picarea'].innerHTML = content;
					if (picx != null && auto == ''){
						picarea.style.top=picy
						picarea.style.left=picx;
					}
					if (auto != "")	{ 
						xw=document.all['pic'].width
						yw=document.all['pic'].height
				      newpicx = fx - (xw/2)
				      newpicy = fy - (yw/2)
							if (picx) {newpicx=newpicx + picx}
							if (picy) {newpicy=newpicy + picy} 
						picarea.style.top=newpicy;
						picarea.style.left=newpicx;
					}
						if (name != "dummy") {
							picarea.style.visibility="visible";
							vis=1
						}
	}
	else if (document.layers == null && document.all == null) {self.location=name};
	}
}
function clearpic()	{
	vis=0
		if (document.layers){document.layers['picarea'].visibility="hide"};
		if (document.all){picarea.style.visibility="hidden"};
}