
function ShowRow(rowID)
{
	var chunk = document.getElementById(rowID).style
    if(chunk.display == "")
	{
		chunk.display="none"
	}
	else
	{
		chunk.display=""
	}
}


function ShowProduct(imgSrc,retailProductID,replicatedID,templateID)
{
	newSrc = imgSrc.replace("_thumb","_large");
	document.getElementById("largeProductImage").src = newSrc;
	
	var ts = new Date()
	
	document.getElementById("productIFrame").src = "/productDescription.php?ID="+retailProductID+"&replicatedID="+replicatedID+"&templateID="+templateID+"&ts="+ts.getTime();
	
	yOffset = -400
	xOffset = 20
	
	if(mouseX > (f_clientWidth() - 400)) xOffset = -450
	if((mouseY - f_scrollTop()) < 50) yOffset = 0
	else if((mouseY - f_scrollTop()) < 100) yOffset = -40
	else if((mouseY - f_scrollTop()) < 200) yOffset = -140
	else if((mouseY - f_scrollTop()) < 300) yOffset = -190
	else if((mouseY - f_scrollTop()) < 350) yOffset = -240
	else if((mouseY - f_scrollTop()) < 400) yOffset = -290
	
	//document.getElementById("xPos").innerHTML = "X:"+mouseX+" Y:"+mouseY+" scrollTop:"+f_scrollTop();
	
	
	document.getElementById("productPopUp").style.top = mouseY + yOffset +'px'
	document.getElementById("productPopUp").style.left = mouseX + xOffset +'px'
	document.getElementById("productPopUp").style.display = "";
}

function HideProduct()
{
	document.getElementById("productPopUp").style.display = "none";
	document.getElementById("largeProductImage").src = "/images/spacer.gif";
	
	document.getElementById("productIFrame").src ="/blank.html";
}

// Keep Track of Mouse Position -----------------------------
if (!document.all)
document.captureEvents(Event.MOUSEMOVE)

// On the move of the mouse, it will call the function getPosition
document.onmousemove = getPosition;

// These varibles will be used to store the position of the mouse
var mouseX = 0
var mouseY = 0

// This is the function that will set the position in the above varibles 
function getPosition(args) 
{
  // Gets IE browser position
  if (document.all) 
  {
    mouseX = event.clientX + f_scrollLeft()
    mouseY = event.clientY + f_scrollTop()
  }
  
  // Gets position for other browsers
  else 
  {  
    mouseX = args.pageX
    mouseY = args.pageY
  }
}
// END Keep track of mouse positions =========================

// Browser Proof Window and Scroll Calculations -------------------------------------
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
// END Browser Proof Window and Scroll Calculations ====================================
