function GoSearch(searchText) {
	if (!searchText || searchText.length < 1 || Trim(searchText).length < 1) {
		alert('Please type the word or words you want to search for in the search box.');
		return false;
	}

	return true;
}

function Trim(source) {
	source = source.replace(/^\s+/g, "");
	return source.replace(/\s+$/g, "");
}

function validate_count(which) {
	var i = 0;
	var count = 0;
	for (i = 0; i < document.CompareProducts.elements.length; i++) {
		if (document.CompareProducts.elements[i].checked == true) { count++; }
		if (count > 10) {
			alert('A maximum of 10 products can be compared at one time.');
			document.CompareProducts[which].checked = false;
			break;
		}
	}
	if (which == 'Form') {
		if (count < 2) {
			alert('Choose at least two products.');
			return false;
		} else {
			return true;
		}
	}
}

linkName2Index = new Object();

function gotoclick(t, s) {
	var d = document;
	if (linkName2Index[s] >= 0) {
		t.href = d.links[linkName2Index[s]];
		return true;
	}

	for (i = d.links.length - 1; i >= 0; i--) {
		if (typeof d.links[i].name != "undefined") {
			if (d.links[i].name == s) {
				linkName2Index[d.links[i].name] = i;
				t.href = d.links[i];
				return true;
			}
		}
	}
	return null;
}

var imgPreload = new Image();
imgPreload.src = "images/x_over.gif";

function Toggle(menu) {
	menu.parentNode.className = (menu.parentNode.className == 'closed') ? 'open' : 'closed';
}

function toggle2(section) {
	var elem = document.getElementById(section);
	if (elem) {
		elem.style.display = (elem.style.display != '') ? '' : 'none';
	}
}