thing = function ()
	{
	if(document.getElementById("billingaddress"))
		{
		var displayState='none';
		billingcontrol = document.getElementById("billingaddress");
		if(billingcontrol.checked)
			{
			document.getElementById("billing").style.display='none';
			}
		else
			{
			document.getElementById("billing").style.display='block';
			}
			
		billingcontrol.onclick=function()
			{
			displayState = (displayState == 'block') ? 'none' : 'block';
			var element = document.getElementById("billing");
			element.style.display = displayState;
			}
			
		billingcontrol.ondoubleclick=function()
			{
			displayState = (displayState == 'block') ? 'none' : 'block';
			var element = document.getElementById("billing");
			element.style.display = displayState;
			}
		}
	}
	

function billingControl ()
{

	controller = document.getElementById('billingaddress');
	deliveryFs = document.getElementById('billing');
	
	if(controller.checked) {
		deliveryFs.style.display = 'none';
	} else {
		deliveryFs.style.display = 'block';
	}

}


checker = function(fields)
	{
	var x = 0;
	var errs = 0;
	for(i=0;i<fields;i++)
		{
		var thing = document.getElementById("option_"+i).value;
		if((parseInt(thing)!=thing-0)&&(thing!=''))
			{
			errs++;
			}
		x = document.getElementById("option_"+i).value + " + " + x;
		}
	//window.alert(eval(x));
	
	if(errs>0)
		{
		window.alert("Check that you have only put numbers in the qty boxes for each size you require");
		return false;
		}
	else if(eval(x)==0)
		{
		window.alert("You haven't chosen a size - please make sure you put the quantity of this item in the relevant size box");
		return false;
		}
	}

changer = function()
	{
	var inputs = document.getElementsByTagName('input');
	for(var i=0; i<inputs.length; i++)
		{
		if(inputs[i].className=='changer')
			{
			inputs[i].onchange = function()
				{
				document.basketform.submit();
				}
			}
		}
	}


country = function()
	{
	if(document.getElementById('countryselector'))
		{
		document.getElementById('countryselector').onchange = function()
			{
			document.basketform.submit();
			}
		}
	changer();
	}

function LoadFunctions()
	{
	//thing();
	country();
	}

window.onload = LoadFunctions;
