<!--
	function cngfield(fnum){
		document.theform.field3.value = fnum;
	}
	
	function cngAttribField(fnum)
	{
		document.formAttribRatings.field6.value =fnum;
	}
	
	function calcSize(){
	var field1 = document.theform.field1.value
	var field2 = document.theform.field2.value
	var field3 = document.theform.field3.value 
	
		document.theform.field4.value = ((field1 / 100) * (1 - (field1 / 100)) * (field3 * field3)) / ((field2 /100 ) * (field2 / 100));
		document.theform.field4.value = Math.round(document.theform.field4.value)
		document.theform.field4.focus(); 
	
	}
	
	function calcFPC(){
	var lfield4 = document.theform.field4.value
	var lfield5 = document.theform.field5.value
	var lfield6 = 0
	var lfield7 = 0
	var lfield8 = 0

	//lfield6 = Math.round(lfield4 * lfield5)
	//lfield7 = Math.eval("lfield5 + lfield4 - 1")
	//lfield8 = Math.eval("lfield6 / lfield7 * 100")
	//document.theform.field6.value = Math.round(lfield8)

	lfield6 = lfield4 * lfield5
	lfield7 = (-lfield5 - lfield4 + 1) * -1
	lfield8 = lfield6 / lfield7
	document.theform.field6.value = Math.round(lfield8)

	//document.theform.field6.value = lfield6 / lfield7
	//lfield8 = Math.round(lfield6 / lfield7)
	//document.theform.field6.value = lfield8
	//alert(lfield8)
	//=(F19*F25)/(F25+F19-1)
	
	}
	
	function calcAttribFPC()
	{
		var lfield7 = document.formAttribRatings.field7.value
		var lfield8 = document.formAttribRatings.field8.value
		var lfield9 = 0
		var temp
		temp=(lfield7 * lfield8) / ((-lfield8 - lfield7 + 1) * -1);
		document.formAttribRatings.field9.value = Math.round(temp)
		document.formAttribRatings.field9.focus(); 		
		
	}
	
	function calcAttribRange()
	{
		var lfield1 = document.formAttribRatings.field1.value
		var lfield2 = document.formAttribRatings.field2.value
		var lfield3 = 0
		var lfield4 = document.formAttribRatings.field4.value
				
		if (lfield1 != "") 
		{
			if (lfield2 != "") 
			{
				lfield3 = (lfield2 - lfield1) + 1;
				document.formAttribRatings.field3.value = lfield3;
				if (lfield4 == "")
				{
					///document.formAttribRatings.field4.value = (0.65 * (((lfield2 - lfield1)/2) + lfield1)) / 10;
					document.formAttribRatings.field4.value = (0.65 *((lfield3 -1) / 2))
				}
			}
		}
	}
	
	function scaleChange()
		{
			document.formAttribRatings.field3.value = "";
			document.formAttribRatings.field4.value = "";
		}
		
	function calcAttribSize()
	{
		var lfield4 = 0
		var lfield5 = 0
		var lfield6 = 0
		var lfield7 = 0
		
		lfield4 = document.formAttribRatings.field4.value
		lfield5 = document.formAttribRatings.field5.value
		lfield6 = document.formAttribRatings.field6.value
			
		document.formAttribRatings.field7.value = ((lfield4 * lfield4) * (lfield6 * lfield6)) / (lfield5 * lfield5);
		document.formAttribRatings.field7.value = Math.round(document.formAttribRatings.field7.value)
		document.formAttribRatings.field7.focus(); 		
	}
	
	// function that displays status bar message

function dm(msgStr) {
  document.returnValue = false;
  if (document.images) { 
     window.status = msgStr;
     document.returnValue = true;
  }
}
var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";
function dmim(msgStr) {
  document.returnValue = false;
  if (showMsg) { 
    window.status = msgStr;
    document.returnValue = true;
  }
}

/* CalcConfIntPrn.html javascript calculator
   copyright 2003 mark mitchell 
   GNU General Public License
*/
var confLevel = 1.96;
var sResultsWhole = false;

function clearFields(obj) {
  obj.population.value = "";
  obj.sampleSize.value = "";
  obj.percentage.value = "50";
  obj.margin.value = "";
  obj.confInt.value = "";
}

function compute(obj) {
 obj.margin.value = "";
 obj.confInt.value = "";
 if ((obj.population.value == "") ||
  (obj.sampleSize.value == "")) {
  (obj.percentage.value == "") ||
  alert("All values must be filled in");
  return true;
 }
 obj.population.value = removeCommas(obj.population.value);
 obj.sampleSize.value = removeCommas(obj.sampleSize.value);
 obj.percentage.value = removeCommas(obj.percentage.value);
 var population = eval(obj.population.value);
 var sampleSize = eval(obj.sampleSize.value);
 var percentage = eval(obj.percentage.value) / 100.0;

 if (population <= 1) {
  alert("Population must be greater than 1");
  return true;
 }
 if ((sampleSize < 1) || (sampleSize > population)) {
  alert("Sample size must be between 1 and the population");
  return true;
 }
 if ((percentage < 0.0) ||
  (percentage > 1.0)) {
  alert("Percentage must be between 0 and 100");
  return true;
 }

 var pq = percentage * (1.0 - percentage);
 var confInt = 100.0 * confLevel * Math.sqrt(pq * (population - sampleSize) /
  (population - 1.0) / sampleSize);

 // round off to tenths place
 if (sResultsWhole) {
  confInt = confInt / 100.0;
  obj.margin.value = Math.round(confInt * population);
  obj.confInt.value = Math.round((percentage - confInt) * population) +
   " до " + Math.round((percentage + confInt) * population);
 } else {
  percentage = 100.0 * percentage;
  obj.margin.value = Math.round(confInt * 10.0) / 10.0;
  obj.confInt.value = Math.round((percentage - confInt) * 10.0) / 10.0 + 
   " до " + Math.round((percentage + confInt) * 10.0) / 10.0 ;
 }
}

function confLevel90 (obj) {
 confLevel = 1.65;
}

function confLevel95 (obj) {
 confLevel = 1.96;
}

function confLevel99 (obj) {
 confLevel = 2.576;
}

function removeCommas (s) {
 var t = "";
 var i;
 var c, comma = ",";
 for (i = 0; i < s.length; i++) {
  c = s.charAt(i);
  if (c != comma) t += c;
 }
 return t;
}

// stop hiding -->

