function addToCompareList(pid) {
  var comparewnd = window.open('compare.php?func=add&pid=' + pid, 'comparewindow');
  if (comparewnd) {
    comparewnd.focus();
  }
}

var previewwnd;
function showBigPic(picdir, picfile) {
  previewwnd = window.open('bigpic.php?picdir='+picdir+'&picfile='+picfile,'previewwnd','toolbar=no,resizable=no,width=420,height=420,top='+Math.floor((screen.height-420)/2)+',left='+Math.floor((screen.width-420)/2));
  previewwnd.focus();		
}

var printerfriendlypage;
function printPage(prodid) {
  var pagewidth = 580;
  var pageheight = 700;
  
  printerfriendlypage = window.open('product.php?pid='+prodid+'&printerfriendly=1','printerfriendlypage','scrollbars=yes,toolbar=no,resizable=yes,width='+pagewidth+',height='+pageheight+',top='+Math.floor((screen.height-pageheight)/2)+',left='+Math.floor((screen.width-pagewidth)/2));
  printerfriendlypage.focus();		
}

function openWindow(url, windowname, width, height) {
  var newpage = window.open(url, windowname, 'scrollbars=no,toolbar=no,resizable=no,width='+width+',height='+height+',top='+Math.floor((screen.height-height)/2)+',left='+Math.floor((screen.width-width)/2));
  newpage.focus();		
}

function addToCart(id) {
  var command = 'func=new&pid='+id;

  var cart = window.open('/cart/index.php?'+command,'cart','toolbar=no,resizable=no,width=620,height=460,left='+Math.floor((screen.width-620)/2)+',top='+Math.floor((screen.height-460)/2));
  cart.focus();
}

function showCart(){
  var cart = window.open('/cart/index.php','cart','toolbar=no,resizable=no,width=620,height=460,left='+Math.floor((screen.width-620)/2)+',top='+Math.floor((screen.height-460)/2));
  cart.focus();
}
