tmr = null;
clrTmr = null;
openDisplay = false;
blockClose = false;
function showSnapshotLink(id)
{
 if (openDisplay) return;
 var obj = getObject("snapshot_"+id);
 obj.style.display = "block";
 obj.style.visibility = "visible";
}
function hideSnapshotLink(id)
{
 var obj = getObject("snapshot_"+id);
 obj.style.display = "none";
 obj.style.visibility = "hidden";
}
function hidePopup()
{
 /*if (blockClose) return;
 if (tmr) window.clearTimeout(tmr);
 clrTmr = window.setTimeout('clearDescription(true)', 1000);*/
}
function hideProductPopup()
{
 /*if (blockClose) return;
 if (tmr) window.clearTimeout(tmr);
 clrTmr = window.setTimeout('clearProductDescription(true)', 1000);*/
}
function showPopup(id)
{
 /*if (clrTmr) window.clearTimeout(clrTmr);
 tmr = window.setTimeout("showDescription("+id+")",300)*/
}
function showProductPopup(id)
{
 /*if (clrTmr) window.clearTimeout(clrTmr);
 tmr = window.setTimeout("showProductDescription("+id+")",600);*/
}
function showProductDescription(id)
{
 //if (clrTmr) window.clearTimeout(clrTmr);
 //if (openDisplay) return;
 //clearProductDescription();
 openDisplay = true;
 hideSnapshotLink(id);
 new ajax("/showContent?name=product_popup&id="+id, {onComplete: showProductDesc}).request();
}
function activateFunctions(resp)
{
 var idx = -1;
 var txt = resp;
 while ( (idx=txt.indexOf("<script", idx+1)) > -1 )
 {
  var idx2 = txt.indexOf("</scr"+"ipt>", idx);
  var js = txt.substring(txt.indexOf(">", idx)+1, idx2);
  idx2 = idx;
  if (js.indexOf("function checkForm") == -1)
  {
   if (js.indexOf("function") > -1)
   {
    var idx3 = js.indexOf("(");
    var idx4 = js.indexOf(")");
    var f = js.substring(idx4+1);
    var fname = js.substring(js.indexOf("function")+8, idx3);
    eval(fname+" = function"+js.substring(idx3, idx4+1)+f);
   }
   else
   {
    eval(js);
   }
  }
 }
}
function showProductDesc(resp)
{
 var obj = getObject("product_popup_div");
 var shimElem = getObject("layerShim");
 activateFunctions(resp);
 var cartScript = "";
 var idx = resp.indexOf("function checkForm");
 if (idx > -1) cartScript = resp.substring( idx, resp.indexOf("</scr"+"ipt>", idx) );
 if (cartScript)
 {
  idx = cartScript.indexOf(")");
  var f = cartScript.substring(idx+2, cartScript.length-1);
  frmId = void(0);
  eval("checkForm = function() { "+f+" }");
  cart = function() { if (checkForm()) document.product_form.submit(); }
 }
 obj.innerHTML = resp;
 obj.style.visibility = "visible";
 shimElem.style.visibility = "visible";
 obj.style.display = "block";
 shimElem.style.display = "block";
 openDisplay = true;
 var x, y;
 if (self.innerHeight)
 {
  x = self.innerWidth;
  y = self.innerHeight;
 }
 else
 {
  if (document.documentElement && document.documentElement.clientHeight)
  {
   x = document.documentElement.clientWidth;
   y = document.documentElement.clientHeight;
  }
  else
  {
   if (document.body)
   {
    x = document.body.clientWidth;
    y = document.body.clientHeight;
   }
  }
 }
 //var top = (y / 2 - obj.offsetHeight / 2) + document.body.scrollTop;
 var top = document.body.scrollTop + 50;
 var left = x / 2 - obj.offsetWidth / 2;
 if (left <= 0) left = 10;
 obj.style.position = "absolute";
 obj.style.left = left + "px"
 obj.style.top = top + "px";
 shimElem.style.height = obj.offsetHeight;
 shimElem.style.width = obj.offsetWidth;
 obj.style.zIndex = 999999;
 shimElem.style.left = left + "px"
 shimElem.style.top = top + "px";
}
function showDescription(id)
{
 if (clrTmr) window.clearTimeout(clrTmr);
 if (openDisplay) return;
 clearDescription();
 var obj = getObject("desc_"+id);
 obj.style.visibility = "visible";
 obj.style.display = "block";
 openDisplay = true;
 var x, y;
 if (self.innerHeight)
 {
  x = self.innerWidth;
  y = self.innerHeight;
 }
 else
 {
  if (document.documentElement && document.documentElement.clientHeight)
  { 
   x = document.documentElement.clientWidth;
   y = document.documentElement.clientHeight;
  }
  else
  {
   if (document.body)
   { 
    x = document.body.clientWidth;
    y = document.body.clientHeight;
   }
  }
 } 
 var top = (y / 2 - obj.offsetHeight / 2) + document.body.scrollTop;
 var left = x / 2 - obj.offsetWidth / 2;
 if (left <= 0) left = 10;
 obj.style.position = "absolute";
 obj.style.left = left + "px"
 obj.style.top = top + "px";
}
function clearDescription(off)
{
 var i = 0;
 var obj = null;
 while ( (obj=getObject("desc_"+i++)) != null )
 {
  obj.style.visibility = "hidden";
  obj.style.display = "none";
 }
 if (off) openDisplay = false;
}
function clearProductDescription(off)
{
 var obj = getObject("product_popup_div");
 var shimElem = getObject("layerShim");
 obj.style.visibility = "hidden";
 obj.style.display = "none";
 shimElem.style.visibility = "hidden";
 shimElem.style.display = "none";
 if (off) openDisplay = false;
}

