
	//declare variables

  var Subttl = 0;
  var chekd = 1;
  var Pymtamt = 0;
  var invoice = "";
  var mon ="";
  var hd = "";
  var prnt = "";
  var vir = "";
  var rinst = "";
  var hubscr = "";
  var coac = "";
  var lcan = "";
  var result = 0;
  var stateList = "" ;
  var win1;
  var dedct;
  var sel;
  var pubname = " ";
  var laborvalue = "";
  var partvalue = "";
  var comments = "";
  var tax = "";
  var total = "";
  var taxamount = "";
  var bog = "";

  

	//displays instructions for users when the click the red button at the top of the page		
 	function instructions(){

		alert("The information you enter into  the invoice form on this page can be printed by"+'\n'+
	" clicking the CLICK TO PRINT INFORMATION YOU ENTER "+'\n'+
	" button at the bottom of the page AFTER you have filled out your pertinent information "+'\n'+
	" using the form you see on your computer screen.(use your mouse to make selections) When "+'\n'+
	" you click the button ; another form will display showing your choices and text entries"+'\n'+
	" If you are not using Netscape be sure to check at the bottom of the page for a "+'\n'+
	" minimized icon of the printable page after you click the button at the bottom of"+'\n'+
	" this form.This is the part that is printable by using the print "+'\n'+
	" button on your browser window.If you are using a network printer you may need to click"+'\n'+
	" select all button at the top of your page first.");


	}

	function startover(){
		document.bsnsform.C1.value="";
		window.location="bsnsform.html";
		}
			


      function Check(){
	 	 /*if(document.bsnsform.T1.value == "" && document.bsnsform.T2.value == "" &&
			document.bsnsform.T3.value == "" && document.bsnsform.T4.value == "" &&
			document.bsnsform.T5.value == "" && document.bsnsform.T6.value == "" &&
			document.bsnsform.T7.value == "" && document.bsnsform.T9.value == "" &&
		    pymtamt == 0 && gld == "" && treevalue == "" && stateList == ""){*/
		if(document.bsnsform.T1.value == ""){
		alert("fill out form please");
		}
	}


 function round(g){
	 return Math.round(g * 100.00) / 100.00;
		}



	
	
	//this calls the rest of the modules in the program

	function figuretotal(){
		bog = parseFloat(document.bsnsform.T10.value)*(document.bsnsform.T12.value/100);
		document.bsnsform.T13.value = 
	       	
		round(bog	+ (parseInt(document.bsnsform.T9.value) *40.00 + .00)+
		parseFloat(document.bsnsform.T10.value)) ;
	}



  function SubmitOrder (){

  
  GetInitval();

  GetMembership();
  DisplayInfo();

  
 // figuretax();


  }
  

  //this function gets the initial values from the form array
  //by looping through and selecting values according to
  //the "checked" attribute state (as set by the user when selecting a checkbox)
  //the "parse int" function extracts the number that is the price amount
  //and the substr() function gets the description of the items (in text)
  //in the html form.

    function GetInitval(){

	    //loop through the form and select user checked items
	    
  //for(i = 0; i<document.bsnsform.C1.length; i++){
  		//if(document.bsnsform.C1[i].checked) {
 			//box = chekd++;
			//Subttl = Subttl + (document.bsnsform.C1[i].value);
		
		//	gld = gld +(document.bsnsform.C1[i].value.substr())+'<br>';
			//gld=document.bsnsform.C1[i].value.substr()+'<br>';

     	
			// }
		if(document.bsnsform.C1.checked){
			mon = (document.bsnsform.C1.value.substr())+'<br>';
		}
		if(document.bsnsform.C2.checked){
			hd= (document.bsnsform.C2.value.substr())+'<br>';
		}
		if(document.bsnsform.C3.checked){
			prnt= (document.bsnsform.C3.value.substr())+'<br>';
		}
		if(document.bsnsform.C4.checked){
			vir= (document.bsnsform.C4.value.substr())+'<br>';
		}
		if(document.bsnsform.C5.checked){
			rinst= (document.bsnsform.C5.value.substr())+'<br>';
		}
		if(document.bsnsform.C6.checked){
			hubscr= (document.bsnsform.C6.value.substr())+'<br>';
		}
		if(document.bsnsform.C7.checked){
			coac= (document.bsnsform.C7.value.substr())+'<br>';
		}
		if(document.bsnsform.C8.checked){
			lcan= (document.bsnsform.C8.value.substr())+'<br>';
}
				
		

	if (document.bsnsform.T9.value != ""){
		laborvalue = "The labor charges are :" + '&nbsp;&nbsp;' +"$"+'&nbsp;' + 
	(document.bsnsform.T9.value * 40);
		}
	
	if (document.bsnsform.T10.value != ""){
		partvalue = "The parts charges are :" + '&nbsp;&nbsp;' +"$"+ '&nbsp;' +
 	document.bsnsform.T10.value;}

	if (document.bsnsform.T12.value != ""){
		tax = "Tax :" + '&nbsp;&nbsp;' +"$"+'&nbsp;' +
		round(((document.bsnsform.T12.value)/100)*
		(parseFloat(document.bsnsform.T10.value)));
	}





	
	if (document.bsnsform.T11.value != ""){
		comments = "Description of work done:" + '&nbsp;&nbsp;' + 
	document.bsnsform.T11.value;
	}

	
	}
 	
		

 	//end of GetInitval module

 

  //this function figures totals and extra charges for minimum orders

  function GetMembership (){

 		
  //determine the choice the user has made for the
  //type of membership	

      for(i = 0; i<document.bsnsform.dedct.length; i++){
  		  if(document.bsnsform.dedct[i].selected){
  			Pymtamt = (document.bsnsform.dedct[i].value)
  			}

		}
	}



  //end of ComputePymts module

 

	//get the users preference of having their name published
	function radio1clicked()
	{
		
		pubname = "yes , customer has restore disk/original operating system";
	}
	function radio2clicked()
		{
		pubname = "no , the customer does not have original operating system";
		}
	

		

 

  //this function sets up and organizes messages for the users information
  //the no break space (nbsp) is necessary to format the output so as to make it readable
  //the line break (<br>) makes the columns of output appear on separate lines so
  //they are readable.

  function DisplayInfo (){

  invoice = "PERPETUAL PCs" + '&nbsp;&nbsp;&nbsp;&nbsp;' ;

  invoice = invoice + "customer invoice for:"  + '<br>'+'<br>'; 

  invoice = invoice + document.bsnsform.T1.value + '&nbsp;&nbsp;' + document.bsnsform.T2.value + '<br>';

  invoice = invoice + "======================================================"+ '<br>';

  invoice = invoice + "Phone Number:" + '&nbsp;&nbsp;'+ document.bsnsform.T7.value +'<br>';

  invoice = invoice + " " +'<br>';

  invoice = invoice + "E Mail Address :" + '&nbsp;&nbsp;' + document.bsnsform.T4.value + '<br>';

  invoice = invoice + "======================================================"+ '<br>';

  invoice = invoice + "Mailing address :" + '<br>';

  invoice = invoice + document.bsnsform.T1.value + '&nbsp;&nbsp;' + 
				document.bsnsform.T2.value +'<br>';

  invoice = invoice + document.bsnsform.T3.value + '&nbsp;'+  '<br>';

  invoice = invoice + document.bsnsform.T5.value +'&nbsp;' +";"+'&nbsp;'+ stateList+
                       '&nbsp;&nbsp;'+document.bsnsform.T6.value + '<br>';
  invoice = invoice + "U.S.A."+'<br>';

  invoice = invoice + "======================================================"+ '<br>';

  invoice = invoice +"------------------------------------------------------"+'<br>';

  invoice = invoice +"The estimate is" +'&nbsp;&nbsp;&nbsp;&nbsp;'+
                       "$" + Pymtamt + '&nbsp;&nbsp;'+ "" +'<br>';
  invoice = invoice +"------------------------------------------------------"+'<br>';

  invoice = invoice + "Does the customer have original operating system?" + '<br>';

  invoice = invoice + '<br>';

  invoice = invoice + pubname +'<br>';

  invoice = invoice +"======================================================"+'<br>';

  invoice = invoice + "Possible problems are :" +'<br>';

  invoice = invoice + '<br>';
  invoice = invoice + mon ;
  invoice = invoice + hd ;
  invoice = invoice + prnt ;
  invoice = invoice + vir ;
  invoice = invoice + rinst ;
  invoice = invoice + hubscr ;
  invoice = invoice + coac ;
  invoice = invoice + lcan ;

  invoice = invoice + '<br>';

  invoice = invoice + laborvalue + '<br>';
  
  invoice = invoice + partvalue + '<br>';

  invoice = invoice + tax + '<br>';

  invoice = invoice +"Total :" + '&nbsp;&nbsp;' + "$" +
  			'&nbsp;'+ document.bsnsform.T13.value + '<br>';

  invoice = invoice + comments + '<br>';

  invoice = invoice +"------------------------------------------------------"+'<br>';



  //here we set up the new window that is called (dynamically)
  //to allow printing of the messages that are displayed by this module
  //the document.open() and document.close() are necessary to facilitate the
  //ability to print this actual page even though it is created dynamically.

				
             if(document.bsnsform.T1.value == "" && document.bsnsform.T2.value == "" &&
			document.bsnsform.T3.value == "" && document.bsnsform.T4.value == "" &&
			document.bsnsform.T5.value == "" && document.bsnsform.T6.value == "" &&
			document.bsnsform.T7.value == "" && document.bsnsform.T9.value == "" &&
			Pymtamt == 0 && mon== "" && hd== "" && prnt== "" && 
			vir== "" && rinst== "" && hubscr== "" && coac== ""
			&& lcan== "" && laborvalue == "" && stateList == ""){
		



	 alert("You haven't filled out the form yet ; please close this box and try again"+'\n'+
	"after clicking on the button at the top of the page that says: "+'\n'+
	"click for directions to print your information ");



				 !invoice ;
				
				
			}
				


             else{
 	
 		   win1 = window.open('','Example1');
     				win1.document.open();
             win1.document.write(invoice);
             win1.document.close();
		}
     	
	}


  //end of DisplayInfo module

