function calc() {
	var newtotal=total;
	for(var i=0; i<document.MainForm.elements.length; i++) {
		if(document.MainForm.elements[i].name.indexOf("obj")==0)
			for(var j=0; j<document.MainForm.elements[i].options.length; j++)
				if(document.MainForm.elements[i].options[j].selected)
					newtotal+=csPr[document.MainForm.elements[i].options[j].value];
		if(document.MainForm.elements[i].name.indexOf("chk")==0)
			if(document.MainForm.elements[i].checked)
				newtotal+=csPr[document.MainForm.elements[i].value]; }
	if(document.MainForm.elements["total"]!=null)
		document.MainForm.total.value = dollarformat(newtotal);
	return Math.round(100*newtotal)/100;
}
function order() {
	total=calc();
	for(var i=0; i<document.MainForm.elements.length; i++) {
		if(document.MainForm.elements[i].name.indexOf("obj")==0)
			for(var j=0; j<document.MainForm.elements[i].options.length; j++)
				if(document.MainForm.elements[i].options[j].selected)
					totalWt+=csWt[document.MainForm.elements[i].options[j].value];
		if(document.MainForm.elements[i].name.indexOf("chk")==0)
			if(document.MainForm.elements[i].checked)
				totalWt+=csWt[document.MainForm.elements[i].value]; }
	for(var i=0; i<document.MainForm.elements.length; i++) {
		if(document.MainForm.elements[i].name.indexOf("obj")==0)
			for(var j=0; j<document.MainForm.elements[i].options.length; j++)
				if(document.MainForm.elements[i].options[j].selected)
					csParts+="\n" + csPN[document.MainForm.elements[i].options[j].value] + " - " + csDsc[document.MainForm.elements[i].options[j].value] + " - " + dollarformat(csPr[document.MainForm.elements[i].options[j].value]);
		if(document.MainForm.elements[i].name.indexOf("chk")==0)
			if(document.MainForm.elements[i].checked) 
				csParts+="\n" + csPN[document.MainForm.elements[i].value] + " - " + csDsc[document.MainForm.elements[i].value] + " - " + dollarformat(csPr[document.MainForm.elements[i].value])}
	mymsgwin=window.open("../components/websysload.htm", "msgwin", "width=400,height=150,left=200,screenX=200,top=225,screenY=225"); window.location="../components/cart.htm"; 
	var color;
	var t="<HTML><HEAD><TITLE>Computer System Detailed Description</TITLE></HEAD><BODY BGCOLOR='" + document.bgColor + (navigator.appName.indexOf('Microsoft')>-1?"' background='" + document.body.background:"") + "'><BR><CENTER><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=5><TR><TD>" + (csPic==""?"":"<IMG SRC=\"images/" + csPic + "\">") + "</TD><TD WIDTH="+(csPic==""?"0":"20")+"></TD><TD" + csBGColor + "><CENTER><FONT FACE=Arial SIZE=3>" + csSysDsc + "</CENTER></TD><TD WIDTH=10></TD></TR></TABLE><BR><FONT FACE=Arial SIZE=3><B>Your system (as customized) includes:</B></FONT><BR><BR>";
	t+="<TABLE BORDER=1 CELLPADDING=10 CELLSPACING=2 WIDTH=100%><TR><TD><TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH=100%><TR><TD ALIGN=center><FONT FACE=Arial SIZE=2><B>Manufacturer:</TD><TD ALIGN=center><FONT FACE=Arial SIZE=2><B>Product:</TD></TR>";
	for(var i in csDsc)
		if(csPr[i]==null)
			t+="<TR><TD BGCOLOR=" + (color=="_color1_"?color="_color2_":color="_color1_") + "><FONT FACE=Arial SIZE=2>" + csMfr[i] + "</TD><TD BGCOLOR=" + color + "><FONT FACE=Arial SIZE=2>" + csDsc[i] + "</TD></TR>"
	for(var i=0; i<document.MainForm.elements.length; i++) {
		if(document.MainForm.elements[i].name.indexOf("obj")==0)
			for(var j=0; j<document.MainForm.elements[i].options.length; j++)
				if(document.MainForm.elements[i].options[j].selected)
					t+="<TR><TD BGCOLOR=" + (color=="_color1_"?color="_color2_":color="_color1_") + "><FONT FACE=Arial SIZE=2>" + csMfr[document.MainForm.elements[i].options[j].value] + "</TD><TD BGCOLOR=" + color + "><FONT FACE=Arial SIZE=2>" + csDsc[document.MainForm.elements[i].options[j].value] + "</TD></TR>"
		if(document.MainForm.elements[i].name.indexOf("chk")==0)
			if(document.MainForm.elements[i].checked)
				t+="<TR><TD BGCOLOR=" + (color=="_color1_"?color="_color2_":color="_color1_") + "><FONT FACE=Arial SIZE=2>" + csMfr[document.MainForm.elements[i].value] + "</TD><TD BGCOLOR=" + color + "><FONT FACE=Arial SIZE=2>" + csDsc[document.MainForm.elements[i].value] + "</TD></TR>"} 
	t+="</TABLE></TD></TR></TABLE><BR><BR><FORM><INPUT TYPE=button onclick='window.close()' VALUE='   Close   '><BR><BR></BODY></HTML>";
	mymsgwin.csSysDsc=csSysDsc;
	mymsgwin.csULR=csULR;
	mymsgwin.total=Math.round(100*total)/100;
	mymsgwin.totalWt=Math.round(100*totalWt)/100;
	mymsgwin.csPic=csPic;
	mymsgwin.csParts=csParts;
	mymsgwin.csStatus=csStatus;
	mymsgwin.t=t;
}
function dollarformat(valuein) {  //this function formats in currency format 
	if(isNaN(valuein)) return ("Error"); else valuein+=0.005
	if (valuein<0.005) return "-"+dollarformat(-0.01-valuein)
	valuein=valuein.toString()
	var result="$"
	var decipos=valuein.indexOf(".")
	if (decipos==-1) {decipos=valuein.length; valuein+=".0"}; valuein+="0" 
	for (var i=decipos % 3; i<decipos+4; i+=3) {
		result+=valuein.substring(i-3,i)
		if ((result.length>1) && (result.length<decipos+1)) {result+=","}}
	return result
}
function check() {	//this function checks if the page has to jump directly to the shopping cart
	if(location.toString().indexOf("?go")>-1) order()	
}
