



// Calculates Total Wattage for System Configuration
function systot() {
//Calculates total memory power

var a1=(1*document.form1.OneGbMemory.value);
var a2=(1*document.form1.TwoGbMemory.value);
var a3=(1*document.form1.FourGbMemory.value);
var a4=((1*document.form1.CPU_Utilization.value)/100);

var a5=Math.round((a1*Math.round((5*(0.75+(a4*0.25)))*100)/100)*10)/10;
var a6=Math.round((a2*Math.round((8*(0.75+(a4*0.25)))*100)/100)*10)/10;
var a7=Math.round((a3*Math.round((6*(0.75+(a4*0.25)))*100)/100)*10)/10;
var a=(1*a5)+(1*a6)+(1*a7);
//alert("TotMemoryPower(p18): "+a);
// Calculates total cpu power
var b1=(1*document.form1.CPU_Power.value);
if (b1==68) {
var b=Math.round((1*document.form1.cpu.value)*(35+(43.5*a4))*100)/100; 
}
else if (b1==75) {
var b=Math.round((1*document.form1.cpu.value)*(29+(57*a4))*100)/100;
}
else if (b1==95) {
var b=Math.round((1*document.form1.cpu.value)*(35+(60*a4))*100)/100;
}
else {
var b=Math.round((1*document.form1.cpu.value)*(35+(84.4*a4))*100)/100;
}
//alert("cpuPower(p29): "+b);
// Calcullates hard drive power
var c=(9*document.form1.hdd.value);
//alert("HDD(p32): "+c);
// Calculates pci card power
var d=(7*document.form1.pci.value);
//alert("PCI(p33): "+d);
// Calculates power supply power
var e=(19*document.form1.power_supply.value);
//alert("PowerSupply(p34): "+e);
// Calculates Fixed Numbers
var f=((1*document.form1.CPU_Utilization.value)/100);
//var g=25+(15*f);
var h=0;

if (b1==75)  {//75W is a special case
	h = (70 + (25*f));
} else {//For all other Watts
	h=(25.2 + (25+(30*f)));
}
//alert("FixedNum1(p37or38): "+h);
var i=(a+b+c+d+e+h);
var j=(1*document.form1.AC_Voltage.value);
var k=1.018807/((j*0.000111)+0.994333)
//	alert("FixedNum2(p39): "+k);

var z=Math.round(((i*k)*10)/10);
//alert("TotPower(p42or44): "+z);
document.form1.tot_power.value=z;
}

// Calculates Total BTU for System Configuration
function btutot() {
//systot();
var a=(1*document.form1.tot_power.value);
var b=((a*3600)/1055.056);
document.form1.btu_power.value=(Math.round((b*100)/100));
}

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


function CheckForm () { 

	//Initialise variables
	var errorMsg = "";

	//Check for DIMM quantity
	if ((document.form1.FourGbMemory.value == "0")&&(document.form1.TwoGbMemory.value == "0")&&(document.form1.OneGbMemory.value == "0")){
		errorMsg += "\n\tDIMMs \t\t- Enter # of DIMMs 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;
	}
	
	proceed();
}

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



function setOptions(chosen) {
var selbox = document.form1.FourGbMemory;
 
selbox.options.length = 0;

if (chosen == "1") {
  selbox.options[selbox.options.length] = new Option('None','0');
  selbox.options[selbox.options.length] = new Option('2 DIMMs','2');
  selbox.options[selbox.options.length] = new Option('4 DIMMs','4');
}
if (chosen == "2") {
  selbox.options[selbox.options.length] = new Option('None','0');
  selbox.options[selbox.options.length] = new Option('4 DIMMs','4');
  selbox.options[selbox.options.length] = new Option('8 DIMMs','8');
}
}

 function setOptions2(chosen) {
 var selbox2 = document.form1.TwoGbMemory;
 
selbox2.options.length = 0;

if (chosen == "1") {
  selbox2.options[selbox2.options.length] = new Option('None','0');
  selbox2.options[selbox2.options.length] = new Option('2 DIMMs','2');
  selbox2.options[selbox2.options.length] = new Option('4 DIMMs','4');
}
if (chosen == "2") {
  selbox2.options[selbox2.options.length] = new Option('None','0');
  selbox2.options[selbox2.options.length] = new Option('4 DIMMs','4');
  selbox2.options[selbox2.options.length] = new Option('8 DIMMs','8');
}
}

 function setOptions3(chosen) {
 var selbox3 = document.form1.OneGbMemory;
 
selbox3.options.length = 0;

if (chosen == "1") {
  selbox3.options[selbox3.options.length] = new Option('None','0');
  selbox3.options[selbox3.options.length] = new Option('2 DIMMs','2');
  selbox3.options[selbox3.options.length] = new Option('4 DIMMs','4');
}
if (chosen == "2") {
  selbox3.options[selbox3.options.length] = new Option('None','0');
  selbox3.options[selbox3.options.length] = new Option('4 DIMMs','4');
  selbox3.options[selbox3.options.length] = new Option('8 DIMMs','8');
}
}

function PrintMenu() {
var a=document.form1.cpu.value;
if (a==1) {
setOptions('1'); setOptions2('1'); setOptions3('1');
}
if (a==2) {
setOptions('2'); setOptions2('2'); setOptions3('2');
}
}