//<script=text/javascript>
 var on_buy_image = new Image (67, 24);
 on_buy_image.src="/images/btn_buy_green.gif";
 
 function buy (control, product, price)
 {
  var old_image = control.getElementsByTagName('img')[0];
  old_image.src = on_buy_image.src;  
  var poststr = "product=" + product + "&price=" + price;
  ajaxpack.postAjaxRequest("/cart/addtocart.php", poststr, buy_callback, "XML")
 }
 
 //Define call back function to process returned data
 function buy_callback(){
    var myajax=ajaxpack.ajaxobj
    var myfiletype=ajaxpack.filetype
    if (myajax.readyState == 4){ //if request of file completed
      if (myajax.status==200 || window.location.href.indexOf("http")==-1){          
        
        var xmldoc = response2xml(myajax);            		   
        var count = xmldoc.getElementsByTagName('count')[0].childNodes[0].nodeValue;   
        var total = xmldoc.getElementsByTagName('total')[0].childNodes[0].nodeValue;
        var show_message = xmldoc.getElementsByTagName('message')[0].childNodes[0].nodeValue;
        
        document.getElementById('cart_total').innerHTML = total;
        document.getElementById('cart_count').innerHTML = count;
        
        if (show_message==1) tb_show ("", "/cart/buymessage.php?TB_iframe=true&width=430&height=250","");
      }
    }
 }
 
 