function rollover()
{
	var links, i;
	links = document.getElementsByTagName('a');
	for(i =0;i < links.length; i++)
	{
		if(/over/.test(links[i].className))
		{
			//var url = this.href;
			links[i].onmouseover = function(){appear(1, this);}; //show the image;
			links[i].onmouseout = function(){appear(0, this);};//close the image;
			//links[i].onclick = function(){popit(url);};
				
		}
	}
}

function appear(num, node)
{
	 
	var href = node.getAttribute('href')
	//alert(href);
	if(num==1)
	{
		var enlarged = document.getElementById('enlarged');
		var img = enlarged.firstChild;
		img.setAttribute('src', href); 
		enlarged.style.display = 'block';
		checkPosition();
	}
	else
	{
		document.onmousemove = null;
		var enlarged = document.getElementById('enlarged');
		enlarged.style.display = 'none';
	}
}

function checkPosition()
{
	document.onmousemove = getCoords;
	var enlarged = document.getElementById('enlarged');
	//enlarged.onmouseover = function(){appear(1);};
}	


function getCoords(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	
	//get the dimensions of the screen
	//var screenWidth = self.screen.availWidth;
	//var screenHeight = self.screen.availHeight;
	
	var screenWidth = document.body.clientWidth;
	var screenHeight = document.body.clientHeight;
	
	//get the dimensions of the image
	if(document.getElementById('enlarged').firstChild.src != '')//if image is loaded
	{
		var myImage = new Image();
		myImage.src = document.getElementById('enlarged').firstChild.src;
		var imgHeight = myImage.height;
		var imgWidth = myImage.width;
	}
	// posx and posy contain the mouse position relative to the document
	var enlarged = document.getElementById('enlarged');
	enlarged.style.top = 5 + posy + "px";
	enlarged.style.left = 5 + posx + "px"; 
	
	//if too goes off right side
	if ((imgWidth + posx) > screenWidth)
	{
		enlarged.style.left = posx - imgWidth - 5 + "px";
	}
	//if goes off bottom
	if ((imgHeight + posy) > screenHeight) 
	{
		enlarged.style.top = posy - imgHeight - 5 + "px"; 
		//if goes off top
	}
}

/*
function popit(url){
	//alert(url);
	var newwindow=window.open(url,'','height=400,width=400');
	if (window.focus) {newwindow.focus()}
	return false;
}
*/