function imgpopup(path) {
   path = 'http://www.customautotrim.com/bodykits/extreme-dimensions/' + path;
   popUpWindow = window.open(path, "openWin", "width=700,height=600,resizable,scrollbars");
   window.popUpWindow.focus();
}
function trimAll(sString) {
   while (sString.substring(0,1) == ' ') {
      sString = sString.substring(1, sString.length);
   }
   while (sString.substring(sString.length-1, sString.length) == ' ') {
      sString = sString.substring(0,sString.length-1);
   }
   return sString;
}

function init () {
	var tabs = document.getElementById('navlist');
	for (var i = 0; i < tabs.childNodes.length; i++) {
		tabs.childNodes[i].onclick = function () {
			focusTab(this.innerHTML);
		}
	}
}

function focusTab( topTab ) {
	var tabs = document.getElementById('navlist');
	for (var i = 0; i < tabs.childNodes.length; i++) {
      var node = tabs.childNodes[i];
      if( node.innerHTML == topTab ) {
         node.className = "active";
      } else {
         node.className = "";
      }
   }

   var cs = document.getElementById('conts');
	for (var i = 0; i < cs.childNodes.length; i++) {
      var node = cs.childNodes[i];
      if( trimAll(topTab) == 'All' ) {
         node.className = "activeCont";
      } else if( node.id == trimAll(topTab) ) {
         node.className = "activeCont";
      } else {
         node.className = "hide";
      }
   }
}