var sh_thumb = false;

function sh_thumb_open( event, linkNode, urlToOpen )
{
	var append = false;
	
	var moveTop  = -50;
	var moveLeft = 100;
	
	if( !sh_thumb )
	{
		append = true;				
		sh_thumb = document.createElement( 'div' );
		sh_thumb.style.position = "absolute";
		
		var img = document.createElement( 'img' );
		sh_thumb.appendChild( img );
		
	}
	else
	{
		img = sh_thumb.getElementsByTagName( "img" ).item( 0 );
	}
	img.style.display = "none";

	img.src = urlToOpen;	
	
	sh_thumb.id          = "sh_thumb";
	sh_thumb_position( event, sh_thumb, moveTop, moveLeft );

	if( append )
	{
		document.body.appendChild( sh_thumb );
	}
	
	linkNode.onmousemove = function( e ){	
		sh_thumb_position( e, sh_thumb, moveTop, moveLeft );		
	};
	
	
	sh_thumb.style.display = "block";
	img.style.display = "inline";	
}

function sh_thumb_position( event, sh_thumb, moveTop, moveLeft )
{

	wScrollTop = window.pageYOffset ? window.pageYOffset : 0;
	if( wScrollTop == 0 )
	{
	          wScrollTop = document.documentElement ? document.documentElement.scrollTop : 0;
	}
	
	if( wScrollTop == 0 )
	{
	          wScrollTop = document.body ? document.body.scrollTop : 0;
	}
	
	sh_thumb.style.top    = event.clientY + moveTop + wScrollTop  + "px";
	sh_thumb.style.left   = event.clientX + moveLeft + "px";

	
	
}

function sh_thumb_close()
{
	sh_thumb.style.display = "none";
	sh_thumb.getElementsByTagName( 'img' ).src = "images/default.jpg";
}