var maxFreeItems = 3

function setItems(item, increment) {
  if (countCheckboxes() > maxFreeItems) {
    item.checked = false
    alert('You have chosen the maximum number of floor types. Now click on GO to continue. ')
  }
}

function checkItems() {
  if (countCheckboxes() == 0) {
    alert("Select up to three flooring categories and then select Go");
    return false;
  }
  return true;
}

function countCheckboxes() {
  var itemCount = 0;
  var cBoxes = document.forms['frm_floorcompare1'].elements;
  for (i = 0; i < cBoxes.length; i++) {
    if (cBoxes[i].checked) {
      itemCount++;
    }
  }
  return itemCount;
}

function a_popupToFront() {
  w = window.open('', 'eieio', 'width=800,height=600');
  if (w.location.href == 'about:blank') {
    w.location.href = "/resflram/na/home/en/us/fs.asp";
  }
  w.focus();
  return false;
}

function printStyle() {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1) {
       if(a.getAttribute("title") == "fbg")
         a.href = '/htmlassets/buyers-guide/style/fbg-print.css';
     }
   }
}
