<!--

function openDiv(div_id, div_height, max_height, offset_txt, txt_pos, starting) {
  var div,s;
  var i = 1;
  while(true) {
    div = document.getElementById('paletteLeft'+i.toString());
    if(!div) { break; }
    s = div.style;
    if(s) {
      if(parseInt(s.height) > 0) {
        if((i != div_id) || ((i==div_id) && (starting)) ) {
          var t = "closeDiv('"+i+"',"+parseInt(s.height)+","+max_height+","+offset_txt+",0,"+"'"+div_id+"')";
          setTimeout(t,10);
          return true;
        }
      }          
    }
    i = i + 1;
  }
  div = document.getElementById('paletteLeft'+div_id);
  if(!div) {
    alert('paletteLeft'+div_id+' not found');
    return false;
  }
  s = div.style;
  if(!s) {
    return false;
  }
  if (s.display!="block") {
  	s.display="block";
  	s.visibility="visible";
  }
  if(div_height < max_height) {
    incr = (div_height < 10) ? 2 : (div_height < 25) ? 5 : ((max_height-div_height) < 16) ? 2 : 15;
    div_height = div_height + incr;
    if (div_height > max_height) { div_height = max_height; }
    div.height = div_height+"px";
    s.height = div_height+"px";
    
//    if (txt_pos >= offset_txt) {
      div = document.getElementById('paletteTxtLeft'+div_id);
      if(div) {
        s = div.style;
        if(s) {
	  if (s.display!="block") {
	  	s.display="block";
    	s.visibility="visible";
	  }
          txt_pos += incr;
          if (txt_pos > 0) { txt_pos = 0; }
          div.top = txt_pos+"px";
          s.top = txt_pos+"px";
        }
      }
//    }
    
    setTimeout("openDiv('"+div_id+"',"+div_height+","+max_height+","+offset_txt+","+txt_pos+",false)",30);
  }
  return true;
}
function closeDiv(div_id, div_height, max_height, offset_txt, txt_pos, nextDiv) {
  var div,s;
  div = document.getElementById('paletteLeft'+div_id);
  if(!div) {
    alert('paletteLeft'+div_id+' not found');
    return false;
  }
  s = div.style;
  if(!s) {
    return false;
  }
    if(div_height > 0) {
    incr = (div_height < 10) ? -2 : (div_height < 25) ? -5 : ((max_height-div_height) < 16) ? -2 : -15;
    div_height = div_height + incr;
    if(div_height < 0) {
      div_height = 0;
    }
    div.height = div_height+"px";
    s.height = div_height+"px";
    d_should_be = (div_height > 0) ? "block" : "none"; 
    v_should_be = (div_height > 0) ? "visible" : "hidden"; 
    if (s.display != d_should_be) {
    	s.display = d_should_be;
    	s.visibility = v_should_be;
    }
    div = document.getElementById('paletteTxtLeft'+div_id);
    if(div) {
      s = div.style;
      if(s) {
        txt_pos += incr;
        div.top = txt_pos+"px";
        s.top = txt_pos+"px";
      }
    }
    
    setTimeout("closeDiv('"+div_id+"',"+div_height+","+max_height+","+offset_txt+","+txt_pos+","+"'"+nextDiv+"')",30);
  }
  else {
    s.display = "none";
    s.visibility = "hidden";
    if(nextDiv != div_id) {
      setTimeout("openDiv('"+nextDiv+"',0,"+max_height+","+offset_txt+","+txt_pos+","+"false)",30);
    }
  }
  return true;
}

function preloadImages() {
  if(!document.aplImgs) document.aplImgs=new Array();
  var i,j=document.aplImgs.length,args=preloadImages.arguments; 
  for(i=0; i<args.length; i++) {
    document.aplImgs[j]=new Image; 
    document.aplImgs[j++].src=args[i];
  }

  return true;
}

//-->

