var expireid;
var currPriceDIV;
var currPriceIMG;
var currPriceLeft;
var currPriceTop;

var error = new String('failed to load, try again!');
var lvars = new Array();

function expandclapsubtotal(aimg,id)
{
    var div = document.getElementById(id);
    var index=findVar(div);
    var elm;
    var isNew=false;
    if (index==lvars.length)
    {
        elm = new Array(3);
        lvars[index]=elm;
        isNew=true;
    }
    else
        elm = lvars[index];
    if (typeof div != 'undefined' && div!=null)
    {
	   if (isNew)
	     elm[0]=div;
	   var img = aimg.childNodes.item(0);
	   while (img!=null && img.nodeName != 'IMG')
         img = img.nextSibling;
	   if (isNew)
         elm[1]=img;
	   if (!isNew && elm[2]!=null)
	   {
	       hide_display(index);
	       if (div==currPriceDIV)
	          return;
	   }
	   currPriceDIV=div;
	   if (div.style.display == '' || div.style.display == 'block')
	   {
           if (typeof img == 'undefined' || img==null)
              return;
	       hide_display(index);
	   }
	   else
	   {
           if (typeof img == 'undefined' || img==null)
              return;

           img.src=imgDir(img.src) + 'minus1.gif';
	       getpos(img);
	       currPriceIMG=img;
	   if (typeof div.filters != 'undefined')
               div.filters.alpha.opacity=70;
           div.style.color="white";
           div.style.backgroundColor='white';
           div.style.display='';
           div.style.zIndex=1;
           div.style.left =currPriceLeft-50;
           div.style.top  =currPriceTop+15;
           elm[2]=window.setTimeout("hide_display("+index+")", 5000);
	   }
    }
}

function findVar(div)
{
    for (var i=0;i<lvars.length;i++)
    {
        var elm = lvars[i];
        if (elm[0]==div)
           return i;
    }
    return lvars.length;
}

function hide_display(index)
{
     var elm = lvars[index];
     if (typeof elm[0] != 'undefined' && elm[0]!=null)
        elm[0].style.display = 'none';
     if (typeof elm[1] != 'undefined' && elm[1]!=null)
         elm[1].src=imgDir(elm[1].src) + 'plus1.gif';
     window.clearTimeout(elm[2]);
     elm[2] = null;
}

function imgDir(source)
{
  return source.substring(0, source.lastIndexOf('/') + 1);
}

function getpos(o)
{
    currPriceLeft=0;
    currPriceTop=0;
    if (typeof o.offsetLeft != 'undefined')
    {
       do
       {
         currPriceLeft += o.offsetLeft;
         currPriceTop  += o.offsetTop;
         o = o.offsetParent;
       } while (o)
    }
}


