window.onload = function() {
  settings = {
    tl: { radius: 4 },
    tr: { radius: 4 },
    bl: { radius: 4 },
    br: { radius: 4 },
    antiAlias: true,
    autoPad: true
  }
  $('div.c').corner(settings);
  $('#bcSubscribe').corner(settings);

//  $("#keywords").autocomplete("/ajaxSearch.php", {
//    minChars: 3,
//    matchContains: 1,
//    cacheLength: 10,
//    formatItem: formatItem,
//    onItemSelect: selectItem,
//    selectOnly: 1
//  });
}

function selectItem(li) {
  if (li.extra) {
//    alert("That's '" + li.extra[0] + "' you picked.")
    return li.extra[0];
  }
}
function formatItem(row) {
  return row[0] + "<br><i>" + row[1] + "</i>";
}

function add2Basket(id, product_id) {
  var num = document.getElementById(id).value;
  var loc = '?action=buy_now&qty=' + num + '&products_id=' + product_id;
  document.location.href = loc;
  return false;
}

function launch_conditions() {
  window.open('conditions.php', 'Ugrip - Privacy', 'resizable=no, scrollbars=yes, width=800, height=600');
}
function launch_privacy() {
  window.open('privacy.php', 'Ugrip - Privacy', 'resizable=no, scrollbars=yes, width=800, height=600');
}

function confirmCheck(error_text) {
  if (document.getElementById('confirm_conditions').checked == false) {
    alert(error_text);
    return false;
  }
  document.checkout_confirmation.submit();
}
function setCartType(t) {
  $('#custom_ctype').attr('value', t.alt);
  $('#chooseCard').hide();
  $('#c_cardnum').after('<img src="'+t.src+'" alt="'+t.alt+'" style="padding-left:5px;" />');
  $('#paymentTable').show();
  $('#continue').show();
  return false;
}
