function asset(mystr)
{
	if(mystr == 'A')
	{
		window.top.open("/planning_desk/assetallocater.php","_self")
	}
	if(mystr == 'I')
	{
		window.top.open("licplanner.php","_self")
	}
	if(mystr == 'P')
	{
		window.top.open("lifecalc1.php","_self")
	}
}


reportStr1="";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
reportStr1=reportStr1+"";
//reportStr1=reportStr1+"Your family current financial portrait does not demand that you buy an insurance policy You will achieve a better financial return if you invest in other financial assets<br>You require an insurance cover of <span  style=\"color:#ff6600;\"><b>Rs. ";
reportStr1=reportStr1+"You require an insurance cover of <span  style=\"color:#ff6600;\"><b>Rs. ";
reportStr2="";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"Your family's current financial portrait does not demand that you buy an insurance policy.";
reportStr2=reportStr2+"You will achieve a better financial return if you invest in other financial assets.";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
reportStr2=reportStr2+"";
/******************/
/*reportStr4="<table border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" height=\"1\">";
reportStr4=reportStr4 +" <tr><td width=\"1%\" bgcolor=\"#fb9c46\" height=\"1\" colspan=4><img src=\"/images/common/blank.gif\" width=\"1px\"></td>";
reportStr4=reportStr4 +"</tr><tr><td height=\"1%\" bgcolor=\"#fb9c46\" height=\"1\"><img src=\"/images/common/blank.gif\" height=\"1px\"></td>";
//reportStr4=reportStr4 + "	<td>&nbsp;</td><td class=rcls>Note:The Primary purpose of this planning tool is to introduce you to simple and easy concepts related to investing";
//reportStr4=reportStr4 + " in insurance policies.Please consult an insurance agent before you take any decisions.</font></td>";
//reportStr4=reportStr4 + "<td height=\"1%\" bgcolor=\"#fb9c46\" height=\"1\"><img src=\"/images/common/blank.gif\" height=\"1px\"></td>";
reportStr4=reportStr4 + "</tr><tr><td width=\"1%\" bgcolor=\"#fb9c46\" height=\"1\" colspan=4><img src=\"/images/common/blank.gif\" width=\"1px\"></td>";
reportStr4=reportStr4 + " </tr></table>";
/**********************/

reportStr4="";
//reportStr4=reportStr4 +"";
//reportStr4=reportStr4 +"";
//reportStr4=reportStr4 + "	<td>&nbsp;</td><td class=rcls>Note:The Primary purpose of this planning tool is to introduce you to simple and easy concepts related to investing";
//reportStr4=reportStr4 + " in insurance policies.Please consult an insurance agent before you take any decisions.</font></td>";
//reportStr4=reportStr4 + "<td height=\"1%\" bgcolor=\"#fb9c46\" height=\"1\"><img src=\"/images/common/blank.gif\" height=\"1px\"></td>";
//reportStr4=reportStr4 + "";
//reportStr4=reportStr4 + "";


reportStr2b="";
reportStr2b=reportStr2b+ "";
reportStr2b=reportStr2b+"";

reportstrdev1="";
reportstrdev2="";

reportStr3="";
//reportStr3=reportStr3+ "<a href='javascript:asset(\"I\")'>Insurance Planner</font></a></td></tr>";
//reportStr3=reportStr3+ "<tr><td width=\"1%\" height=\"21\" valign=top><img src=\"/images/insurance/dot_bl.gif\">&nbsp;</td><td width=\"99%\" height=\"21\" class=rcls><a href='javascript:asset(\"P\")'>Insurance Premium ";
//reportStr3=reportStr3+ "Calculator</font></a></td></tr></table>";


bkbtext="";	

function saveData()
{
	document.insureme.submit();
}

function getInsCal()
{
	E7=(document.insureme.txtInfExp.value*1); 
	E8=(document.insureme.txtNonInfExp.value*1); 
	E10=(document.insureme.txtPerExp.value*1);
	E12=(document.insureme.txtFamInc.value*1); 
	E16=(document.insureme.txtFamMonInc.value*1);

	//monthly values	

	E14=(document.insureme.txtFamSav.value*1);
	E21=(document.insureme.txtRetEst.value*0.01); 
	E24=(document.insureme.txtTaxRate.value*0.01); 
	E26=(document.insureme.txtAnuInf.value*0.01);

	tempInsCvr= ((E7-E12-E10)*12)/(E21*(1-E24)-E26)-E14+((E8-E16)*12)/(E21*(1-E24));
	tempInsCvr=Math.round(tempInsCvr/1000)*1000; 
	InsCvr=tempInsCvr;

	if(tempInsCvr>0)
	{	
		tempInsCvr=format(tempInsCvr,'currency');
		tempInsCvr=tempInsCvr+"";
		tempInsCvr=tempInsCvr+"";
		tempInsCvr=tempInsCvr+"";
		
		document.getElementById("ansdiv").innerHTML=reportStr1+tempInsCvr+"</p>"+reportstrdev1+reportStr3+"<br>"+reportStr4+"<br><br>";
		document.getElementById("bkbt").style.visibility='visible';
		document.getElementById("ansdiv").style.visibility='visible';
		document.getElementById("middleblock").style.visibility='hidden';
	}
	else
	{
		document.getElementById("ansdiv").innerHTML=reportStr2+reportStr2b+reportstrdev2+reportStr3+"<br>"+reportStr4+"<br><br>";
		document.getElementById("bkbt").style.visibility='visible';
		document.getElementById("ansdiv").style.visibility='visible';
		document.getElementById("middleblock").style.visibility='hidden';
	}
	window.scroll(0,0);
}

function getTotExp()
{
document.insureme.txtTotExp.value=(document.insureme.txtNonInfExp.value*1)
+(document.insureme.txtInfExp.value*1);
}

function getFamBdg()
{
	document.insureme.txtFamBdg.value=parseInt(document.insureme.txtTotExp.value*1)-parseInt(document.insureme.txtPerExp.value*1);
}

function getRetInv()
{
	document.insureme.txtRetInv.value=parseInt(document.insureme.txtFamBdg.value*1)-parseInt(document.insureme.txtFamInc.value*1);
}

function getRetEst()
{
	var retEst,rskTol,obj;
	obj=document.insureme.selRskTol.options;

	for(i=0;i<obj.length;i++)
	{
		if(obj[i].selected)
		{
			retEst=obj[i].value;
			break;			
		}
	}
	document.insureme.txtRetEst.value=retEst;
}

function getRskTol()
{
	var retEst;
	retEst=document.insureme.txtRetEst.value*1;
	
	obj=document.insureme.selRskTol.options;

	if(retEst<=obj[0].value)
	{
		obj[0].selected='true';
	}
	if(retEst>obj[0].value && retEst<=obj[1].value)
	{
		obj[1].selected='true';	
	}
	if(retEst>obj[1].value && retEst<=obj[2].value)
	{
		obj[2].selected='true';
	}
	if(retEst>obj[2].value)
	{
		obj[3].selected='true';
	}
}

function emptyInsCal()
{
	document.getElementById("ansdiv").innerHTML="";		
} 


function checkTaxRate()
{
	tempval=document.insureme.txtTaxRate.value;
	if(tempval>33)
	{
		document.insureme.txtTaxRate.value=33;
	}
	if(tempval<0)
	{
		document.insureme.txtTaxRate.value=0;
	}
}

function checkRetRate()
{
	if(document.insureme.txtRetEst.value>50)
	{
		if(!confirm("Are you sure about this rate?"))
		return;
	}
	if(document.insureme.txtRetEst.value>100)
	{
		document.insureme.txtRetEst.value=100;
	}
	if(document.insureme.txtRetEst.value<0)
	{
		document.insureme.txtRetEst.value=0;
	}
}

function checkInfRate()
{
	tempInfRate=document.insureme.txtAnuInf.value;
	tempRet=document.insureme.txtRetEst.value*1;
	tempTax=document.insureme.txtTaxRate.value*0.01;
//alert(tempInfRate);
//alert(tempRet);
//alert(tempTax);
	if(tempInfRate>=tempRet*(1-tempTax))
	{
		document.insureme.txtAnuInf.value=(tempRet*(1-tempTax))-0.5;
	}
	if(tempInfRate<0)
	{
		document.insureme.txtAnuInf.value=0;
	}
}

function getData()
{
	frmobj=document.insureme;
	//frmobj.txtInfExp.value=MonInfExp;
	frmobj.txtNonInfExp.value=MonNonInfExp;
	frmobj.txtPerExp.value=MonPerExp;
	frmobj.txtFamInc.value=MonFamInc;
	frmobj.txtFamSav.value=MonFamSav;
	frmobj.txtFamMonInc.value=MonFamFixInc;
	tempval=RiskTol*1;
	
	if(tempval<=22)
	{
		frmobj.selRskTol.options[0].selected=1;
	}
	
	if(tempval>22 && tempval<=29)
	{
		frmobj.selRskTol.options[1].selected=1;
	}
	if(tempval>29 && tempval<=38)
	{
		frmobj.selRskTol.options[2].selected=1;
	}
	if(tempval>38)
	{
		frmobj.selRskTol.options[3].selected=1;
	}
	
	frmobj.txtTaxRate.value=TaxRate;
}

function putData()
{
	frmobj=document.insureme;

	MonInfExp=frmobj.txtInfExp.value;
	MonNonInfExp=frmobj.txtNonInfExp.value;
	MonPerExp=frmobj.txtPerExp.value;
	MonFamInc=frmobj.txtFamInc.value;
	MonFamSav=frmobj.txtFamSav.value;

	MonFamFixInc=frmobj.txtFamMonInc.value;
	
	if(frmobj.selRskTol.options[0].selected)
	{tempval=22;}

	if(frmobj.selRskTol.options[1].selected)
	{tempval=29;}

	if(frmobj.selRskTol.options[2].selected)
	{tempval=38;}

	if(frmobj.selRskTol.options[3].selected)
	{tempval=45;}

	RiskTol=tempval;

	TaxRate=frmobj.txtTaxRate.value;
}