function addItem(url, cnt) {
	var size = "";
	var colour = "";
	var other = "";
	var qnt = document.getElementById("item_quant_"+cnt).value;
	if(document.getElementById("item_size_"+cnt)) {
		size = "&size="+document.getElementById("item_size_"+cnt).value;
	}
	if(document.getElementById("item_colour_"+cnt)) {
		colour = "&colour="+document.getElementById("item_colour_"+cnt).value;
	}
	if(document.getElementById("item_other_"+cnt)) {
		other = "&other="+document.getElementById("item_other_"+cnt).value;
	}
	if(checkform(qnt)) {
		location.href = url + '&qnty=' + qnt + size + colour + other;
	}
}


function checkform(qnty){
	if(qnty > 0 && qnty < 100) {
		return true;
	}
	else {
		alert("You must enter a number between 1 and 99 to add this item to your shopping cart." + qnty);
		return false;
	}
}


function getSelected(selectCtrl, sel) {
	for (i = selectCtrl.options.length - 1; i >= 0; i--) {
		if(selectCtrl.options[i].value == sel) {
		selectCtrl.options[i].selected = true;
		return;
		}
	}
}
				
function getRadio(selectCtrl, sel) {
	if(selectCtrl.length > 0)  {
	  for (var i=0; i<selectCtrl.length; i++) {
		 if (selectCtrl[i].value == sel) {
			selectCtrl[i].checked = true;
			return;
		 }
	  }
	}
	else {
		if (selectCtrl.value == sel) {
			selectCtrl.checked = true;
			return;
		 }
	}
}