

// Calculates Total Wattage for System Configuration
function systot() {
// calculates cpu tot
var a=88;
// calculates mem tot
var b=((6*document.form1.textfield2.value)+(7*document.form1.textfield3.value)+(9*document.form1.textfield4.value));
// calculates hd tot
var c=(11*document.form1.textfield5.value);
// calculates crypto tot
var d=(4*document.form1.textfield6.value);
// calculates dvd tot
var e=(6.75*document.form1.textfield7.value);
// calculates usb device tot
var f=(2.5*document.form1.textfield8.value);
// calculates pci card tot
var g=(25*document.form1.textfield9.value);
document.form1.tot_power.value=((1*a)+(1*b)+(1*c)+(1*d)+(1*e)+(1*f)+(1*g));
document.form1.tot_power70.value=Math.round(((1*document.form1.tot_power.value)/0.7)*100)/100;
document.form1.tot_btu.value=Math.round(((1*document.form1.tot_power70.value)*3.42)*100)/100;
}


// Calls ALL Functions
function proceed() {
systot();
}


// Checks to ensure no requirements are violated
function finalcheck(temp) {

// Checks to ensure that Baseline is not greater than 1
if((document.form1.textfield1.value>1)||(document.form1.textfield1.value==0)){
stop
}
// Checks to ensure that memory is not greater than 2
else if ((document.form1.textfield2.value>2)||(document.form1.textfield3.value>2)||(document.form1.textfield4.value>2)) {
stop
}
// Checks to ensure that there are no more than 2 pairs
else if (((1*document.form1.textfield2.value)+(1*document.form1.textfield3.value)+(1*document.form1.textfield4.value))>2) {
stop
}
// Checks to ensure that number of drives is not greater than 2
else if (document.form1.textfield5.value>2) {
stop
}
// Checks to ensure that number of crypto acclerator is not greater than 1
else if (document.form1.textfield6.value>1) {
stop
}
// Checks to ensure that number of dvd is not greater than 2
else if (document.form1.textfield7.value>1) {
stop
}
// Checks to ensure that number of usb devices is not greater than 2
else if (document.form1.textfield8.value>2) {
stop
}
// Checks to ensure that number of pci cards is not greater than 1
else if (document.form1.textfield9.value>1) {
stop
}
else {
proceed();	
}
}



function CheckForm () { 

	//Initialise variables
	var errorMsg = "";

	//Check for CPU quantity
	if ((document.form1.textfield1.value == "0")){
		errorMsg += "\n\tCPU \t\t- Enter # of CPUs desired";	
	}

	//If there is aproblem with the form then display an error
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Your request has not been processed because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "______________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	finalcheck();
}

// Ttests to ensure that at least 4 DIMMS are selected
function parameterchecksone() {
CheckForm();
}