function smartColumns() { //Create a function that calculates the smart columns
    //Reset column size to a 100% once view port has been adjusted
	$("ul#offers").css({ 'width' : "100%"});

	var colWrap = $("ul#offers").width(); //Get the width of row
	var colNum = Math.floor(colWrap / 170); //Find how many columns of 300px can fit per row / then round it down to a whole number
	var colFixed = Math.floor(colWrap / colNum); //Get the width of the row and divide it by the number of columns it can fit / then round it down to a whole number. This value will be the exact width of the re-adjusted column

	$("ul#offers").css({ 'width' : colWrap}); //Set exact width of row in pixels instead of using % - Prevents cross-browser bugs that appear in certain view port resolutions.
	$("ul#offers li").css({ 'width' : colFixed}); //Set exact width of the re-adjusted column	
}

$(document).ready(function() {
  if(!document.getElementsByTagName) return;
  var links=document.getElementsByTagName("a");
  for(var i=0;i<links.length;i++) {
    var link=links[i];
    if(link.getAttribute("rel")=="external")link.target="_blank";
  }
  smartColumns();//Execute the function when page loads
});

$(window).resize(function () { //Each time the viewport is adjusted/resized, execute the function
	smartColumns();
});

function popUp(URL, width, height) {
  day = new Date(); id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + "');");
}