Hi ,
I' am currently coding a checkout function , so that when a user clicks add to bag from the product list , a small 'slide-down' bag update occurs , i have coded the slidedown but my problem is trying to call the slider when the 'add to bag' is clicked. (Because the javascript creates its own function while building) its not as easy as just calling the function onclick of the 'add to bag '. could someone please help with this issue , i cant figure it out ,

here is my javascript
Code:
var array = new Array();
var speed = 10;
var timer = 10;
// Loop through all the divs in the slider parent div //
// Calculates each content divs height and set it to a variable //


function slider(target,showfirst,num) {

 var slider = document.getElementById(target);
 var divs = slider.getElementsByTagName('div');
 var divslength = divs.length;
  for(i = 0; i < divslength; i++) {
    var div = divs[i];
    var divid = div.id;
   
 
 
if(num == '1'){   
   
   
       if(divid.indexOf("header") != -1 ) { 
    
         div.onclick = new Function("processClick(this)");
		 
		 
		 } 
       
      else if(
 
         divid.indexOf("content") != -1) {
         
            div.maxh = div.offsetHeight;
       
        if(showfirst == 1 && i == 1) { 
           div.style.display = 'block';
           } else {       
            div.style.display = 'none';        }    
         }  
   }
  
  
  }
  
  
  
  
  
}



// Process the click - expand or collapse  //


function processClick(div) {

   var head = document.getElementById('three-header');  
   var cont = 'three-content';    
   var contdiv = document.getElementById(cont);      
   clearInterval(contdiv.timer);   

 if(head == div && contdiv.style.display == 'none') {

     contdiv.style.height = '0px';        
     contdiv.style.display = 'block';      
     initSlide(cont,1);
  } else if(contdiv.style.display == 'block') {
   initSlide(cont,-1);  
  }  
 }


// Setup the variables and call the slide function //

function initSlide(id,dir) {
  var cont = document.getElementById(id);  
  var maxh = cont.maxh;
  cont.direction = dir;  
  cont.timer = setInterval("slide('" + id + "')", timer);}

// Collapse or expand the div by incrementally changing the divs height and opacity //

function slide(id) { 
  var cont = document.getElementById(id);
  var maxh = cont.maxh;
  var currheight = cont.offsetHeight; 
  var dist;  
 if(cont.direction == 1) {   
   dist = (Math.round((maxh - currheight) / speed));  
 } else {  
 dist = (Math.round(currheight / speed - 2.3));  }  

 if(dist <= 1) { 
  dist = 1;
  }
  cont.style.height = currheight + (dist * cont.direction) + 'px';
  cont.style.opacity = currheight / cont.maxh;
  cont.style.filter = 'alpha(opacity=' + (currheight * 100  / cont.maxh + 20) + ')';
   if(currheight < 2 && cont.direction != 1) {  
  cont.style.display = 'none';
  clearInterval(cont.timer);
 } else if(currheight > (maxh - 2) && cont.direction == 1) {
  clearInterval(cont.timer);  }}



//Set time for automatice div collapse//


function timeoutclose( ){
setTimeout("processClick(content)",4000);

}




function processDrop(num){
	
if(num == 1){
	setTimeout("processClick(content)",4000);
  } 
	  
}
HERE IS THE HTML

Code:
<script type="text/javascript">
function addtocart(sku, quantity) {
new Ajax.Request('/cgi-bin/lushdb/ajax/add.html?sku='+sku+'&quantity='+quantity,
  {
    method:'get',
    onSuccess: function(transport){
      var response = transport.responseText || "no response text";
document.getElementById("bagitems").innerHTML=response;
document.getElementById("bagitemsb").innerHTML=response;
    },
    onFailure: function(){ alert('AJAX Failure') }
  });
}
</script>
[/seti]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>JavaScript Slider Example</title>
<link rel="stylesheet" href="/lush/css/slider.css" type="text/css" />
<script type="text/javascript" src="/lush/js/slider.js"></script>
[scratch dynameta]
</head>
<body onLoad="slider('slider',0,1)">

<br><br>
<div align="right" OnClick="timeoutclose()" style="border-bottom: 1px solid #9ac1c9; width: 630px; margin: 0px;">


<div id="slider"  align="left" style="margin: 0; margin-right: 13px;">

  <div class="header" id="three-header" >
<div style="font-size: 11px; font-family: verdana, helvetica, sans-serif; color: rgb(68, 68, 68); margin-top: 5px; padding-left: 15px; padding-top: 16px;"> 


<b> MY Account</b>
<br>
Sign in
<br>
Track order
<br>
</div>

<div style="margin-top: 6px; padding-top: 3px; padding-left: 10px; height: 20px; width: 144px; margin-left: 8px; background: #DBFEF8;">
<span id='bagitems'>0 items</span> in <b>my bag</b>
</div>



</div>
  <div class="content" id="three-content" name="content" style="position: absolute; z-index: 99; ">
    <div class="text" style="font-size: 11px; color: rgb(68, 68, 68);">  <br>Your Bag has <span id='bagitemsb'>0 items</span>
<br><br>
<b>Subtotal:</b> $<span id='bagsubtotal'>0.00</span>
<br>
<div OnClick="processClick(content)" style="margin-right: 2px; position: relative; font-size: 11px; top: 14px; float: right; font-weight: bold; color: #457371; cursor: pointer;">
x</div>
<br>


 <a href="" style="font-size: 11px; color: #457371; text-decoration: none;">&raquo; <b>view bag</b></a>

    </div>
  </div>
</div>
</div>
<div style="position: absolute; z-index: 1; width: 630px;">
Testing area , this text shows how the drop down will overlay over the content underneath , and not push the content down as the accordion would , blah blah blah
and it shows how the fly out or drop down or whatver has a fade in/fade out effect 
<Br><br>
<a href='#' onClick="slider('slider',0,1); addtocart('00032','1');">Add 00032</a>


</div>
</body>
</html>

as you can see iam just using the slider function with the link for now , but i have tried everything i can think of believe me , *note , iam basically trying to do somethin glike the gap has on their site with the add to bag--> www.gap.com
Hope someone can help , thanks alot
-Johnny