

	// copy data from infoForm to passed form
	function updateInfo(theForm) {
     	if (thisPage == "checkout.php") {
     		//alert("I shouldn't be here");
			infoForm = eval("document.infoform");
			theForm.c_name.value = infoForm.c_name.value;
			theForm.c_phone.value = infoForm.c_phone.value;
			theForm.c_email.value = infoForm.c_email.value;
		}
	}
	
	// swap the images for the checkboxes
     function swapholder(theNum) {
     	currBox = "box_" + theNum;
     	document.images[currBox].src = loBox;
     }
     
     // change amount of an item to be ordered
     function changeAmt(theName,theAmt) {
     	theForm = eval("document.form"+theName);
     	currVal = theForm.num.value;
     	theAmt = eval(theAmt.valueOf());
     	currVal = eval(currVal.valueOf());
     	theForm.num.value = currVal+theAmt;
     }
     
     // set a numerical value from a field
     function setNumVal(theLoc,theVal) {
     	//alert(event.keyCode);
     	//if ((event.keyCode != 13) && (event.keyCode != 0)) { return; }
     	//if ((event.keyCode != 13) && (event.keyCode != 0)) { alert("hey there"); }
     	//alert(theVal);
     	setVal(theLoc,theVal);
     }
     
/*    these are for old numfield submit attempt 
function netscapeKeyPress(e) {
     if (e.which == 13)
         document.testForm.submit();
}

function microsoftKeyPress() {
    if (window.event.keyCode == 13)
         document.testForm.submit();
}

if (navigator.appName == 'Netscape') {
    window.captureEvents(Event.KEYPRESS);
    window.onKeyPress = netscapeKeyPress;
}
*/
     
     // reset everything
     function clearAll() {
     	document.orderform.mac.value = "";
     	document.orderform.mot.value = "";
     	document.orderform.str.value = "";
     	document.orderform.oth.value = "";
     	document.orderform.nextloc.value = "";
     	document.orderform.addCart.value = "0";
     	document.orderform.submit();
     }
     
     // submit everything
     function doSubmit() {
     	document.orderform.action = "checkout.php";
     	document.orderform.addCart.value = "1";
     	document.orderform.submit();
     }
     
     // edit an item
     function editSubmit(theID) {
     	//alert(theID);
     	theForm = eval("document.form" + theID);
     	theForm.theaction.value = "edit";
     	theForm.action = "camera.php";
     	updateInfo(theForm);
     	theForm.submit();
     }
     
     // delete a single item
     function delSubmit(theID) {
     	//alert(theID);
     	theForm = eval("document.form" + theID);
     	theForm.theaction.value = "delete";
     	theForm.action = thisPage;
     	updateInfo(theForm);
     	theForm.submit();
     }
     
     // update amount
     function numSubmit(theID) {
     	//alert(theID);
     	theForm = eval("document.form" + theID);
     	theForm.theaction.value = "update";
     	theForm.changeNum.value = theID;
     	theForm.action = thisPage;
     	updateInfo(theForm);
     	theForm.submit();
     }
     
     function returnFalse() {
     	return true;
     }
     
     // add another item
     function addToCart() {
     	//alert(theID);
     	theForm = eval("document.endform1");
     	theForm.theaction.value = "add";
     	theForm.action = "camera.php";
     	updateInfo(theForm);
     	theForm.submit();
     }
     
     // empty entire cart
     function emptyCart() {
     	//alert(theID);
     	theForm = eval("document.endform1");
     	theForm.theaction.value = "empty";
     	theForm.action = "camera.php";
     	updateInfo(theForm);
     	theForm.submit();
     }
     
     // submit order to sendmail
     function submitCart() {
     	if (thisPage == "checkout.php") {
     		theForm = eval("document.infoform");
     		theForm.action = "sendmail.php";
     		updateInfo(theForm);
     	} else {
     		theForm = eval("document.endform1");
     		theForm.action = "checkout.php";
     	}
     	theForm.submit();
     }
     
     // swap cart buttons
     function swapCart(theItem,currState) {
     	theName = theItem.substring(0,(theItem.length-1));
     	currSrc = "images/but_" + theName + "_" + currState + ".gif";
     	document.images[theItem].src = currSrc;
     }
     function subSwap(toState) {
     	currSrc = "images/but_ssb_" + toState + ".gif";
     	document.images["but_sub"].src = currSrc;
     }
     function delSwap(toState) {
     	currSrc = "images/but_sdel_" + toState + ".gif";
     	document.images["but_del"].src = currSrc;
     }
     
     // go to systems to add another
     function addOne() {
     	theForm = eval("document.infoform");
     	theForm.action = "camera.php";
     	//updateInfo(theForm);
     	theForm.submit();
     }
     
     // go to options to add another
     function addOption() {
     	theForm = eval("document.infoform");
     	theForm.action = "options.php";
     	//updateInfo(theForm);
     	theForm.submit();
     }
     
     // go to options to add another
     function viewPDF(theType,theName,theParams) {
     	// thetype will be cam or acc
     	//thename will be case 3-letter id or full acc description
     	theURL = 'pdf.php?'+theParams;
     	//theURL = 'pdf.php?type='+theType+theParams;
     	window.open(theURL, "pdfwin", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width=800,height=500")
     	//alert(theName);
     }
