// Thomas: check if selected product number is ok
function checkSelected()
{
	var j = 0;
	
	for (i=0;i<document.forms['compare'].length;i++)
	{
		if (document.forms['compare'].elements[i].type == 'checkbox')
		{
			if (document.forms['compare'].elements[i].checked)
			{
				j++;
			}
		}
	}
	
	if (j==0) 
	{
		alert('Select the products you want to compare.');
	}
	else if (j==1) 
	{
		alert('Select more than one product to compare.');
	}
	else if (j>4)
	{
		alert('Select max 4 products.');
	}
	else
	{
		document.forms['compare'].submit();
	}
}

function init_ajax_object() 
{
	var A;
	try {
		A=new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			A=new ActiveXObject("Microsoft.XMLHTTP");
		} catch (oc) {
			A=null;
		}
	}
	if (!A && typeof XMLHttpRequest != "undefined")
		A = new XMLHttpRequest();
	if (!A)
		alert("I cannot create an object");
	return A;
}

var ss = 1;
function startFlashing()
{
	var time = 2000;
	if (ss == 1)
	{
		//document.getElementById('contact_alert1').innerHTML = 'Free Delivery';
		document.getElementById('contact_alert2').innerHTML = 'Price Match Available';
		ss = 2;
		setTimeout('startFlashing()', time);
	}	
	else if (ss == 2)
	{
		//document.getElementById('contact_alert1').innerHTML = '08000 4 28 969';
		document.getElementById('contact_alert2').innerHTML = 'Call 08000 4 28 969';
		ss = 1;
		setTimeout('startFlashing()', time);
	}		
}


function check_able2buy_form()
{
	var i = 0;
	var result = false;
	
	for (i=0; i<document.forms['able2buyform'].elements['cgid'].length; i++)
	{
		if (document.forms['able2buyform'].elements['cgid'][i].checked)
		{
			result = true;
		}
	}
	
	if (result)
	{
		document.forms['able2buyform'].submit();
	}
	else
	{
		alert('Please choose credit type');
	}
}


function showCouponForm()
{
	var coupon_form = document.getElementById('coupon_form');
	if (coupon_form)
	{
		var status = coupon_form.style.visibility;
		
		if (status == 'visible')
		{
			coupon_form.style.visibility = 'hidden';
		}
		else
		{
			coupon_form.style.visibility = 'visible';
			document.forms['coupon_form'].elements['coupon_code'].focus();
		}
	}
}







