function resize(which, max) {
  var elem = document.getElementById(which);
  if (elem == undefined || elem == null) return false;
  if (max == undefined) max = 100;
  if (elem.width > elem.height) {
    if (elem.width > max) elem.width = max;
  } else {
    if (elem.height > max) elem.height = max;
  }
}

function menuMouseOver(id) {
   var img = document.getElementById(id);
   img.src = 'images/'+id+'_hover.jpg';
}
function menuMouseOut(id) {
   var img = document.getElementById(id);
   img.src = 'images/'+id+'.jpg';
}

function onEnterSubmit( evt, frmId ) {
   var keyCode = null;

   if( evt.which ) {
      keyCode = evt.which;
   } else if( evt.keyCode ) {
      keyCode = evt.keyCode;
   }
   if( 13 == keyCode ) {
      frm.submit();
   }
   return true;
}

function adjustHeight() {
   var contentDiv = document.getElementById('content_data');
   if(contentDiv.offsetHeight < 400) {
      contentDiv.style.height = '400px';
   }
}

function adjustLeftPanelHeight() {
   var right = document.getElementById('merchandise_right');
   var left = document.getElementById('merchandise_left');
   right.style.height = left.offsetHeight+20;
}

function hide(el) {
   el.childNodes[0].style.visibility = 'hidden';
}
function show(el) {
   el.childNodes[0].style.visibility = 'visible';
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}