function global2()
{
x=window.event.keyCode
if(x<48 || x>58 || x==46 ||x==13)
{ alert("Only numbers are valid")
  return false
}
} 
function compute()
{
var nettax,nettax1,nettax2,relief,surcharge1,ab
document.frm.gincome.value=parseInt(document.frm.bsalary.value)+
		   parseInt(document.frm.ifhp.value)+
		   parseInt(document.frm.ifbp.value)+
		   parseInt(document.frm.ifos.value)+
		   parseInt(document.frm.capgain1.value)+
		   parseInt(document.frm.capgain2.value)
//alert("gincome"+document.frm.gincome.value)
		spincome=parseInt(document.frm.capgain2.value)

document.frm.totalincome.value=parseInt(document.frm.gincome.value)-
								 parseInt(document.frm.dedreb2.value)
ab=parseInt(document.frm.totalincome.value)-spincome
//alert("totalincome"+ab)

if((parseInt(document.frm.netagri.value)>0) && (document.frm.netagri.value!=" "))
{  //alert("sanjay")
	a=parseInt(document.frm.totalincome.value)+parseInt(document.frm.netagri.value)
	nincome=a-parseInt(document.frm.capgain2.value)
	sincome=a-parseInt(nincome)
	if(a>50000)
	{
		s=a-50000
		if(s < parseInt(sincome))
			document.frm.stax.value=(s*20)/100
		else
			document.frm.stax.value=(parseInt(sincome)*20)/100 
    }
else
		document.frm.stax.value=0
if(parseInt(nincome)>150000)
{
 morelacs=parseInt(nincome)-150000
 tax=Math.round((morelacs*30)/100)+19000
}
else
{
  if((parseInt(nincome)<=150000) &&parseInt(nincome)>60000)
  {
  morelacs=parseInt(nincome)-60000
  tax=Math.round((morelacs*20)/100)+1000
  }
  else
  {
   if((parseInt(nincome)>50000)&&(parseInt(nincome)<=60000))
   {
   morelacs=parseInt(nincome)-50000
   tax=Math.round((morelacs*10)/100)
   }
  else
   tax=0
  }
 }  
 agrincome=parseInt(document.frm.netagri.value)+50000
 if((parseInt(agrincome)>50000)&&(parseInt(agrincome)<=60000))
  {	
	agrincome=parseInt((parseInt(document.frm.netagri.value)*10)/100)
  }
 else
	{
	if((parseInt(agrincome)>60000)&&(parseInt(agrincome)<=150000))
		agrincome=parseInt((parseInt(document.frm.netagri.value)*20)/100)
	else
		{
		if(parseInt(agrincome)>150000)
			agrincome=parseInt((parseInt(document.frm.netagri.value)*30)/100)
		else
			agrincome=0 
		}	
    }
 if((tax-agrincome)>0)
{document.frm.ntax.value=tax-agrincome
 //alert("ntax"+document.frm.ntax.value)
 }
 else
 {
document.frm.ntax.value=0
}
 document.frm.totaltax.value=parseInt(document.frm.ntax.value)+parseInt(document.frm.stax.value)
}
else
{
a=parseInt(document.frm.totalincome.value)+parseInt(document.frm.netagri.value)
nincome=a-parseInt(document.frm.capgain2.value)
sincome=a-parseInt(nincome)
if(a>50000)
{
  s=a-50000
  if(s<parseInt(sincome))
     document.frm.stax.value=(s*20)/100
  else
     document.frm.stax.value=(parseInt(sincome)*20)/100 
//alert("stax"+document.frm.stax.value)
}
else
document.frm.stax.value=0
//alert("stax"+document.frm.stax.value)
if(parseInt(nincome)>150000)
{
 morelacs=parseInt(nincome)-150000
 tax=Math.round((morelacs*30)/100)+19000
}
else
{
  if((parseInt(nincome)<=150000) &&parseInt(nincome)>60000)
  {
  morelacs=parseInt(nincome)-60000
  tax=Math.round((morelacs*20)/100)+1000
  }
  else
  {
   if((parseInt(nincome)>50000)&&(parseInt(nincome)<=60000))
   {
   morelacs=parseInt(nincome)-50000
   tax=Math.round((morelacs*10)/100)
   }
  else
   tax=0
  }
 }  
document.frm.ntax.value=tax
//alert("ntax"+document.frm.stax.value)
 document.frm.totaltax.value=parseInt(document.frm.ntax.value)+parseInt(document.frm.stax.value)
 
 //alert("normal tax"+tax)
}
//}

//function frebate()
//{
//var a1
//a1="y"
//alert(document.frm.cat.value)
if(parseInt(document.frm.dedreb1.value)!=0)
{
//x=window.prompt("Are u in special category like sportsman,Author,Playwriter or musician(y/n)",a)
//b=prompt("Enter the amount for rebate")
if(document.frm.cat.value=="sp")
{ b=parseInt(parseInt(document.frm.dedreb1.value)*25/100)
  //alert(b)
  if(b>20000)
  document.frm.relief.value=20000
  else
  document.frm.relief.value=b
}
else
{
  b=parseInt(parseInt(document.frm.dedreb1.value)*20/100)
  if(b>16000)
  document.frm.relief.value=16000
  else
  document.frm.relief.value=b
}
b=parseInt(document.frm.relief.value)
if(b>parseInt(document.frm.totaltax.value))
  document.frm.relief.value=document.frm.totaltax.value
//alert("relief"+document.frm.relief.value)
}
//}

//function fnettax()


//{
//alert(document.frm.totaltax.value)
//alert(document.frm.relief.value)
nettax=parseInt(document.frm.totaltax.value)-parseInt(document.frm.relief.value)
//alert("nettax"+nettax)





if((parseInt(document.frm.totalincome.value)+parseInt(document.frm.netagri.value))>150000)
document.frm.surcharge1.value=parseInt((parseInt(nettax)*15)/100)
else
{
 if((parseInt(document.frm.totalincome.value)+parseInt(document.frm.netagri.value))>150000)
	document.frm.surcharge1.value=parseInt((parseInt(nettax)*10)/100)
}

//alert("surcharge"+document.frm.surcharge1.value)

nettax1=parseInt(nettax)+parseInt(document.frm.surcharge1.value)
//alert("nettax1"+nettax1)
//document.frm.relief1.focus()
//}


//function frelief1()
//{
var a
a=65
//x=window.prompt("Please enter your age",a)
if(parseInt(document.frm.age.value)>=65)
{
 if(parseInt(nettax1)>15000)
     document.frm.relief1.value =15000
 else    
     document.frm.relief1.value =nettax1
}
else
{
  if(document.frm.sex.value=="female")
  {
	if(parseInt(nettax1)>5000)
		document.frm.relief1.value =5000
	else    
		document.frm.relief1.value = nettax1
  }
  else
       document.frm.relief1.value =0

}
//alert("relief1"+relief1)
//}

//function fnettax2()
//{
nettax2=parseInt(nettax1)-parseInt(document.frm.relief1.value)
//alert("nettax2"+nettax)
//}
document.frm.nettaxpay.value=nettax2-parseInt(document.frm.tds.value)
//alert("nettaxpay"+document.frm.nettaxpay.value)
}
