function basket_add(id)
{
  img=document.getElementById("basket_sender_"+id);
  img.src="/index.php?SYS[submitter]=shop_cart&FORM[shop_cart][act]=add_prod&FORM[shop_cart][prodID]="+id;
  alert("Product added to your Shopping Cart.");
}

function basket_add_top(id)
{
  img=document.getElementById("basket_sender_top_"+id);
  img.src="/index.php?SYS[submitter]=shop_cart&FORM[shop_cart][act]=add_prod&FORM[shop_cart][prodID]="+id;
  alert("Product added to your Shopping Cart.");
}

function cookie_rul()
{
  this.getCookie = __GetCookie;
  this.setCookie = __SetCookie;
  this.delCookie = __DeleteCookie;
}

function __getCookieVal (offset)
{
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function __GetCookie (name)
{
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen)
  {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return __getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0)
      break;
  }
  return null;
}

function __SetCookie (name, value)
{
  var argv = __SetCookie.arguments;
  var argc = __SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}

function __DeleteCookie (name)
{
  var exp = new Date();
  exp.setTime (exp.getTime() - 1); // This cookie is history
  var cval = __GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}


var rul = new cookie_rul();

function bask_run()
{
  bb=document.getElementById("count_tov_in_bask");
  val=rul.getCookie("tavar_in_bask");
  if(val!=null)
    bb.innerHTML=val;
  bb=document.getElementById("tavar_price");
  val=rul.getCookie("tavar_price");
  if(val!=null)
    bb.innerHTML=val;
  setTimeout("bask_run();", 1000);
}
