// JavaScript Document

mouseX = 0;
mouseY = 0;

var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    mouseX = event.clientX + document.body.scrollLeft
    mouseY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    mouseX = e.pageX
    mouseY = e.pageY
  }  
  // catch possible negative values in NS4
  if (mouseX < 0){mouseX = 0}
  if (mouseY < 0){mouseY = 0}  
  return true
}

function clearText(el) {
    document.getElementById(el).value = ""
}

function showSubImg(id,name) {
	var img = document.getElementById("subImg");
	if (img.src.indexOf(id) < 0) { //change image if not the right one
		img.src = "/product/thumb/" + id + "/"+name.toString().replace(" ","_")+".jpg";
	}
	img.style.top = mouseY-17 + "px";
	img.style.left = 364 + "px";
	img.style.display = "block";
}

function hideSubImg(id) {
	document.getElementById("subImg").style.display = "none";
}

function showBaskImg(id,name) {
	var img = document.getElementById("baskImg");
	if (img.src.indexOf(id) < 0) { //change image if not the right one
		img.src = "/product/thumb/" + id + "/"+name.toString().replace(" ","_")+".jpg";//"/images/products/featured/" + id + ".jpg";
	}
	img.style.top = 10 + "px";
	img.style.left = -51 + "px";
	img.style.display = "block";
}

function hideBaskImg(id) {
	document.getElementById("baskImg").style.display = "none";
}