function isNum(args)
{
args = args.toString();

if (args.length == 0)
return false;

for (var i = 0; i<args.length; i++)
{
	if ((args.substring(i,i+1) < "0" || args.substring(i, i+1) > "9") && args.substring(i, i+1) != ".")
		{
		return false;
		}
}

return true;

}


function area(varr,c)
{
	var a = document.ell.r1.value;
	var b = document.ell.r2.value;

	if(isNum(a) && isNum(b))
	{
		document.ell.are.value = Math.round((3.14*a*b)*1000)/1000;
	}
	else
	{
		if(c == "1" && !isNum(a))
		{
			a = a.substring(0,a.length-1);
			document.ell.r1.value = a;
		}
		if(c == "2" && !isNum(b))
		{
			b = b.substring(0,b.length-1);
			document.ell.r2.value = b;
		}
	}
}

function vol(varr,c)
{
	var a = document.volell.r1.value;
	var b = document.volell.r2.value;
	var d = document.volell.r3.value;
	
	if(isNum(a) && isNum(b) && isNum(d))
	{
	   	document.volell.are.value = Math.round(((4/3)*3.14*a*b*d)*1000)/1000;
	}
	else
	{
		if(c == "1" && !isNum(a))
		{
			a = a.substring(0,a.length-1);
			document.volell.r1.value = a;
		}
		if(c == "2" && !isNum(b))
		{
			b = b.substring(0,b.length-1);
			document.volell.r2.value = b;
		}
		if(c == "3" && !isNum(d))
		{
			d = d.substring(0,d.length-1);
			document.volell.r3.value = d;
		}
	}
}

function peri(varr,c)
{
	var a = document.perell.r1.value;
	var b = document.perell.r2.value;
	
	if(isNum(a) && isNum(b))
	{
	   document.perell.per.value = Math.round((2 * 3.14 * Math.sqrt((parseInt(a*a) + parseInt(b*b))/2))*1000)/1000;
	}
	else
	{
		if(c == "1" && !isNum(a))
		{
			a = a.substring(0,a.length-1);
			document.perell.r1.value = a;
		}
		if(c == "2" && !isNum(b))
		{
			b = b.substring(0,b.length-1);
			document.perell.r2.value = b;
		}
		
	}
}


function color(test)
{

//var ch ="background-color: "+test+"; width: 60px; height: 25px;";
//alert(ch);
	for(var j=1; j<10; j++)
	{
		if(j!=2 && j!=5 && j!=6 && j!=8 && j!=8 && j!=8 && j!=8)
		{
		var myI=document.getElementsByTagName("input").item(j);
		//myI.setAttribute("style",ch);
		myI.style.backgroundColor=test;
		}
	}
	for(var j=36; j<46; j++)
	{
		if(j==38 || j==42 || j==45)
		{
		var myI=document.getElementsByTagName("input").item(j);
		//myI.setAttribute("style",ch);
		myI.style.backgroundColor=test;
		}
	}

//myI.setAttribute("style","background-color: #F70808; width: 60px; height: 25px;");
}


function color1(test)
{
var myI=document.getElementsByTagName("table").item(0);
//myI.setAttribute("style",ch);
myI.style.backgroundColor=test;
}




