function adjustQty(el, index, method) {
	if (el.length>1) {
		el = el[index]
	}
	if(checkQty(el.value)){
		if (method=="increase") {
			el.value++;
		}
		else if (method=="decrease"){
			if(el.value>0){
				el.value--;
			}
		}
	} else {
		el.value="1";
		el.focus();
	}
}
function checkQty(v) {
	if ((!validQty(v))||(v<0)) {
		alert('You have entered an invalid quantity!');
		return false
	} else {
		return true
	}
}
function validQty(v) {
    	if (isNaN(v.replace(/ /g,""))) {
    		return false;
    	}
    	else return true;
}
function continueOrder(url) {
	if (document.forms["basket"].warrantytc.checked) {
		location.href=this
	}
	else {
		alert("In order to continue with this order please read and accept the warranty terms and conditions")
		return false;
	}
}

function openDeliveryCalendar(url, postcode, df, defaultDespatchType, callFrom, basketProductCode, chosenDate){
	var left = screen.width - 540;

	if(df == 'FEENIX') {
		window.open(url + '?postcode=' + postcode + '&warehouseCode=' + df + "&ddt=" + defaultDespatchType + "&callFrom=" + callFrom + "&basketProductCode=" + basketProductCode + "&chosenDate=" + chosenDate,'deliveryCalendar','width=210,height=420,top=186,left='+left+',scrollbars=no')
	}
	else {
		window.open(url + '?postcode=' + postcode + '&warehouseCode=' + df + "&ddt=" + defaultDespatchType + "&callFrom=" + callFrom + "&basketProductCode=" + basketProductCode + "&chosenDate=" + chosenDate,'deliveryCalendar','width=210,height=300,top=186,left='+left+',scrollbars=no')
	}
}

