var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function enlarge(which, position, imgwidth, imgheight)
{
	if (ie||ns6)
	{
		crossobj=document.getElementById ? document.getElementById("showimage") : document.all.showimage;
		pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop);
		vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2;
		if (window.opera && window.innerHeight) //compensate for Opera toolbar
		{
			vertpos=pgyoffset+window.innerHeight/2-imgheight/2;
		}
		vertpos=Math.max(pgyoffset, vertpos);

		crossobj.style.left=Math.max(0, position - imgwidth) + "px";
		crossobj.style.top=vertpos+"px";
		crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span></div><img id="innerzoom" src="'+which+'" width="' + imgwidth + '" height="' + imgheight + '">';
//alert("crossobj.innerHTML");
//		crossobj.innerHTML='HELLO';
		crossobj.style.visibility="visible";
		return false;
	} else //if NOT IE 4+ or NS 6+, simply display image in full browser window
	{
		return true;
	}
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")