
function actionQuote() {
	var Qty

	// only user-supplied data is quantity, so validate it
	//  before we attempt to 
	Qty = parseInt( document.PriceCalc.WideQty.value );

	if( isNaN( Qty ) ){
		alert("Please enter a valid quantity");
		document.PriceCalc.WideQty.focus();
	}else if( document.PriceCalc.JobName.value.length == 0 ){
		alert("Please enter a job name for your own reference\r\nthis will help you identify individual jobs later on.");
		document.PriceCalc.JobName.focus();
	}else if( document.PriceCalc.JobOrderRef.value == "" && document.PriceCalc.forcePO.value == "Y" ){
		alert("Please supply a purchase order reference, you\r\ncan change your PO reference later on if required.");
		document.PriceCalc.JobOrderRef.focus();
	}else{
		if( document.PriceCalc.loginPrice.value == "Y" ) {
			document.PriceCalc.submit();
		} else {
			document.PriceCalc.Username.focus();
			alert("Please login before building a full quote, dont worry -\r\nyour current quote will still be here when you get back.");
		}
	}
}

function actionLogin() {

	// check required fields
	if( document.PriceCalc.Username.value.length == 0 && document.PriceCalc.Password.value.length == 0 ){
		alert( "Please enter your username and password before logging in." );
		document.PriceCalc.Username.focus();
	}else if( document.PriceCalc.Username.value.length == 0 ){
		alert( "Please enter your username before logging in." );
		document.PriceCalc.Username.focus();
	}else if( document.PriceCalc.Password.value.length == 0 ){
		alert( "Please enter your password before logging in." );
		document.PriceCalc.Password.focus();
	}else{
		document.PriceCalc.mode.value = "login";
		document.PriceCalc.action = "core.asp";
		document.PriceCalc.submit();
	}
}

function actionRegister() {
	document.PriceCalc.mode.value = "preregister";
	document.PriceCalc.submit();
}

function actionUpload(){
	document.PriceCalc.mode.value = "upload";
	document.PriceCalc.submit();
}

function actionSearch(){
	document.location.href = "search.asp";
}

document.PriceCalc.JobName.focus();