	/***********************************************
	* Image Thumbnail viewer- © Dynamic Drive (www.dynamicdrive.com)
	* Last updated Sept 26th, 03'. This notice must stay intact for use
	* Visit http://www.dynamicdrive.com/ for full source code
	***********************************************/
	
	var wndwidth=0, wndheight=0;
	var ie=document.all
	var ns6=document.getElementById&&!document.all
	
	function ietruebody()
	{
		return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
	}
	
	function enlarge(n, e, position, wndwidth2, wndheight2)
	{
		wndwidth = wndwidth2;
		wndheight = wndheight2;
		if (ie||ns6)
		{
			crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
			if (position=="center")
			{
				pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
				horzpos=ns6? pageXOffset+window.innerWidth/2-wndwidth/2-100 : ietruebody().scrollLeft+ietruebody().clientWidth/2-wndwidth/2-100
				vertpos=ns6? pgyoffset+window.innerHeight/2-wndheight/2 : pgyoffset+ietruebody().clientHeight/2-wndheight/2;
				if (window.opera && window.innerHeight) //compensate for Opera toolbar
				vertpos=pgyoffset+window.innerHeight/2-wndheight/2
				//vertpos=vertpos+10
				vertpos=Math.max(pgyoffset, vertpos)
				//vertpos=180
			}
			else
			{
				var horzpos=ns6? pageXOffset+e.clientX -100: ietruebody().scrollLeft+event.clientX-100
				var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY
			}
			crossobj.style.left=horzpos+"px"
			crossobj.style.top=vertpos+"px"
			
			eval("picture=document.form1.picture"+n+".value;");
			eval("description=document.form1.description"+n+".value;");
			str = "<table  bgcolor='#ffffff'>"; //width='" + wndwidth + "'
			str += "<tr valign='top'><td><div align='right' id='dragbar'><span id='closetext' onClick='closepreview()'>Close</span></div></td></tr>";
			str += "<tr valign='top'><td><img src='" + picture + "'  border='0' onload='javascript:if(this.width>wndwidth) {this.width=wndwidth; this.height=parseint(this.height*wndwidth/this.width); }'></td></tr>"; //width='" + wndwidth + "
			str += "<tr valign='top' bgcolor='#ececec'><td class='TextD'>" + description + "</td></tr>";
			str += "</table>";
			crossobj.innerHTML=str
			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 (dragapproved && (ie || ns6))
		{
			if (ie)
			{
				nleft = tempx + event.clientX - offsetx;
				ntop = tempy + event.clientY - offsety;
				nleftmin = parseInt(ietruebody().scrollLeft);
				ntopmin = parseInt(ietruebody().scrollTop);
				nleftmax = nleftmin + ietruebody().clientWidth;
				ntopmax = ntopmin + ietruebody().clientHeight;
			}
			else
			{
				nleft = tempx + e.clientX - offsetx;
				ntop = tempy + e.clientY - offsety;
				nleftmin = pageXOffset;
				ntopmin = pageYOffset;
				nleftmax = nleftmin + window.innerWidth;
				ntopmax = ntopmin + window.innerHeight;
			}
			nleftmax -= wndwidth;
			ntopmax -= wndheight;
			if (nleft < nleftmin)
				nleft = nleftmin;
			if (nleft > nleftmax)
				nleft = nleftmax;
			if (ntop < ntopmin)
				ntop = ntopmin;
			if (ntop > ntopmax)
				ntop = ntopmax;
			crossobj.style.left = nleft + "px";
			crossobj.style.top = ntop + "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")
