function isNum(arg)
{
	var args = arg;
	var fad = true;

	if (args == "" || args == null || args.length == 0)
	{
		return false;
	}

	args = args.toString();

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


function convert()
{
	var val = document.cir.inp.value;

	if(!isNum(val))
	{
		val = val.substring(0, val.length-1);
		document.cir.inp.value = val;
	}
	else
	{
		document.cir.va1.value = Math.round(Math.sin(val)*100000)/100000;
		document.cir.va11.value = Math.round(Math.cos(val)*100000)/100000;
		document.cir.va12.value = Math.round(Math.tan(val)*100000)/100000;
		document.cir.va13.value = Math.round((1/Math.tan(val))*100000)/100000;
		document.cir.va14.value = Math.round((1/Math.cos(val))*100000)/100000;
		document.cir.va15.value = Math.round((1/Math.sin(val))*100000)/100000;

		document.cir.va2.value = Math.round(Math.asin(val)*100000)/100000;
		document.cir.va21.value = Math.round(Math.acos(val)*100000)/100000;
		document.cir.va22.value = Math.round(Math.atan(val)*100000)/100000;
		document.cir.va23.value = Math.round(Math.atan(1/val)*100000)/100000;
		document.cir.va24.value = Math.round(Math.acos(1/val)*100000)/100000;
		document.cir.va25.value = Math.round(Math.asin(1/val)*100000)/100000;
		
		var deg = 57.2957795130823;
		document.cir.va3.value = Math.round(Math.sin(val/deg)*100000)/100000;
		document.cir.va31.value = Math.round(Math.cos(val/deg)*100000)/100000;
		document.cir.va32.value = Math.round(Math.tan(val/deg)*100000)/100000;
		document.cir.va33.value = Math.round((1/Math.tan(val/deg))*100000)/100000;
		document.cir.va34.value = Math.round((1/Math.cos(val/deg))*100000)/100000;
		document.cir.va35.value = Math.round((1/Math.sin(val/deg))*100000)/100000;

		document.cir.va4.value = Math.round(Math.asin(val)*deg*100000)/100000;
		document.cir.va41.value = Math.round(Math.acos(val)*deg*100000)/100000;
		document.cir.va42.value = Math.round(Math.atan(val)*deg*100000)/100000;
		document.cir.va43.value = Math.round(Math.atan(1/val)*deg*100000)/100000;
		document.cir.va44.value = Math.round(Math.acos(1/val)*deg*100000)/100000;
		document.cir.va45.value = Math.round(Math.asin(1/val)*deg*100000)/100000;
		
		

		/*eval = byteval*8;
		document.cir.va2.value = eval;
		document.cir.va21.value = eval/1000;
		document.cir.va22.value = eval/1000000;
		document.cir.va23.value = eval/1000000000;

		byteval = tobyte(val,opt,'BIN');
		document.cir.va3.value = byteval;
		document.cir.va31.value = byteval/1024;
		document.cir.va32.value = byteval/(1024*1024);
		document.cir.va33.value = byteval/(1024*1024*1024);

		eval = byteval*8;
		document.cir.va4.value = eval;
		document.cir.va41.value = eval/1024;
		document.cir.va42.value = eval/(1024*1024);
		document.cir.va43.value = eval/(1024*1024*1024);*/


	}
}



function color(test)
{

	for(var j=2; j<10; j++)
	{
		var myI=document.getElementsByTagName("input").item(j);
		//myI.setAttribute("style",ch);
		myI.style.backgroundColor=test;
	}
}


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



