function popup(url,width,height,win_name)
{
    var win_height = 400;
    var win_width  = 600;

    if(parseInt(navigator.appVersion)>3)
    {
      if (navigator.appName=="Netscape")
      {
        win_width  = window.innerWidth;
        win_height = window.innerHeight;
      }
    }
    if (navigator.appName.indexOf("Microsoft")!=-1)
    {
      win_width  = document.body.offsetWidth;
      win_height = document.body.offsetHeight;
    }

    var top = Math.round((win_height - height)/2);
    if(top < 0) top = 0;

    var left = Math.round((win_width - width)/2);
    if(left < 0) left = 0;

    mywindow = window.open(url,
               win_name,
               'height='+ height +',width='+ width +',toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1' +
               ',top='+ top +', left='+ left +''
               );
}

function add_to_cart(id,qty,ref)
{
   popup('http://www.yoto.org/cart.php?action=add_product&new_product=' + id + '&qty=' +  qty + '&ref=' + ref,'810','610','cart');
}

function view_cart()
{
 popup('http://www.yoto.org/cart.php','810','610','cart');
}

function view_details(p)
{
 popup('http://yoto.org/details.php?p=' + p,'410','410','detail');
}
