
var IE = document.all?true:false


var popup=document.createElement('img');
popup.id='popupImage';
popup.style.display="none";
popup.className='borderedImg';
document.body.appendChild(popup);
popup=document.getElementById('popupImage');
imgs=document.getElementsByTagName('img');
for (i=0;i<imgs.length;i++){
	img=imgs[i];
	parts=img.src.split('/');
	lpart=parts[parts.length-1];
	if (lpart=='thumbnail'){
		img.setAttribute('onmouseout',"photoOut();");
		img.setAttribute('onmouseover',"popupPhoto(event,this);");
	}
}

function popupPhoto(e , im){

// If NS -- that is, !IE -- then set up for mouse capture

 if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY+10;
  }
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}

p=im.src.split('/');
p=p.slice(0,p.length-1);
pa=p.join('/');
pa= pa + '/' + 'image';

popup.style.display="block";
if (popup.src != pa){
	popup.src=null;
}
popup.src=pa;

popup.style.top=tempY + 'px';
popup.style.left=tempX + 'px';
popup.setAttribute('onclick',"closePopup(this)");

//If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = movePhoto;

}
function movePhoto(e){

	 if (IE) { // grab the x-y pos.s if browser is IE
		    tempX = event.clientX + document.body.scrollLeft;
		    tempY = event.clientY + document.body.scrollTop;
		  } else {  // grab the x-y pos.s if browser is NS
		    tempX = e.pageX;
		    tempY = e.pageY+10;
		  }
		  // catch possible negative values in NS4
		  if (tempX < 0){tempX = 0;}
		  if (tempY < 0){tempY = 0;}

	popup.style.top=tempY + 'px';
	popup.style.left=tempX + 'px';


}
function photoOut(){

	document.onmousemove = null;
	popup.style.display="none"
}

function closePopup(el){

el.style.display='none';

}
