function getBrowserWidth ()
{  
  if ( window.innerWidth ) { return window.innerWidth; }  
  else if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }  
  else if ( document.body ) { return document.body.clientWidth; }  
  return 0;  
} 

function getBrowserHeight ()
{  
  if ( window.innerHeight ) { return window.innerHeight; }  
  else if ( document.documentElement && document.documentElement.clientHeight != 0 ) { return document.documentElement.clientHeight; }  
  else if ( document.body ) { return document.body.clientHeight; }  
  return 0;  
} 

function getAppropriateBoxHeight ()
{
  topMargin = 40;
  botMargin = 40;
  return getBrowserHeight - topMargin + botMargin;
}

function view_cart(product_code)
{
}

//
// popup window support
//
// Usage:
// <a class="popup" href="foo.html">foo</a>
//
var PopupWindow = Class.create();
PopupWindow.prototype = {
    initialize: function(className, parentElement) {
        var elements = document.getElementsByClassName(className, parentElement);
        for (var i = 0, len = elements.length; i < len; i++) {
            Event.observe(elements[i], 'click', this.addPopupEvent.bindAsEventListener(this));
            Event.observe(elements[i], 'keypress', this.addPopupEvent.bindAsEventListener(this));
        }
    },
    addPopupEvent: function(event) {
        var element = Event.element(event);
        var link = element.getAttribute('href');
        window.open(link,'_blank','height=600,width=516,scrollbars=yes,resizable=yes');
        Event.stop(event);
    }
};

Event.observe(window, 'load', function () {
    new PopupWindow('popup');
});


function submitAction (form, label) {
  form.btn_submit.disabled = true;
  form.btn_submit.value = label;
  form.submit();
}

