function resizeImage()
{
  try
  {
		if(document.getElementById('product-image').width > 240)
		{
			desiredWidth = 240;
			currentHeight = document.getElementById('product-image').height * 1;
			currentWidth = document.getElementById('product-image').width * 1;
			ratio = desiredWidth / currentWidth;
			
			document.getElementById('product-image').height = currentHeight * ratio;
			document.getElementById('product-image').width = desiredWidth;
		}
		
		document.getElementById('product-image').style.visibility = "visible";
  }
  catch(err)
  {
    // do nothing
  }
}

addLoadEvent(externalLinks);

function externalLinks() {
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
      anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
    }
  resizeImage();
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}