// JavaScript Document
var height = 74;
var object = null;

function show(id) {
  object = document.getElementById(id);
  if (object.style.height > '1px') {
    return;
  }
  
  hide();
  
  height = 0;
  
  setTimeout("changeHeight()", 3);

}

function hide() {
  for (i=1; i<=6; i++) {
	try {
		document.getElementById('sm'+i).style.height = "1px";
	}
	catch (e) {
		
	}
  }
  
}

function changeHeight() {
  height = height + 4;
  if (height > 74) {
    height = 74;
  }
  object.style.height = height+"px";
  
  if (height < 74) {
    timeout = setTimeout("changeHeight()", 3);
  } else {
    clearTimeout(timeout);
  }
  
}

function showPicture(src, preview) {
	img = document.createElement("img");
	img.setAttribute("src",src);
	div = document.getElementById(preview);
	
	position = getMouseXY(document.body);
	div.style.top = position[0]+"px";
	div.style.left = (position[1] - 80) +"px";
	div.appendChild(img);
}

function hidePicture(preview) {
	document.getElementById(preview).innerHTML = "";
}

function getMouseXY(e) {
  IE = document.all?true:false;
  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
  return new Array(tempX, tempY);
}
