

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.4 GHz)
case 1: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=488;
idle1=366;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=534;
idle1=388;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=586;
idle1=420;
}
if ((1*document.form1.EightGbMemory.value)==24) {
max1=658;
idle1=465;
}
if ((1*document.form1.EightGbMemory.value)==32) {
max1=730;
idle1=509;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=479;
idle1=358;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=527;
idle1=381;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=575;
idle1=404;
}
if ((1*document.form1.FourGbMemory.value)==24) {
max1=654;
idle1=461;
}
if ((1*document.form1.FourGbMemory.value)==32) {
max1=714;
idle1=500;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=447;
idle1=360;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=485;
idle1=382;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=525;
idle1=398;
}
if ((1*document.form1.TwoGbMemory.value)==24) {
max1=591;
idle1=453;
}
if ((1*document.form1.TwoGbMemory.value)==32) {
max1=649;
idle1=488;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=439;
idle1=363;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=477;
idle1=382;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=518;
idle1=406;
}
if ((1*document.form1.OneGbMemory.value)==24) {
max1=566;
idle1=450;
}
if ((1*document.form1.OneGbMemory.value)==32) {
max1=614;
idle1=478;
}
break;
// Model UltraSPARC T2+ 6-core CPUs (1.2 GHz)
case 2: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=407;
idle1=309;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=448;
idle1=322;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=489;
idle1=358;
}
if ((1*document.form1.EightGbMemory.value)==24) {
max1=563;
idle1=401;
}
if ((1*document.form1.EightGbMemory.value)==32) {
max1=632;
idle1=446;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=400;
idle1=305;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=440;
idle1=320;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=478;
idle1=356;
}
if ((1*document.form1.FourGbMemory.value)==24) {
max1=560;
idle1=400;
}
if ((1*document.form1.FourGbMemory.value)==32) {
max1=632;
idle1=438;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=360;
idle1=300;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=400;
idle1=320;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=439;
idle1=354;
}
if ((1*document.form1.TwoGbMemory.value)==24) {
max1=507;
idle1=400;
}
if ((1*document.form1.TwoGbMemory.value)==32) {
max1=558;
idle1=428;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=363;
idle1=297;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=393;
idle1=320;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=427;
idle1=362;
}
if ((1*document.form1.OneGbMemory.value)==24) {
max1=482;
idle1=400;
}
if ((1*document.form1.OneGbMemory.value)==32) {
max1=538;
idle1=435;
}
break;
// Model UltraSPARC T2+ 6-core CPUs (1.2 GHz)
case 3: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=400;
idle1=308;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=445;
idle1=330;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=487;
idle1=362;
}
if ((1*document.form1.EightGbMemory.value)==24) {
max1=550;
idle1=403;
}
if ((1*document.form1.EightGbMemory.value)==32) {
max1=618;
idle1=458;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=396;
idle1=305;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=438;
idle1=345;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=475;
idle1=354;
}
if ((1*document.form1.FourGbMemory.value)==24) {
max1=535;
idle1=402;
}
if ((1*document.form1.FourGbMemory.value)==32) {
max1=603;
idle1=452;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=346;
idle1=304;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=388;
idle1=335;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=430;
idle1=345;
}
if ((1*document.form1.TwoGbMemory.value)==24) {
max1=498;
idle1=406;
}
if ((1*document.form1.TwoGbMemory.value)==32) {
max1=543;
idle1=434;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=338;
idle1=303;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=380;
idle1=330;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=422;
idle1=350;
}
if ((1*document.form1.OneGbMemory.value)==24) {
max1=464;
idle1=401;
}
if ((1*document.form1.OneGbMemory.value)==32) {
max1=532;
idle1=449;
}
break;
// Model UltraSPARC T2+ 4-core CPUs (1.2 GHz)
case 4: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=388;
idle1=312;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=422;
idle1=330;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=456;
idle1=370;
}
if ((1*document.form1.EightGbMemory.value)==24) {
max1=523;
idle1=401;
}
if ((1*document.form1.EightGbMemory.value)==32) {
max1=571;
idle1=453;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=387;
idle1=310;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=421;
idle1=333;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=452;
idle1=369;
}
if ((1*document.form1.FourGbMemory.value)==24) {
max1=519;
idle1=400;
}
if ((1*document.form1.FourGbMemory.value)==32) {
max1=567;
idle1=456;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=347;
idle1=308;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=381;
idle1=332;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=415;
idle1=355;
}
if ((1*document.form1.TwoGbMemory.value)==24) {
max1=474;
idle1=397;
}
if ((1*document.form1.TwoGbMemory.value)==32) {
max1=516;
idle1=436;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=336;
idle1=307;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=370;
idle1=331;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=404;
idle1=353;
}
if ((1*document.form1.OneGbMemory.value)==24) {
max1=460;
idle1=399;
}
if ((1*document.form1.OneGbMemory.value)==32) {
max1=508;
idle1=455;
}
break;

// Model UltraSPARC T2+ 4-core CPUs (1.2 GHz)
case 5: 
if ((1*document.form1.EightGbMemory.value)==8) {
max1=557;
idle1=430;
}
if ((1*document.form1.EightGbMemory.value)==12) {
max1=599;
idle1=447;
}
if ((1*document.form1.EightGbMemory.value)==16) {
max1=774;
idle1=477;
}
if ((1*document.form1.EightGbMemory.value)==24) {
max1=861;
idle1=525;
}
if ((1*document.form1.EightGbMemory.value)==32) {
max1=927;
idle1=575;
}
if ((1*document.form1.FourGbMemory.value)==8) {
max1=541;
idle1=414;
}
if ((1*document.form1.FourGbMemory.value)==12) {
max1=592;
idle1=432;
}
if ((1*document.form1.FourGbMemory.value)==16) {
max1=660;
idle1=454;
}
if ((1*document.form1.FourGbMemory.value)==24) {
max1=760;
idle1=517;
}
if ((1*document.form1.FourGbMemory.value)==32) {
max1=850;
idle1=575;
}
if ((1*document.form1.TwoGbMemory.value)==8) {
max1=548;
idle1=435;
}
if ((1*document.form1.TwoGbMemory.value)==12) {
max1=581;
idle1=440;
}
if ((1*document.form1.TwoGbMemory.value)==16) {
max1=626;
idle1=449;
}
if ((1*document.form1.TwoGbMemory.value)==24) {
max1=755;
idle1=520;
}
if ((1*document.form1.TwoGbMemory.value)==32) {
max1=830;
idle1=570;
}
if ((1*document.form1.OneGbMemory.value)==8) {
max1=524;
idle1=418;
}
if ((1*document.form1.OneGbMemory.value)==12) {
max1=550;
idle1=439;
}
if ((1*document.form1.OneGbMemory.value)==16) {
max1=592;
idle1=463;
}
if ((1*document.form1.OneGbMemory.value)==24) {
max1=753;
idle1=529;
}
if ((1*document.form1.OneGbMemory.value)==32) {
max1=815;
idle1=573;
}
break;
}

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();
}

