// JavaScript Document
function em()
{
	P=form.text_1.value;
	G=form.text_2.value;
	T=form.text_3.value;
	C=form.text_4.value;
	
	     if(form.text_1.value.length=="")
		 {
		    window.alert("Cost of Petro/Litre");
			form.text_1.focus() 
		 }
		 else
		 if(form.text_2.value.length=="")
		 {
			window.alert("Cost of LPG/Litre");
			form.text_2.focus()  
		 }
		 else
		 if(form.text_3.value.length=="")
		 {
			window.alert("Current Weekly Spend");
			form.text_3.focus() 
		 }
		 else
		 if(form.text_4.value.length=="")
		 {
			window.alert("Conversion fee");
			form.text_4.focus() 
		 }
		 else
	     {	
	  S=(P-G)
	  S2=(S/P)*100
	  TOT1=(S2*T)/100
	  TOT2=Math.round(TOT1)
	  TOT3=Math.round(TOT1*4)
	  TOT4=Math.round(TOT1*4*12)
	  
	  
	  config='toolbar=no,location=no,directories=no,status=no,menubar=no,width=600,height=300'
      config += 'scrollbars=no,resizable=no'
      pop = window.open ("","pop",config)
     //pop=window.open("","displayWindow","menubar=NO",'width=300,height=400')
	 //pop.document.write("<HTML>")
	 //pop.document.write('setTimeout(');
     //pop.document.write('"self.close()');
     //pop.document.write(';",99000)');
     pop.document.write("<HEAD><TITLE>Savings Calculator</TITLE></HEAD>")
	 pop.document.write("<BODY>")
	 pop.document.write("<table width=435 border=0 align=center cellpadding=0 cellspacing=0>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Based on: Cost of petrol/Litre : Rs ")+pop.document.write(P)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Cost of LPG/Litre : Rs ")+pop.document.write(G)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Current Weekly Spend : Rs ")+pop.document.write(T)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td>&nbsp;</td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Weekly Savings : Rs ")+pop.document.write(TOT2)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Monthly Savings : Rs ")+pop.document.write(TOT3)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Annual Savings : Rs ")+pop.document.write(TOT4)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td>&nbsp;</td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
	 MT=TOT2*4
	 M=C/MT
	 M1=Math.round(M)
     pop.document.write("<td><div align=center>Conversion fee : Rs ")+pop.document.write(C)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("<tr>")
     pop.document.write("<td><div align=center>Months of cover Your Conversion free : ")+pop.document.write(M1)+pop.document.write("</div></td>")
     pop.document.write("</tr>")
     pop.document.write("</table>")
	 
	 form.text_1.value="";
	 form.text_2.value="";
	 form.text_3.value="";
	 form.text_4.value="";
	}
	//setTimeout(self.close(), 99000)
	
}
