<!--
// Code that hides the script
/* This program is based on CE Expert Version 1.0, by Harry Whatley 
	Copyright 1998, Beckman Coulter, Inc. All rights reserved. */

	function hopto(filename){
		var newplace = filename;
		location = newplace;
	}

	function floatFix(Val,Places){
		var Res = "" + Math.round(Val * Math.pow(10, Places));
		var Dec = Res.length - Places;
/*25*/	if (Places != 0){
			OutString = Res.substring(0, Dec) + "." + Res.substring(Dec, Res.length);
		}
		else
			OutString = Res;
		return (OutString);
	}

 	function getRadioValue(radioObject){
		var f = document.cecalc; 	//refers to the cecalc form--shorthand
			/* Declare and intialize variables used in the calculations */
		var value = null;	 	//return value of the checked radio button
		var pmdqcalc = null;		//for PACE MDQ what pressure calculations
		var p2000calc = null;		//for PACE 2000 what pressure calculations
		var pascal = 0;				//pressure constant
		var hydroinj = 0;
		var capvol = 0;
		var voltowin = 0;
		var pluglen = 0;
		var pluglenpct = 0;
		var capvolrep = 0;
		var secrepvol = 0;
		var analing = 0;
		var analimo = 0;
		var inprsec = 0;
/*50*/
			/* Converting input values to equation shorthand */
		var totllength = document.cecalc.totllength.value;
		var lengthtowin = document.cecalc.lengthtowin.value;
		var insidediam = document.cecalc.insidediam.value;
		var temp = document.cecalc.temp.value;
		var pressure = document.cecalc.pressure.value;
		var time = document.cecalc.time.value;

			/* Testing for Proper Length to Window Entry (greater than)0 to 500(inclusive) */
		while(lengthtowin <= 0 || lengthtowin > 500){
		if(lengthtowin <= 0 || lengthtowin > 500){
			lengthtowin = prompt("Length to Window is incorrect. Enter number between 0 and 500","");
		}
		};

			/* Testing for Inside Diameter Entry (greater than)0 to 200(inclusive) */
		while(insidediam <= 0 || insidediam > 200){
		if(insidediam <= 0 || insidediam > 200){
			insidediam = prompt("Temperature is incorrect. Enter a number between 0 and 200","");
		}
		};
		
			/* Testing for Proper Temperature Entry 5 to 80 */
		while(temp < 5 || temp > 80){
		if(temp < 5 || temp > 80){
			temp = prompt("Temperature is incorrect. Enter a number between 5 and 80","");
		}
		};
/*79*/
			/* Testing for Proper Pressure Entry 0 to 100 psi */
		while(pressure < 0 || pressure > 100){
		if(pressure < 0 || pressure > 100){
			pressure = prompt("Please enter a number between 0 and 100 psi, inclusive","");
		}
		};

			/* Calculating the Pressure in PASCALS for the Poiseuielle Formula */
		pascal = pressure * (6.89476 * Math.pow(10,-8));

			/* Testing for Proper Time Entry 1 to 60 sec */
		while(time < 0 || time > 100){
		if(time < 0 || time > 100){
     		time = prompt("Please enter a number between 0 and 60, inclusive","");
		}
		};

			/* Calculate Viscosity for Hydrodynamic Injection */
		var x = Math.LOG10E * Math.log(temp);
		var viscosity = (0.1349 * Math.pow(x,4)) - (0.2282 * Math.pow(x,3)) - 
			(0.7073 * Math.pow(x,2)) + (0.6748 * x) + 1.4377;
/*101*/
		for (var i=0; i<radioObject.length; i++){
			if (radioObject[i].checked){
				value = radioObject[i].value;
				break;
			}
		}

			/* Setting up PACE2000 or PACE5000 specific items */
	  	if (value == "pace2000"){
			totllength = parseFloat(lengthtowin) + 7;

			/* Start the Calculations */
			hydroinj = ((pascal * Math.pow(insidediam,4) * 
				Math.PI * time) / 
				(128 * viscosity * totllength/100)) * 100;
			pluglen = hydroinj * 0.508;
			if (pluglen > lengthtowin  * 10){
				pluglen = lengthtowin * 10;	
			}
			pluglenpct = (pluglen / lengthtowin) * 10;
			if (pluglenpct > 100){
				pluglenpct = 100;
/*125*/	}
			capvol = Math.round((Math.PI * Math.pow(insidediam/2,2) * 
				totllength)/100);
			voltowin = Math.round((Math.PI * Math.pow(insidediam/2,2) * 
				parseFloat(lengthtowin))/100);
			capvolrep = hydroinj / capvol;
			secrepvol = Math.round(capvol / (hydroinj / time));
			var inprsec = pressure * time;


			/* Convert the items to Write Out to the Form*/
			document.cecalc.totllength.value = totllength;
			document.cecalc.lengthtowin.value = lengthtowin;
			document.cecalc.insidediam.value = insidediam;
			document.cecalc.temp.value = temp;
			document.cecalc.pressure.value = pressure;
			var hydroout;
			if (hydroinj < 0.1){
				hydroout = hydroinj;
			}
			if (hydroinj >= 0.1){
				hydroout = floatFix(hydroinj,2);
			}
			document.cecalc.hydroinj.value = hydroout;
			document.cecalc.capvol.value = capvol;
/*150*/			document.cecalc.voltowin.value = voltowin;
			var plugout;
			if (pluglen < 0.1){
				plugout = pluglen;
			}
			if (hydroinj >= 0.1){
				plugout = floatFix(pluglen,2);
			}
 			document.cecalc.pluglen.value = plugout;
			var plugpctout;
			if (pluglenpct < 0.1){
				plugpctout = pluglenpct;
			}
			if (hydroinj >= 0.1){
				plugpctout  = floatFix(pluglenpct,2);
			}
			document.cecalc.pluglenpct.value = plugpctout;
			document.cecalc.capvolrep.value = capvolrep;
			document.cecalc.secrepvol.value = secrepvol;
			document.cecalc.inprsec.value = inprsec;
			var viscosout = floatFix(viscosity,3);
			document.cecalc.viscos.value = viscosout;
		}

/*175*/			/* Setting up PACE MDQ specific items */
		if (value == "pacemdq"){
			totllength = parseFloat(lengthtowin) + 10;
			/* Testing for Proper Temperature Entry 5 to 80 */

			/* Start the Calculations */
			hydroinj = ((pascal * Math.pow(insidediam,4) * 
				Math.PI * time) / 
				(128 * viscosity * totllength/100))*100;
			pluglen = hydroinj * 0.508;
			if (pluglen > lengthtowin  * 10){
				pluglen = lengthtowin * 10;	
			}
			pluglenpct = (pluglen / lengthtowin) * 10;
			if (pluglenpct > 100){
				pluglenpct = 100;
			}
			capvol = Math.round((Math.PI * Math.pow(insidediam/2,2) * 
				totllength)/100);
			voltowin = Math.round((Math.PI * Math.pow(insidediam/2,2) * 
				parseFloat(lengthtowin))/100);
			capvolrep = hydroinj / capvol;
			secrepvol = Math.round(capvol / (hydroinj / time));
			var inprsec = pressure * time;

/*200*/			/* Convert the items to Write Out to the Form*/
			document.cecalc.totllength.value = totllength;
			document.cecalc.lengthtowin.value = lengthtowin;
			document.cecalc.insidediam.value = insidediam;
			document.cecalc.temp.value = temp;
			document.cecalc.pressure.value = pressure;
			var hydroout;
			if (hydroinj < 0.1){
				hydroout = hydroinj;
			}
			if (hydroinj >= 0.1){
				hydroout = floatFix(hydroinj,2);
			}
			document.cecalc.hydroinj.value = hydroout;
			document.cecalc.capvol.value = capvol;
			document.cecalc.voltowin.value = voltowin;
			var plugout;
			if (pluglen < 0.1){
				plugout = pluglen;
			}
			if (hydroinj >= 0.1){
				plugout = floatFix(pluglen,2);
			}
			document.cecalc.pluglen.value = plugout;
/*225*/			var plugpctout;
			if (pluglenpct < 0.1){
				plugpctout = pluglenpct;
			}
			if (hydroinj >= 0.1){
				plugpctout  = floatFix(pluglenpct,2);
			}
			document.cecalc.pluglenpct.value = plugpctout;
			document.cecalc.capvolrep.value = capvolrep;
			document.cecalc.secrepvol.value = secrepvol;
			document.cecalc.inprsec.value = inprsec;
			var viscosout = floatFix(viscosity,3);
			document.cecalc.viscos.value = viscosout;
		}

			/* Setting up Generic CE specific items */
		if (value =="generic"){
			while(totllength < lengthtowin){
			if(totllength < lengthtowin){
				totllength = prompt("Total length is incorrect.\nPlease enter a number greater than or equal to the Length to Window","");
			}
			};
/*248*/
				/* Start the Calculations */
			hydroinj = ((pascal * Math.pow(insidediam,4) * 
				Math.PI * time) / 
				(128 * viscosity * totllength/100))*100;
			pluglen = hydroinj * 0.508;
			if (pluglen > lengthtowin  * 10){
				pluglen = lengthtowin * 10;	
			}
			pluglenpct = (pluglen / lengthtowin) * 10;
			if (pluglenpct > 100){
				pluglenpct = 100;
			}
			capvol = Math.round((Math.PI * Math.pow(insidediam/2,2) * 
				totllength)/100);
			voltowin = Math.round((Math.PI * Math.pow(insidediam/2,2) * 
				parseFloat(lengthtowin))/100);
			capvolrep = hydroinj / capvol;
			secrepvol = Math.round(capvol / (hydroinj / time));
			var inprsec = pressure * time;

			/* Convert the items to Write Out to the Form*/
			document.cecalc.totllength.value = totllength;
			document.cecalc.lengthtowin.value = lengthtowin;
			document.cecalc.insidediam.value = insidediam;
			document.cecalc.temp.value = temp;
			document.cecalc.pressure.value = pressure;
			var hydroout;
			if (hydroinj < 0.1){
/*275*/			hydroout = hydroinj;
			}
			if (hydroinj >= 0.1){
				hydroout = floatFix(hydroinj,2);
			}
			document.cecalc.hydroinj.value = hydroout;
			document.cecalc.capvol.value = capvol;
			document.cecalc.voltowin.value = voltowin;
			var plugout = floatFix(pluglen,2);
			if (pluglen < 0.1){
				plugout = pluglen;
			}
			if (hydroinj >= 0.1){
				plugout = floatFix(pluglen,2);
			}
			document.cecalc.pluglen.value = plugout;
			var plugpctout;
			if (pluglenpct < 0.1){
				plugpctout = pluglenpct;
			}
			if (hydroinj >= 0.1){
				plugpctout  = floatFix(pluglenpct,2);
			}
			document.cecalc.pluglenpct.value = plugpctout;
			document.cecalc.capvolrep.value = capvolrep;
/*300*/			document.cecalc.secrepvol.value = secrepvol;
			document.cecalc.inprsec.value = inprsec;
			var viscosout = floatFix(viscosity,3);
			document.cecalc.viscos.value = viscosout;
		}
		return value;
	}
	// end the code that hides the script 
// -->