﻿$(function() {
  $(document).mousedown(function(e) {
    if(e.which == 2 || e.which == 3) {
      e.stopPropagation();
      e.preventDefault();
      e.returnValue = false;
      alert('This is a protected image!!');
      return false;
    }
  });
  document.oncontextmenu = function() { return false; }
});
function popupWin(url, w, h) {
    if (!url) return;
    w = w || 450;
    h = h || 500;
    t = ((screen.availHeight || $(window).height()) / 2) - (h / 2);
    l = ((screen.availWidth || $(window).width()) / 2) - (w / 2);
    window.open(url, '', 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l + ',scrollbars=1, resizable=1, status=0');
}

function mfRefreshBasket(pintItems, pdblPrice){
    $('#spnNumItems').html(""+pintItems);
    $('#spnPrice').html(""+pdblPrice);
}

function mfViewBasket() {
    popupWin(mstrRoot + '/Modules/ICB/Image Gallery/Web Pages/ViewBasket.aspx', 500, 450);
}

function mfBuyNow(pintIId) {
    popupWin(mstrRoot + '/Modules/ICB/Image Gallery/Web Pages/BuyNow.aspx?IId=' + pintIId, 500, 300);
}

function mfListView(gId) {
    if (gId) window.location.href = '?Mode=List&GId=' + gId;
    else if(window.location.toString().match(/Slide/)) window.location.href = window.location.toString().replace(/Slide/, 'List');
    else window.location.href = window.location.toString() + '&Mode=List';
}