function sectionInit() {
	MM_preloadImages(
		'http://hrssports.com/live/productpg/img/btn/descriptionTab-hover.png',
		'http://hrssports.com/live/productpg/img/btn/descriptionTab-off.png',
		'http://hrssports.com/live/productpg/img/btn/reviewsTab-hover.png',
		'http://hrssports.com/live/productpg/img/btn/reviewsTab-on.png',
		'http://hrssports.com/live/productpg/img/btn/specsTab-hover.png',
		'http://hrssports.com/live/productpg/img/btn/specsTab-on.png',
		'http://hrssports.com/live/productpg/img/btn/videosTab-hover.png',
		'http://hrssports.com/live/productpg/img/btn/videosTab-on.png');
}

function clickTab(el, productId) {
	var tabs = new Array('description','specs','videos','reviews');
	for (m=0; m<tabs.length; m++) {
		if (document.getElementById(tabs[m]+'Tab')) {
			document.getElementById(tabs[m]+'Tab').className = (tabs[m]+'Tab' == el) ? 'p_'+tabs[m]+'Tab-on' : 'p_'+tabs[m]+'Tab-off';
			document.getElementById(tabs[m]+'Area').className = (tabs[m]+'Tab' == el) ? 'p_infoAreaSelected' : 'p_infoAreaUnselected';
		} 
		else if (document.getElementById(productId+'_'+tabs[m]+'Tab')) {
			document.getElementById(productId+'_'+tabs[m]+'Tab').className =
				(productId+'_'+tabs[m]+'Tab' == el) ? 'p_'+tabs[m]+'Tab-on' : 'p_'+tabs[m]+'Tab-off';
			document.getElementById(productId+'_'+tabs[m]+'Area').className =
				(productId+'_'+tabs[m]+'Tab' == el) ? 'p_infoAreaSelected' : 'p_infoAreaUnselected';
		}
	}
}


// Filter Script
var isSportHomepage = document.getElementById('isSportHomepage').value;
var isProductTypeHomepage = document.getElementById('isProductTypeHomepage').value;
if ((isSportHomepage == "") && (isProductTypeHomepage == "")) {
	var isChartList = (document.getElementById('isChartList').value) ? true : false;
	var isBioList = (document.getElementById('isBioList').value) ? true : false;
	var numberOfProducts = document.getElementById("numberOfProducts").value;
	var numberOfLevels = 5;
	var productRows = document.getElementById("productRows").value;
	var productColumns = document.getElementById("productColumns").value;
	var currentPage = 1;
	var lastItem = 1;
	//var paginationText = document.getElementById("pageNav").innerHTML;
	var numberFilteredProducts = 0;
	var isFiltered = false;
	var prices = new Array();
	var priceRangeMin = new Array();
	var priceRangeMax = new Array();
	var rangeText = "";
	var minPrice = -1;
	var thisPrice = -1;
	var maxPrice = -1;
	var rangeIncrements = 50;
	var isInited = false;
	var currentMin = 0;
	var currentMax = 0;
	var rangeIncrements = 0;
	var products = new Array();	
	var itemsPerPage = productRows * productColumns;
	var k = 1;
}	
	function filterInit() {
		if ((isSportHomepage == "") && (isProductTypeHomepage == "")) {
			((isChartList == "") && (isBioList == "")) ? fixFields() : false;
			isFiltered = false;
			showPageNav(1);				
			showRecords(1, isFiltered);	
			isInited = true;
		}
	}
	function fixFields() {
		if (!isInited) {
			for (i=1; i <= numberOfProducts; i++) {
				var p = document.getElementById("product"+i+"price").value;
				if (document.getElementById("product"+i+"price").value = (isNaN(p))) {
					p = p.replace ("$", "");
					p = p.replace (",", "");
					document.getElementById("product"+i+"price").value = p
				} else {
					document.getElementById("product"+i+"price").value = p;
				}
			}
		}
	}
	function showRecords(page, filtered) {
		var oldPage = currentPage;
		document.getElementById('showAllPage').className = 'pg-normal';
		document.getElementById('showAllPageBottom').className = 'pg-normal';
		showPageNav(page);
		document.getElementById('pg'+currentPage).className = 'pg-normal';
		(document.getElementById('pg'+currentPage+'Bottom')) ? 
			document.getElementById('pg'+currentPage+'Bottom').className = 'pg-normal' : false;
		currentPage = page;
		document.getElementById('pg'+page).className = 'pg-selected';
		(document.getElementById('pg'+page+'Bottom')) ?
			document.getElementById('pg'+page+'Bottom').className = 'pg-selected' : false;

		var start = (page - 1) * itemsPerPage + 1;
		var thisAProductPrice = 0;
		var thisIProductPrice = 0;
		if(!isInited) {
			maxPrice = -1;
			minPrice = -1;
			thisPrice = -1;
			prices = new Array();
		}
		for (b=1; b<=numberOfProducts; b++) {
			document.getElementById("product"+b).style.display = "none";
		}
		for (a = start, i=1; i <= numberOfProducts; a++, i++) {
			if (isFiltered) {
				if (i <= itemsPerPage && a <= products.length) {
					(navigator.appName == "Microsoft Internet Explorer" && a <= products.length) ?
						document.getElementById("product"+products[a-1]).style.display = "inline" 
						: document.getElementById("product"+products[a-1]).style.display = "inline-block";
					lastItem = products[a-1];
				} else {
					(a <= products.length) ? 
						document.getElementById("product"+products[a-1]).style.display = "none" 
						: false;
				}
			} else {
				if (i <= itemsPerPage && a <= numberOfProducts) {
					(navigator.appName == "Microsoft Internet Explorer") ? 
						document.getElementById("product"+a).style.display = "inline" 
						: document.getElementById("product"+a).style.display = "inline-block";
					lastItem = a;
				} else {
					(a <= numberOfProducts) ? 
						document.getElementById("product"+a).style.display = "none" 
						: false;
				}
			}
			if(!isInited && (isChartList == "") && (isBioList == ""))
				getMinMax(a);
		}
		if ((!isInited) && (isChartList == "") && (isBioList == ""))
			getPriceRanges(minPrice, maxPrice);
	}
	function showPageNav(currentPage) {
		var output = "";
		var outputBottom = "";
		var productsToPaginate = (numberFilteredProducts > 0) ? numberFilteredProducts : numberOfProducts;
		var numberOfPages = Math.ceil(productsToPaginate / itemsPerPage);
		outputBottom = output = (currentPage > 1) ? 
			"<span class=\"pg-normal\" onclick=\"showRecords(1,"+isFiltered+");\"><<</span>&nbsp;&nbsp;<span class=\"pg-normal\" onclick=\"showRecords("+(currentPage-1)+","+isFiltered+");\"><</span>&nbsp;&nbsp;" 
			: "<span class=\"hiddenText\"><<</span>&nbsp;&nbsp;<span class=\"hiddenText\"><</span>&nbsp;&nbsp;";
		for (i=1; i <= numberOfPages; i++) {
			output += "<span id=\"pg"+i+"\" class=\"pg-normal\" onclick=\"showRecords("+i+","+isFiltered+");\">"+i+"</span>&nbsp;";
			outputBottom += "<span id=\"pg"+i+"Bottom\" class=\"pg-normal\" onclick=\"showRecords("+i+","+isFiltered+");\">"+i+"</span>&nbsp;";
		}
		output += (numberOfPages > 1 && currentPage < numberOfPages) ? 
			"&nbsp;<span class=\"pg-normal\" onclick=\"showRecords("+(currentPage+1)+","+isFiltered+");\">></span>&nbsp;&nbsp;<span class=\"pg-normal\" onclick=\"showRecords("+numberOfPages+","+isFiltered+");\">>></span>" 
			: "&nbsp;<span class=\"hiddenText\">></span>&nbsp;&nbsp;<span class=\"hiddenText\">>></span>";
		outputBottom += (numberOfPages > 1 && currentPage < numberOfPages) ? 
			"&nbsp;<span class=\"pg-normal\" onclick=\"showRecords("+(currentPage+1)+","+isFiltered+");\">></span>&nbsp;&nbsp;<span class=\"pg-normal\" onclick=\"showRecords("+numberOfPages+","+isFiltered+");\">>></span>" 
			: "&nbsp;<span class=\"hiddenText\">></span>&nbsp;&nbsp;<span class=\"hiddenText\">>></span>";
		output += " <span id=\"showAllPage\" class=\"pg-normal\" onclick=\"showAll('showAllPage', "+isFiltered+");\">View All</span>";
		outputBottom += " <span id=\"showAllPageBottom\" class=\"pg-normal\" onclick=\"showAll('showAllPageBottom', "+isFiltered+");\">View All</span>";
		document.getElementById("pageNav").innerHTML = output;
		if (document.getElementById("pageNavBottom")) {document.getElementById("pageNavBottom").innerHTML = outputBottom; }
	}
	function filterList(min, max) {
		(document.getElementById('priceFilter'+currentMin)) ? document.getElementById('priceFilter'+currentMin).className = 'filter-normal' : false;
		currentMin = min;
		currentMax = max;
		document.getElementById("priceFilter"+min).className = 'filter-selected';
		var listPosition = 0;
		products = new Array();
		var startProduct = 1;
		for (counter = startProduct; counter <= numberOfProducts; counter++) {
			var thisProductPrice = parseInt(document.getElementById("product"+counter+"price").value);
			if ((thisProductPrice >= min) && (thisProductPrice <= max)) {
				products[listPosition] = counter;
				if (listPosition < itemsPerPage) {
					(navigator.appName == "Microsoft Internet Explorer") ?
						document.getElementById("product"+counter).style.display = "inline" :
						document.getElementById("product"+counter).style.display = "inline-block";
					lastItem = counter;
				} else {
					document.getElementById("product"+counter).style.display = "none";
				}
				listPosition++;
			} else {
				document.getElementById("product"+counter).style.display = "none";
			}
			numberFilteredProducts = products.length;
		}
		(numberFilteredProducts > 0) ? 
			isFiltered = true 
			: isFiltered = false;
		showPageNav(1);
		currentPage = 1;
		document.getElementById('showAllPrice').className = 'filter-normal';
		document.getElementById('pg'+currentPage).className = 'pg-selected';
	}
	function showAll(id, filtered) {
		if(filtered) {
			for (i=0; i < products.length; i++) {
				(navigator.appName == "Microsoft Internet Explorer") ? 
					document.getElementById("product"+products[i]).style.display = "inline"
					: document.getElementById("product"+products[i]).style.display = "inline-block";
			}
		} else {
			for (i = 1; i <= numberOfProducts ; i++) {
				lastItem = i;
				(navigator.appName == "Microsoft Internet Explorer") ? 
					document.getElementById("product"+i).style.display = "inline"
					: document.getElementById("product"+i).style.display = "inline-block";
			}
			((isChartList == "") && (isBioList == "") && currentMin) ? document.getElementById('priceFilter'+currentMin).className = 'filter-normal' : 0;
			isFiltered = false;
			numberFilteredProducts = 0;
			showPageNav(1);
		}
		if (id == 'showAllPage' || id == 'showAllPageBottom') {
			document.getElementById('showAllPage').className = 'pg-selected';
			document.getElementById('showAllPageBottom').className = 'pg-selected';
		} else {
			document.getElementById(id).className = 'filter-selected';
		}
		document.getElementById('pg'+currentPage).className = 'pg-normal';
	}
	function getMinMax(thisProduct) {
		thisPrice = parseFloat(document.getElementById("product"+thisProduct+"price").value);
		if(minPrice == -1) {
			minPrice = thisPrice;
		} else {
			if (thisPrice < minPrice) { minPrice = thisPrice; }
		}
		if(maxPrice == -1) {
			maxPrice = thisPrice;
		} else {
			if (thisPrice > maxPrice) { maxPrice = thisPrice; }
		}
		prices[thisProduct-1] = thisPrice;
	}
	function getPriceRanges(min, max) {
		priceRangeMin = new Array();
		priceRangeMax = new Array();
		if (document.getElementById("priceIncrement").value == '') {
			rangeIncrements = ((((max/numberOfLevels) + (1000 % (max/numberOfLevels))) - (((max/numberOfLevels) + (1000 % (max/numberOfLevels))) % 5)) == 0) ? 5 : (((max/numberOfLevels) + (1000 % (max/numberOfLevels))) - (((max/numberOfLevels) + (1000 % (max/numberOfLevels))) % 5));
		} else {
			rangeIncrements = document.getElementById("priceIncrement").value;
		}
		currentMax = currentMin + rangeIncrements;
		var range = /* (rangeIncrements > max-min) ? max :  */max;
		var remainder = ((range % rangeIncrements) == 0) ? 1 : 0;
		var priceLevels = Math.ceil(range / rangeIncrements) + remainder;
		var minCushion = 0; /* ((min * 100) % (rangeIncrements * 100)) / 100; */
		var lowerRange = 0; /* min - minCushion ;*/
		var upperRange = (lowerRange + rangeIncrements) - 0.01;
		var priceFilterList = "<table class=\"priceFilterList\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"listTitle\">Price</td></tr><tr><td class=\"listContents\"><ul class=\"filterList\">";
		var quantity = 0;
		for (i=0; i < priceLevels; i++) {
			for (k=0; k < prices.length; k++) {
				if ((prices[k] >= (lowerRange + (rangeIncrements * i))) && (prices[k] <= (upperRange + (rangeIncrements * i)).toFixed(2)))
					quantity++;
			}
			priceRangeMin[i-1] = (lowerRange + (rangeIncrements * i));
			priceRangeMax[i-1] = (upperRange + (rangeIncrements * i)).toFixed(2);
			if (quantity > 0) priceFilterList += "<li id=\"priceFilter"+priceRangeMin[i-1]+"\" class=\"filter-normal\" onclick=\"filterList("+priceRangeMin[i-1]+","+priceRangeMax[i-1]+");\">$"+priceRangeMin[i-1]+" - $"+priceRangeMax[i-1]+" ("+quantity+") </li>";
			quantity = 0;
		}
		priceFilterList += "<li id=\"showAllPrice\" class=\"filter-normal\" onclick=\"showAll('showAllPrice', false)\">Show All Prices</li></ul>";
		priceFilterList += "</ul></td></tr><tr><td class=\"listEndcap\"></td></tr></table>";
		document.getElementById("priceFilterList").innerHTML = priceFilterList;
	}