// JavaScript Document
var IE = document.all?true:false;
	var tempX = 0;
	var tempY = 0;
	var myWidth = 0;
	var myWidth = 0;

function showLargeImg(ImgName,e)
{
	if(ImgName.length > 0)
	{
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
		  
		var getEl = document.getElementById('MainBody');
		if(getEl)
		{
			
			getMouseXY(e);
			var olddiv = document.getElementById('LargeImgRollover');
			var placeholder = document.getElementById('LargeImgRolloverPlace');
			if(olddiv)
			{placeholder.removeChild(olddiv);}
			RollOverThumb = "<img style=\"1px solid #000000\" src=\"images/"+ImgName+"\" border=\"1\" />"
			
			var newdiv = document.createElement('div');
			newdiv.setAttribute('id','LargeImgRollover');
			newdiv.innerHTML = RollOverThumb;
			newdiv.style.position = "absolute";
			newdiv.style.top = setTop(e)+"px";
			newdiv.style.left = (tempX-450) + "px";
			newdiv.style.width = "252px";
			newdiv.style.height = "252px";
			newdiv.style.visibility = "visible";
			placeholder.appendChild(newdiv);
			placeholder.style.visibility = "visible";
		}
	}
}
function moveLargeImage(e)
{
	getMouseXY(e);
	var mvdiv = document.getElementById('LargeImgRollover');
	if(mvdiv)
	{
		mvdiv.style.top = setTop(e)+"px";
		mvdiv.style.left = (tempX-450) + "px";
		
	}
	else
	{
		//alert('no');	
	}
}

function hideLargeImg()
{
	var getEl = document.getElementById('LargeImgRolloverPlace');
	if(getEl)
	{
		var olddiv = document.getElementById('LargeImgRollover');
		if(olddiv)
		{getEl.removeChild(olddiv);}
	}
}

function getMouseXY(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
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
}

function setTop(e) {

	if (IE) { // grab the x-y pos.s if browser is IE
		if(((tempY)+30) > (myHeight+document.body.scrollTop))
			return(((myHeight+document.body.scrollTop)-335));
		else
			return((tempY-310))
	} else {  // grab the x-y pos.s if browser is NS
    	if(((tempY)+30) > (myHeight+window.pageYOffset))
			return(((myHeight+window.pageYOffset)-335));
		else
			return((tempY-310))
	}	
}
