//function writes out content for tool when page loads for the first time
function mainpage(){
	document.write("<html>");
orginalstyles();
document.write("<body>");
document.write("<form name='myform'>");
document.write("<table border='0' width='460' class=newcolor>");
document.write("<tr>");
document.write("<td title='Your Source Language'><FONT face='Verdana' size='-2'>Choose Source Language:</font></td>");
document.write("<td title='Your Source Language'>");
document.write("<select name='source' STYLE='width: 137px'>");
document.write("<option value='source language not chosen'>source language");
document.write("<option value='Arabic'>Arabic");
document.write("<option value='Cambodian'>Cambodian");
document.write("<option value='Chinese'>Chinese");
document.write("<option value='Danish'>Danish");
document.write("<option value='English'>English");
document.write("<option value='Finnish'>Finnish");
document.write("<option value='French'>French");
document.write("<option value='German'>German");
document.write("<option value='Greek'>Greek ");
document.write("<option value='Haitian'>Haitian");
document.write("<option value='Hebrew'>Hebrew");
document.write("<option value='Hindi'>Hindi");
document.write("<option value='Hungaian'>Hungaian ");
document.write("<option value='Indonesian'>Indonesian");
document.write("<option value='Italian'>Italian");
document.write("<option value='Japanese'>Japanese");
document.write("<option value='Korean'>Korean");
document.write("<option value='Laotian'>Laotian");
document.write("<option value='Latin'>Latin");
document.write("<option value='Lithuanian'>Lithuanian");
document.write("<option value='Malay'>Malay");
document.write("<option value='Norwegian'>Norwegian");
document.write("<option value='Polish'>Polish");
document.write("<option value='Portuguese'>Portuguese");
document.write("<option value='Romanian'>Romanian");
document.write("<option value='Serbo-Croation'>Serbo-Croation");
document.write("<option value='Spanish'>Spanish");
document.write("<option value='Turkish'>Turkish");
document.write("<option value='Urdu'>Urdu");
document.write("<option value='Vietnamese'>Vietnamese");
document.write("</select></td></tr>");
document.write("<tr>");
document.write("<td title='Your Target Language'><FONT face='Verdana' size='-2'>Choose Target Language:</font></td>");
document.write("<td title='Your Target Language'>");
document.write("<select name='target' STYLE='width: 137px' onBlur='validationlanguage()'>");
document.write("<option value='target language not chosen'>target language");
document.write("<option value='Arabic'>Arabic");
document.write("<option value='Cambodian'>Cambodian");
document.write("<option value='Chinese'>Chinese");
document.write("<option value='Danish'>Danish");
document.write("<option value='English'>English");
document.write("<option value='Finnish'>Finnish");
document.write("<option value='French'>French");
document.write("<option value='German'>German");
document.write("<option value='Greek'>Greek ");
document.write("<option value='Haitian'>Haitian");
document.write("<option value='Hebrew'>Hebrew");
document.write("<option value='Hindi'>Hindi");
document.write("<option value='Hungaian'>Hungaian ");
document.write("<option value='Indonesian'>Indonesian");
document.write("<option value='Italian'>Italian");
document.write("<option value='Japanese'>Japanese");
document.write("<option value='Korean'>Korean");
document.write("<option value='Laotian'>Laotian");
document.write("<option value='Latin'>Latin");
document.write("<option value='Lithuanian'>Lithuanian");
document.write("<option value='Malay'>Malay");
document.write("<option value='Norwegian'>Norwegian");
document.write("<option value='Polish'>Polish");
document.write("<option value='Portuguese'>Portuguese");
document.write("<option value='Romanian'>Romanian");
document.write("<option value='Serbo-Croation'>Serbo-Croation");
document.write("<option value='Spanish'>Spanish");
document.write("<option value='Turkish'>Turkish");
document.write("<option value='Urdu'>Urdu");
document.write("<option value='Vietnamese'>Vietnamese");
document.write("</select></td></tr>");
document.write("<tr><td title='Low cost per word is needed.'><FONT face='Verdana' size='-2' >Choose The Low Cost Per Word In Cents</font></td>");
document.write("<td title='Low cost per word is needed.'><select name='lowcost' STYLE='width: 137px'>");
document.write("<option value=''>low cost in &cent;'s :");
document.write("<option value=''>.09");
document.write("<option value=''>.10");
document.write("<option value=''>.11");
document.write("<option value=''>.12");
document.write("<option value=''>.13");
document.write("<option value=''>.14");
document.write("<option value=''>.15");
document.write("<option value=''>.16");
document.write("<option value=''>.17");
document.write("<option value=''>.18");
document.write("<option value=''>.19");
document.write("<option value=''>.20");
document.write("<option value=''>.21 ");
document.write("<option value=''>.22");
document.write("<option value=''>.23");
document.write("<option value=''>.24");
document.write("<option value=''>.25");
document.write("<option value=''>.26");
document.write("<option value=''>.27");
document.write("<option value=''>.28");
document.write("<option value=''>.29");
document.write("<option value=''>.30");
document.write("<option value=''>.31");
document.write("<option value=''>.32");
document.write("<option value=''>.33");
document.write("<option value=''>.34");
document.write("<option value=''>.35");
document.write("<option value=''>.36");
document.write("<option value=''>.37");
document.write("<option value=''>.38");
document.write("<option value=''>.39");
document.write("<option value=''>.40"); 
document.write("<option value=''>.41");
document.write("<option value=''>.42");
document.write("<option value=''>.43");
document.write("<option value=''>.44");
document.write("<option value=''>.45");
document.write("<option value=''>.46");
document.write("<option value=''>.47"); 
document.write("<option value=''>.48");
document.write("</select></td></tr>");
document.write("<tr>");		
document.write("<td title='High cost per word is needed.'><FONT face='Verdana' size='-2'>Choose The High Cost Per Word In Cents</font></td>");
document.write("<td title='High cost per word is needed.'><select name='highcost' STYLE='width: 137px'>");
document.write("<option value=''>high cost in &cent;'s");
document.write("<option value=''>.09");
document.write("<option value=''>.10");
document.write("<option value=''>.11");
document.write("<option value=''>.12");
document.write("<option value=''>.13");
document.write("<option value=''>.14");
document.write("<option value=''>.15");
document.write("<option value=''>.16");
document.write("<option value=''>.17");
document.write("<option value=''>.18");
document.write("<option value=''>.19");
document.write("<option value=''>.20");
document.write("<option value=''>.21");
document.write("<option value=''>.22");
document.write("<option value=''>.23");
document.write("<option value=''>.24");
document.write("<option value=''>.25");
document.write("<option value=''>.26");
document.write("<option value=''>.27");
document.write("<option value=''>.28");
document.write("<option value=''>.29");
document.write("<option value=''>.30");
document.write("<option value=''>.31");
document.write("<option value=''>.32");
document.write("<option value=''>.33");
document.write("<option value=''>.34");
document.write("<option value=''>.35");
document.write("<option value=''>.36");
document.write("<option value=''>.37");
document.write("<option value=''>.38");
document.write("<option value=''>.39");
document.write("<option value=''>.40"); 
document.write("<option value=''>.41");
document.write("<option value=''>.42");
document.write("<option value=''>.43");
document.write("<option value=''>.44");
document.write("<option value=''>.45");
document.write("<option value=''>.46");
document.write("<option value=''>.47"); 
document.write("<option value=''>.48");
document.write("</select></td></tr>");	
document.write("<tr>");	
document.write("<td title='Number of Words is needed to calculate cost.'><FONT face='Verdana' size='-2'>Number of Words in Source Document:</font></td>");
document.write("<td title='Number of Words is needed to calculate cost.'><input type='text' name='numwords' size='22' onblur='isnumbers(this.value)' STYLE='width: 137px'></td></tr>");
document.write("<tr><td title='Number of days required for translation to be completed.'><FONT face='Verdana' size='-2'>Enter Your Turn Around Time in Days</font></td>");
document.write("<td title='Number of days required for translation to be completed.'><input type='text' name='rush' size='22' STYLE='width: 137px' onblur='isnumbersforturn(this.value)'></td></tr>");
document.write("<tr><td title='Rush Job? Choose Percentage that you would like to add.'><FONT face='Verdana' size='-2'>Add a Percentage for a Rush Job</font></td>");
document.write("<td title='Rush Job? Choose Percentage that you would like to add.'><select name='rushjob' STYLE='width: 137px'>");
document.write("<option value=''>% for rush job :");
document.write("<option value=''>15%");
document.write("<option value=''>20%");
document.write("<option value=''>25%");
document.write("<option value=''>30%");
document.write("<option value=''>35%");
document.write("<option value=''>40%");
document.write("<option value=''>45%");
document.write("<option value=''>50%");
document.write("</select></td></tr>");
document.write("<tr><td title='Add Word Increase?'><FONT face='Verdana' size='-2'>Word Increase for Language Difference:</font></td>");
document.write("<td title='Add Word Increase?'><select name='increase' STYLE='width: 137px'>");
document.write("<option value=''>word increase  :");
document.write("<option value=''>10%");
document.write("<option value=''>15%");
document.write("<option value=''>20%");
document.write("<option value=''>25%");
document.write("<option value=''>30%");
document.write("</select></td></tr>");
document.write("<tr><td title='Typesetting Cost.'><FONT face='Verdana' size='-2'>Hourly Rate for Typesetting:</font></td>");
document.write("<td title='Hourly rate'><select name='rate' STYLE='width: 137px'>");
document.write("<option value=''>hourly rate in $$  :");
document.write("<option value=''>$15");
document.write("<option value=''>$20");
document.write("<option value=''>$25");
document.write("<option value=''>$30");
document.write("<option value=''>$35");
document.write("<option value=''>$40");
document.write("<option value=''>$45"); 
document.write("<option value=''>$50");
document.write("<option value=''>$55");
document.write("<option value=''>$60");
document.write("<option value=''>$65");
document.write("<option value=''>$70");
document.write("<option value=''>$75");
document.write("<option value=''>$80");
document.write("<option value=''>$85");
document.write("<option value=''>$90");
document.write("<option value=''>$95");
document.write("<option value=''>$100");
document.write("<option value=''>$105");
document.write("<option value=''>$110");
document.write("<option value=''>$115");
document.write("<option value=''>$120");
document.write("</select></td></tr>");
document.write("<tr><td title='Typesetting Cost.'><FONT face='Verdana' size='-2'># of Hours for Typesetting:</font></td>");
document.write("<td title='Hourly rate'><select name='hours' STYLE='width: 137px'>");
document.write("<option value=''>hours to complete:");
document.write("<option value=''>2");
document.write("<option value=''>5");
document.write("<option value=''>10");
document.write("<option value=''>15");
document.write("<option value=''>20");
document.write("<option value=''>25");
document.write("<option value=''>30");
document.write("<option value=''>35");
document.write("<option value=''>40");
document.write("<option value=''>45");
document.write("<option value=''>50");
document.write("<option value=''>55");
document.write("<option value=''>60");
document.write("<option value=''>65");
document.write("<option value=''>70");
document.write("<option value=''>75");
document.write("<option value=''>80");
document.write("<option value=''>85");
document.write("</select></td></tr>");
document.write("<tr><td title='Your translation assignment will be broken down into two costs.'><FONT face='Verdana' size='-2'>The Low Cost for Translation is:</font></td>");
document.write("<td title='Your low cost estimate for this translation assignment.'><input type='text' name='lowcostend' size='22' STYLE='width: 137px'></td></tr>");
document.write("<tr><td title='Your high cost estimate for this translation assignment.'><FONT face='Verdana' size='-2'>The High Cost for Translation is:</font></td>");
document.write("<td title='Your high cost estimate for this translation assignment.'><input type='text' name='highcostend' size='22' STYLE='width: 137px'></td></tr>");
document.write("<tr><td title='Need a printed copy? Click the button'><FONT face='Verdana' size='-2' >Print the Results? Please Select the Box:</font></td>");
document.write("<td title='Need a printed copy? Click the button'><input type='radio' name='printbox'><br></td></tr></table>");
document.write("<table border='0' width='460' class=newcolor>");
document.write("<tr><td width='15'></td>");
document.write("<td><input type='button' value='Calculate Cost For Translation' onclick='calculate(this.form)'></td>");
document.write("<td><input type='reset' value='Reset the Form' name='reset'></td></tr></table>");
document.write("<p></p></form>");
document.write("</body></html>");

}//end of creating main tool page
//---------------------------------------------------------

function orginalstyles(x){
	//below sets the initial styles for opening tool page
	
			document.write("<style>");
			document.write("table.newcolor{background-color:white}");
			document.write("select{color:#0033cc;font-family:Verdana;font-size:8pt}");
			document.write("form{font-family:Verdana;color#ff9900;font-size:8pt}");
			document.write("</style>");
		
}

//----------------------------------------------------------
function help(x){
	helpval=document.forms.myform.helpsec;
		if(helpval.selectedIndex==1){aboutus();};
		if(helpval.selectedIndex==2){helpwin();};
		if(helpval.selectedIndex==3){theversion()};
}
//-----------------------------------------------------------
function aboutus(){
window.open("AboutUs.html","LSI","width=650 height=350 scrollbars=yes")
}
//-----------------------------------------------------------
//Patrick Runk

function theversion(){
window.open("version.html","version","width=650 height=550 scrollbars=yes")
}
//-----------------------------------------------------------
//opening new help window with the help section
function helpwin(){
window.open("help.html","help","width=360 height=350 scrollbars=yes")
}

//-----------------------------------------------------------
//checking to see if they have chosen a source and target language then checking
//to see if they are choosing the same langauges
function validationlanguage(){
		var source=document.forms.myform.source;
	 	var target=document.forms.myform.target;
	 	var numsourceindex=1*source.selectedIndex;
	 	var targetsourceindex=1*target.selectedIndex;
	 	var valuezero=0;
	 		if(numsourceindex==valuezero){alert("Please choose a source language")};
			if(targetsourceindex==valuezero){alert("Please choose a target language")};
		var valueone=1;
			if(targetsourceindex==numsourceindex){alert("Please choose a different target language")};
		//end of validation for language choice
		}
//-----------------------------------------------------------
function validationwords(){
		if(document.forms.myform.numwords.value==""){alert("Please enter the number of words in the source document")
}
document.forms.myform.numwords.value=document.forms.myform.numwords.value+" Words";		
//end of validating missing number and words
}			
//------------------------------------------------------------
//need function to validate for numbers in the word count field
function isnumbers(z){
  				var oldstring = document.forms.myform.numwords.value;
				var newstring = parseFloat(oldstring).toString();
				var InpValid=1;
					if (oldstring.length == newstring.length && newstring != "NaN") {
					//alert("Input is a number");
					}
					else {
							alert("The character you entered is not a number. Please enter a number");
							document.forms.myform.numwords.value="";
							document.forms.myform.numwords.focus()
							InpValid=0;
					}
 }
//---------------------------------------------------------------------
//needed function below to validate input for turn around time in day field
function isnumbersforturn(z){
  				var oldstring = document.forms.myform.rush.value;
				var newstring = parseFloat(oldstring).toString();
				var InpValid=1;
					if (oldstring.length == newstring.length && newstring != "NaN") {
					//alert("Input is a number");
					}
					else {
							alert("The character you entered is not a number. Please enter a number");
							document.forms.myform.rush.value="";
							document.forms.myform.rush.focus()
							InpValid=0;
					}
 }



function calculate(form){
	
		//first function that gets called after submit button is clicked
	 //setting values for languages
	 eng="English";  		rus="Russian";
	 spa="Spanish";  		fre="French";
	 port="Portugese"; 		ita="italian";
	 ara="Arabic"; 			cam="cambodian";
	 chi="Chinese"; 		dan="Danish";
	 fin="Finnish"; 		ger="German";
	 gre="Greek"; 			hai="Haitian";
	 heb="Hebrew"; 			hin="Hindi";
	 hun="Hungarian"; 		ind="Indonesian";
	 jap="Japanese"; 		kor="Korean";
	 lao="Laotian"; 		lat="Latin";
	 lith="Lithuanian"; 	mal="malay";
	 norw="Norwegian"; 		pol="Polish";
	 port="Portuguese"; 	rom="Rumanian";
	 serb="Serbocroa"; swed="Swedish";
	 turk="Turkish"; 		urd="Urdo";
	 viet="Vietnamese";
	 //----------------------------------------------------
	 //grabbing source value from drop down list
	 sourceval=document.myform.source.value
	targetval=document.myform.target.value
	//-----------------------------------------------------
	//setting values for low cost
	lowcost=document.forms.myform.lowcost
			if(lowcost.selectedIndex==1){lowcost=.09;};
			if(lowcost.selectedIndex==2){lowcost=.10};
			if(lowcost.selectedIndex==3){lowcost=.11};
			if(lowcost.selectedIndex==4){lowcost=.12};
			if(lowcost.selectedIndex==5){lowcost=.13};
			if(lowcost.selectedIndex==6){lowcost=.14};
			if(lowcost.selectedIndex==7){lowcost=.15};
			if(lowcost.selectedIndex==8){lowcost=.16};
			if(lowcost.selectedIndex==9){lowcost=.17};
			if(lowcost.selectedIndex==10){lowcost=.18};
			if(lowcost.selectedIndex==11){lowcost=.19};
			if(lowcost.selectedIndex==12){lowcost=.20};
			if(lowcost.selectedIndex==13){lowcost=.21};
			if(lowcost.selectedIndex==14){lowcost=.22};
			if(lowcost.selectedIndex==15){lowcost=.23};
			if(lowcost.selectedIndex==16){lowcost=.24};
			if(lowcost.selectedIndex==17){lowcost=.25};
			if(lowcost.selectedIndex==18){lowcost=.26};
			if(lowcost.selectedIndex==19){lowcost=.27};
			if(lowcost.selectedIndex==20){lowcost=.28};
			if(lowcost.selectedIndex==21){lowcost=.29};
			if(lowcost.selectedIndex==22){lowcost=.30};
			if(lowcost.selectedIndex==23){lowcost=.31};
			if(lowcost.selectedIndex==24){lowcost=.32};
			if(lowcost.selectedIndex==25){lowcost=.33};
			if(lowcost.selectedIndex==26){lowcost=.34};
			if(lowcost.selectedIndex==27){lowcost=.35};
			if(lowcost.selectedIndex==28){lowcost=.36};
			if(lowcost.selectedIndex==29){lowcost=.37};
			if(lowcost.selectedIndex==30){lowcost=.38};
			if(lowcost.selectedIndex==31){lowcost=.39};
			if(lowcost.selectedIndex==32){lowcost=.40};
			if(lowcost.selectedIndex==33){lowcost=.41};
	//------------------------------------------------------------
		highcost=document.forms.myform.highcost;
			if(highcost.selectedIndex==1){highcost=.09};
			if(highcost.selectedIndex==2){highcost=.10};
			if(highcost.selectedIndex==3){highcost=.11};
			if(highcost.selectedIndex==4){highcost=.12};
			if(highcost.selectedIndex==5){highcost=.13};
			if(highcost.selectedIndex==6){highcost=.14};
			if(highcost.selectedIndex==7){highcost=.15};
			if(highcost.selectedIndex==8){highcost=.16};
			if(highcost.selectedIndex==9){highcost=.17};
			if(highcost.selectedIndex==10){highcost=.18};
			if(highcost.selectedIndex==11){highcost=.19};
			if(highcost.selectedIndex==12){highcost=.20};
			if(highcost.selectedIndex==13){highcost=.21};
			if(highcost.selectedIndex==14){highcost=.22};
			if(highcost.selectedIndex==15){highcost=.23};
			if(highcost.selectedIndex==16){highcost=.24};
			if(highcost.selectedIndex==17){highcost=.25};
			if(highcost.selectedIndex==18){highcost=.26};
			if(highcost.selectedIndex==19){highcost=.27};
			if(highcost.selectedIndex==20){highcost=.28};
			if(highcost.selectedIndex==21){highcost=.29};
			if(highcost.selectedIndex==22){highcost=.30};
			if(highcost.selectedIndex==23){highcost=.31};
			if(highcost.selectedIndex==24){highcost=.32};
			if(highcost.selectedIndex==25){highcost=.33};
			if(highcost.selectedIndex==26){highcost=.34};
			if(highcost.selectedIndex==27){highcost=.35};
			if(highcost.selectedIndex==28){highcost=.36};
			if(highcost.selectedIndex==29){highcost=.37};
			if(highcost.selectedIndex==30){highcost=.38};
			if(highcost.selectedIndex==31){highcost=.39};
			if(highcost.selectedIndex==32){highcost=.40};
			if(highcost.selectedIndex==33){highcost=.41};
	//------------------------------------------------------------
	//below we are calculating the cost for a rush job
		rushjobcost=document.forms.myform.rushjob;
			if(rushjobcost.selectedIndex==1){rushjobcost=.15};
			if(rushjobcost.selectedIndex==2){rushjobcost=.20};
			if(rushjobcost.selectedIndex==3){rushjobcost=.25};
			if(rushjobcost.selectedIndex==4){rushjobcost=.30};
			if(rushjobcost.selectedIndex==5){rushjobcost=.35};
			if(rushjobcost.selectedIndex==6){rushjobcost=.40};
			if(rushjobcost.selectedIndex==7){rushjobcost=.45};
			if(rushjobcost.selectedIndex==8){rushjobcost=.50};
	//------------------------------------------------------------
	//below calculating if they are selecting an increase in words
	//Patrick Runk
		increase=document.forms.myform.increase;
			if(increase.selectedIndex==1){increase=.10};
			if(increase.selectedIndex==2){increase=.15};
			if(increase.selectedIndex==3){increase=.20};
			if(increase.selectedIndex==4){increase=.25};
			if(increase.selectedIndex==5){increase=.30};
	//------------------------------------------------------------				
	function validaterush(){document.forms.myform.rush.focus();}
	//function needed above to validate missing days amount
	//------------------------------------------------------------
	//calculating cost for translations
	// The gears start below
			//pulling values from rate pull down
			rate=document.forms.myform.rate;
			if(rate.selectedIndex==1){rate=15};
			if(rate.selectedIndex==2){rate=20};
			if(rate.selectedIndex==3){rate=25};
			if(rate.selectedIndex==4){rate=30};
			if(rate.selectedIndex==5){rate=35};
			if(rate.selectedIndex==6){rate=40};
			if(rate.selectedIndex==7){rate=45};
			if(rate.selectedIndex==8){rate=50};
			if(rate.selectedIndex==9){rate=55};
			if(rate.selectedIndex==10){rate=65};
			if(rate.selectedIndex==11){rate=70};
			if(rate.selectedIndex==12){rate=75};
			if(rate.selectedIndex==13){rate=80};
			if(rate.selectedIndex==14){rate=85}
			if(rate.selectedIndex==15){rate=90};
			if(rate.selectedIndex==16){rate=95};
			if(rate.selectedIndex==17){rate=100};
			if(rate.selectedIndex==18){rate=105};
			if(rate.selectedIndex==19){rate=110};
			if(rate.selectedIndex==20){rate=115};
			if(rate.selectedIndex==21){rate=120};
			
			//pulling values from the hours pull down
			
			hours=document.forms.myform.hours;
			if(hours.selectedIndex==1){hours=2};
			if(hours.selectedIndex==2){hours=5};
			if(hours.selectedIndex==3){hours=10};
			if(hours.selectedIndex==4){hours=15};
			if(hours.selectedIndex==5){hours=20};
			if(hours.selectedIndex==6){hours=25};
			if(hours.selectedIndex==7){hours=30};
			if(hours.selectedIndex==8){hours=40};
			if(hours.selectedIndex==9){hours=45};
			if(hours.selectedIndex==10){hours=50};
			if(hours.selectedIndex==11){hours=55};
			if(hours.selectedIndex==12){hours=60};
			if(hours.selectedIndex==13){hours=65};
			if(hours.selectedIndex==14){hours=70};
			if(hours.selectedIndex==15){hours=75};
			if(hours.selectedIndex==16){hours=80};
			if(hours.selectedIndex==17){hours=85};
			
	if(document.forms.myform.rush.value==""){validaterush()}
	rush=document.forms.myform.rush.value
		if(rush==""){alert("You left the turn around time box empty. This is just needed for informational purposes.")
					}
	totalwords=document.forms.myform.numwords.value
	totalwords=totalwords*1;
		totallowcost=totalwords*lowcost;
				//below testing to see if they are selecting a rush job and calculating low cost		
				if(rushjobcost.selectedIndex!=0){
				totallowcost=totallowcost+(totallowcost*rushjobcost);
				}
				//below testing to see if they are selecting the percetage of word increase for low cost	
				if(increase.selectedIndex!=0){
				totallowcost=totallowcost+(totallowcost*increase);
				}
		//need to see if they selected the drop down box for hourly rate for typesetting
		//setting it to the low cost
				if(rate.selectedIndex!=0 && hours.selectedIndex!=0){
					totallowcost=totallowcost+(rate*hours);
					}		
		
		//need to see if they selected the drop down box for number of hours		
				
		totallowcost=Math.round(totallowcost);
			document.forms.myform.lowcostend.value='$'+ totallowcost;
			//low cost calculated at this point above
		totalhighcost=totalwords*highcost;
		
			//below testing to see if they are selecting a rush job and calculating high cost		
				if(rushjobcost.selectedIndex!=0){
				totalhighcost=totalhighcost+(totalhighcost*rushjobcost);
				}
			//below testing to see if they are selecting the percetage of word increase for high cost
				if(increase.selectedIndex!=0){
				totalhighcost=totalhighcost+(totalhighcost*increase);
				}
		//need to see if they selected the drop down box for hourly rate for typesetting
		//setting it to the high cost		
		if(rate.selectedIndex!=0 && hours.selectedIndex!=0){
					totalhighcost=totalhighcost+(rate*hours);
					}				
						
						
		totalhighcost=Math.round(totalhighcost);
			document.forms.myform.highcostend.value='$'+ totalhighcost;
			//high cost calculated at this point
	//------------------------------------------------------------
	//Now need to check to see if they clicked on the calculate button before choosing anything
	//Also clearing out the two fields so they do not have the dreaded $Nan's
	if(document.forms.myform.lowcostend.value=="$NaN" && document.forms.myform.highcostend.value=="$NaN") 
		{alert("Please choose source and target languages");
		document.forms.myform.lowcostend.value="$0";
		document.forms.myform.highcostend.value="$0";
		}
	//---------------------------------------------------------------
	
	//checking to see if checkbox is selected and if it is call function and pass parameters
		if((document.forms.myform.printbox.checked)){
			newwin(sourceval,targetval,rushjobcost,increase);
		}
	}
	
	//-------------------------------------------------------------
	//below is to open new window and print the results from the form
	function newwin(x,y){
	newwin=open("","results","width=350, height=400, status=no, toolbar=yes, menubar=no");
	newwin.document.open();
	newwin.window.document.write("<html><head><script>function closewin(){window.close();opener.window.document.forms.myform.printbox.checked=false;opener.window.location.reload(false)}</script>");
	newwin.window.document.write("<style type='text/css'>input{font-family:Verdana;font-size:8pt}</style></head>");
	newwin.window.document.write("<body bgcolor='white'>");
	newwin.window.document.write("<div align='center'><h2><font face='Verdana'>Cost Estimate</font></h2>");
	newwin.window.document.write("<table border='2' width='300' align='center' bordercolor='#808080' bgcolor='#FFFFB7'>");
	newwin.window.document.write("<tr><td><font face='Verdana'>Source language:</font></td><td>");
	newwin.window.document.write(sourceval+"</td></tr>");
	newwin.window.document.write("<tr><td><font face='Verdana'>Target language:</font></td><td>");
	newwin.window.document.write(targetval+"</td></tr>");
	newwin.window.document.write("<tr><td><font face='Verdana'>Number of words:</font></td><td>");
	newwin.window.document.write(totalwords+"</td></tr>");
	newwin.window.document.write("<tr><td><font face='Verdana'>Turn around time</font></td><td>");
	newwin.window.document.write(rush+"</td></tr>");
			if(rushjobcost.selectedIndex!=0){
			newwin.window.document.write("<tr><td><font face='Verdana'>Percentage for rush job</font></td><td>");
			newwin.window.document.write(rushjobcost+"%"+"</td></tr>");}
			if(increase.selectedIndex!=0){
			newwin.window.document.write("<tr><td><font face='Verdana'>Percentage of word increase</font></td><td>");
			newwin.window.document.write(increase+"%"+"</td></tr>");}
			//strarting here
			if(rate.selectedIndex!=0){
	newwin.window.document.write("<tr><td><font face='Verdana'>Hourly rate for typesetting</font></td><td>");
	//need to test for both rate and hours like above
	newwin.window.document.write(rate+"</td></tr>");
	}
			if(hours.selectedIndex!=0){
	newwin.window.document.write("<tr><td><font face='Verdana'>Number of hours for typesetting</font></td><td>");
	newwin.window.document.write(hours+"</td></tr>");
	}
	newwin.window.document.write("<tr><td><font face='Verdana'>Lowcost</font></td><td>");
	newwin.window.document.write("$"+totallowcost+"</td></tr>");
	newwin.window.document.write("<tr><td><font face='Verdana'>Highcost</font></td><td>");
	newwin.window.document.write("$"+totalhighcost+"</td></tr>");
	newwin.window.document.write("<tr><td><input type='Button' value='Close Window' onclick='closewin()'></td></tr>");
	newwin.window.document.write("</table>");
	newwin.window.document.write("</body></html>");
	}
	//------------------------------------------------------------------------
	//defining windows below for customize windows
	
	
	
	//-------------call main function
	
	mainpage();
