ResizeBox = function(containId, contentClass, clearClass, minWidthContain, minWidthContent, marginWidthR, marginWidthL)
{
    var promoBoxContainerId = containId;
	var promoBoxClassName = contentClass;
    
    if (!document.getElementById(promoBoxContainerId)){return;}

	// this is the smallest width that the centre panel can shrink to
	var minContainerWidth = minWidthContain;
	var minPromoBoxWidth = minWidthContent;
	var promoboxMarginWidthR = marginWidthR;
	var promoboxMarginWidthL = marginWidthL;
	var promoboxMarginWidth = parseInt(promoboxMarginWidthR) + parseInt(promoboxMarginWidthL);
	
    // returns an array of promobox elements
    var promoBoxArray = getElementsByClass(promoBoxClassName,null,"div");
    var promoBoxClearArray = getElementsByClass(clearClass,null,"div");
    var promoBoxCount = promoBoxArray.length;	
    
    // find out what the current width of the centre panel is
    var centrePanel = document.getElementById(promoBoxContainerId);
	
    // a DOM bug in Firefox versions prior to 1.5 gives us an incorrect offsetWidth value - this sorts it out!
    if(is_fx && (parseInt(is_minor)<1.5)){centrePanel.style.position = "absolute";}
    var containerWidth = parseInt(centrePanel.offsetWidth);	
    if(is_fx && (parseInt(is_minor)<1.5)){centrePanel.style.position = "relative";}
    // compensate for a rendering bug in Opera by making the container width smaller
    if(navigator.userAgent.toLowerCase().indexOf('opera')!=-1){containerWidth -= 20;}

	// a safety check to make sure we don't have a smaller centre panel than we expect
	if (containerWidth < minContainerWidth){containerWidth = minContainerWidth;}
	
	// Work out how many promo boxes we can fit on each row
	var promoBoxesPerRow = parseInt(containerWidth / minPromoBoxWidth);	
	if (promoBoxesPerRow > promoBoxCount){promoBoxesPerRow = promoBoxCount;}
	
	// figure out how wide each promo box should be
	var newPromoBoxWidth = parseInt(containerWidth / promoBoxesPerRow)-1;
	newPromoBoxWidth -= promoboxMarginWidth;
	// hack for FF rendering issue when there are only 2 boxes available and they both appear on one line
	if((promoBoxCount == 2) && (promoBoxesPerRow == 2) && (is_fx)){newPromoBoxWidth -= 8}
	// iterate through the promo boxes applying width and margin to each
	for (var i=0;i<=promoBoxArray.length-1;i++){
		
		promoBoxClearArray[i].className = clearClass;
		
		// the end box of each row should be handled differently (ie; 0 margin)
		if (((i+1) / promoBoxesPerRow).toString().indexOf(".") == -1)
		{
            promoBoxArray[i].style.marginRight = 0;
            promoBoxClearArray[i].className += " lastcolumn";
		}
		else
		{
		    promoBoxArray[i].style.marginRight = promoboxMarginWidthR + "px";
		}
		promoBoxArray[i].style.marginLeft = promoboxMarginWidthL + "px";
	    promoBoxArray[i].style.width = newPromoBoxWidth + "px";
	}
}


function getElementsByClass(searchClass,node,tag) {
  var classElements = new Array();
  if (node == null)
    node = document;
  if (tag == null)
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if (pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

function roll_over(img_name, img_src)
   {
	  // alert(img_src+" "+img_name);
   document[img_name].src = img_src;
   }