
function sf()
{
	cnt = 0
	tiac = false

	f = document.forms['cmpf']

 	for (x = 0; x < f.elements.length; x++)
		if (f.elements[x].type == 'checkbox' && f.elements[x].checked)
		{
			tiac = true
			cnt++
		}

	if (cnt == 1)
	{
		alert("Please select at least one more item to compare with each other.")
		return false
	}
	
	if (tiac)
		window.open("about:blank","ZZcompare","scrollbars=yes,width=900,height=700,status=yes")
	else
		return false
}


function chkSearch()
{
	f = document.forms['search']

	if (f.q.value == '' &&
			f.category.selectedIndex == 0 && f.elements['brands[]'].selectedIndex == -1 &&
			f.margin_low.selectedIndex == 0 && f.margin_high.selectedIndex == 0)
		return false
}

function chkClub()
{
	f = document.forms['club']

	if (f.zzid.value == '' || f.zzpw.value == '' || f.zzid.value == '12345678' || f.zzpw.value == '**********')
		return false
}

function resetbrands()
{
	f = document.search.elements['brands[]'];

	for (x = 0; x < f.length; x++)
	{
		f.options[x].selected=false
	}
	
	sortSelect(f);
	return false;
}

function sortSelect(f)
{
	a = Array();
	b = Array();
	for (x = 0; x < f.length; x++)
	{
		a[x] = f.options[x].value;
		b[x] = f.options[x].text;
	}

	a.sort();
	b.sort();

	for (x = 0; x < f.length; x++)
	{
		f.options[x].value = a[x];
		f.options[x].text = b[x];
	}
}


function externalLinks()
{
	if (!document.getElementsByTagName) return;

	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		var relvalue = anchor.getAttribute("rel");
	
		if (anchor.getAttribute("href"))
		{
			var external = /external/;
			var relvalue = anchor.getAttribute("rel");
			if (external.test(relvalue))
			{
				anchor.target = "_blank";
			}
		}
	}
}
window.onload = externalLinks; 