
function ServerModule(model) {

var a=model;

var max1=0;
var idle1=0;

var workload=(((1*document.form1.workload.value))/100);

switch (a) {
case 0: max1=0; idle1=0; max1=0; idle1=0; max1=0; idle1=0;break;
// Model UltraSPARC T2+ 8-core CPUs (1.2 GHz)
case 1: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=420;
idle1=309;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=461;
idle1=326;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=508;
idle1=353;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=416;
idle1=315;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=455;
idle1=325;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=496;
idle1=348;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=385;
idle1=304;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=418;
idle1=330;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=453;
idle1=348;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=373;
idle1=311;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=414;
idle1=321;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=448;
idle1=342;
}
break;
// Model UltraSPARC T2+ 6-core CPUs (1.2 GHz)
case 2: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=412;
idle1=316;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=456;
idle1=331;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=508;
idle1=360;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=408;
idle1=309;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=452;
idle1=335;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=502;
idle1=351;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=385;
idle1=313;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=450;
idle1=335;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=501;
idle1=354;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=377;
idle1=316;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=405;
idle1=327;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=436;
idle1=345;
}
break;
// Model UltraSPARC T2+ 4-core CPUs (1.2 GHz)
case 3: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=404;
idle1=313;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=442;
idle1=344;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=480;
idle1=362;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=400;
idle1=314;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=435;
idle1=335;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=470;
idle1=363;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=376;
idle1=320;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=403;
idle1=341;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=435;
idle1=363;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=368;
idle1=312;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=395;
idle1=336;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=417;
idle1=360;
}

break;
// Model UltraSPARC T2+ 4-core CPUs (1.2 GHz)
case 4: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=463;
idle1=336;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=525;
idle1=353;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=591;
idle1=376;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=475;
idle1=337;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=526;
idle1=353;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=585;
idle1=375;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=422;
idle1=324;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=456;
idle1=343;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=495;
idle1=364;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=407;
idle1=328;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=442;
idle1=357;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=486;
idle1=370;
}
}

var hdd_max=((12*document.form1.HardDrive146.value)+(2.4*document.form1.sata.value));
var hdd_idle=((10*document.form1.HardDrive146.value)+(.1*document.form1.sata.value));
var pci_max=(20*document.form1.pci.value);
var pci_idle=(12*document.form1.pci.value);
var dvd=(10*document.form1.DVD.value);

var total_max=max1+hdd_max+pci_max+dvd-12;
var total_idle=idle1+hdd_idle+pci_idle+dvd-10;

var tot=Math.round(100*((total_idle+((total_max-total_idle)*workload))))/100;


document.form1.sys_tot.value=Math.round(tot);
document.form1.idle_tot.value=Math.round(total_idle);
document.form1.btu_power.value=Math.round((((document.form1.sys_tot.value*3600)/1055.056)*100)/100);
document.form1.btu_power2.value=Math.round((((document.form1.idle_tot.value*3600)/1055.056)*100)/100);

}


function proceed() {
var a=1*document.form1.Processor.value;
ServerModule(a);
}


function finalcheck() {
if ((document.form1.EightGbMemory.value!=0)&&((document.form1.FourGbMemory.value>0)||(document.form1.TwoGbMemory.value>0)||(document.form1.OneGbMemory.value>0))) {
stop;		
}
if ((document.form1.FourGbMemory.value!=0)&&((document.form1.EightGbMemory.value>0)||(document.form1.TwoGbMemory.value>0)||(document.form1.OneGbMemory.value>0))) {
stop;		
}
if ((document.form1.TwoGbMemory.value!=0)&&((document.form1.EightGbMemory.value>0)||(document.form1.FourGbMemory.value>0)||(document.form1.OneGbMemory.value>0))) {
stop;		
}
if ((document.form1.OneGbMemory.value!=0)&&((document.form1.EightGbMemory.value>0)||(document.form1.FourGbMemory.value>0)||(document.form1.TwoGbMemory.value>0))) {
stop;		
}
proceed();
}

function CheckForm () { 

	//Initialise variables
	var errorMsg = "";


	//Check for DIMM quantity
	if ((document.form1.EightGbMemory.value == "0")&&(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;
	}
	
	finalcheck();
}



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

