// JavaScript Document
// VisualCalc, Inc. copyright 2009
// www.visualcalc.com

// JS to invoke apps from VisualCalc server

/* 
Name:		vcjsappgen.js
Author:		Rieger
Orig Date:	7/17/2003
Purpose:	To be able to send customers who want a hosted solution simple lines of html with javascript to allow them to use VisualCalc calculators. The code and the text files and the help files reside on a VisualCalc server, allowing VisualCalc to make fixes on the fly. Calculators appear in pop-up JavaScript windows, sized correctly, with each pop-up window containing a help file link and a powered by gif and a copyright line/gif.

The html/javascript sent to a customer is 
<script language="JavaScript" src="http://www.visualcalc.com/js/vcjsappgen.js" type="text/javascript">
</script>
<a href='javascript:getCalc("home2");'> Mortgage Calculator</a>

Functions:
getCalc(calcspec) takes the name of the calculator (calcspec resolves to, e.g., home2) and furnishes input to variables that are written out as parm values in an applet tag using the function
putInfo(calctxt,winwid,winhi,auxname,jarname,titlename,appwid,apphi,helphtml)  

The variables are self explanatory: 
calctxt is the template txt file that defines the calculator
winwid is the width of the host window that is created to contain the calculator
winhi is the height of the host window that is created to contain the calculator
auxname is the name of the auxiliary jar file
jarname is the name of the application-specific jar file
titlename is the title that is put into the browser title bar
appwid is the width of the application itself
apphi is the height of the application itself
helphtml is the name of the html help file for the specific app
vcjar is the name of the VisualCalc.jar file - we use different names, depending upon version

	

*/

	function getCalc(calcspec) {
	switch(calcspec)
	{
	// Home Suite
		case "home2":
			putInfo("homeloan2.txt",700,470,"VCAux2.jar","mortgage.jar","VisualCalc Mortgage Calculator",650,350,"hlp_home2.html","VisualCalc.jar");
			break;
		
		case "rentbuy":
			putInfo("rentbuy.txt",700,620,"VCAux2.jar","rentbuy.jar","VisualCalc Rent or Buy Calculator",650,500,"hlp_rentbuy.html","VisualCalc.jar");
			break;
			
		case "refinance":
			putInfo("refinance.txt",650,670,"VCAux1.jar","refinance.jar","VisualCalc Refinance Calculator",600,550,"hlp_refinance.html","VisualCalc.jar");
			break;
			
		case "biweekly":
			putInfo("biweekly.txt",650,470,"VCAux2.jar","biweekly.jar","VisualCalc Biweekly Mortgage Calculator",600,350,"hlp_biweekly.html","VisualCalc.jar");
			break;
			
		case "mortgpts":
			putInfo("mortgpts.txt",650,645,"VCAux1.jar","mortgpts.jar","VisualCalc Mortgage Points Calculator",600,525,"hlp_mortgpts.html","VisualCalc.jar");
			break;
			
		case "affordability":
			putInfo("affordability.txt",650,470,"VCAux2.jar","affordability.jar","VisualCalc Mortgage Affordability Calculator",600,350,"hlp_aff.html","VisualCalc.jar");
			break;
			
		case "adj2wide":
			putInfo("adj2wide.txt",650,620,"VCAux2.jar","adj2.jar","VisualCalc Fixed vs. Adjustable Calculator",600,500,"hlp_adj2.html","VisualCalc.jar");
			break;
			
		case "downpmtcomp":
			putInfo("downpmtcomp.txt",650,620,"VCAux2.jar","downpmtcomp.jar","VisualCalc Down Payment Calculator",600,500,"hlp_downpmtcomp.html","VisualCalc.jar");
			break;
			
		case "homeequity":
			putInfo("homeequity.txt",700,770,"VCAux2.jar","homeequity.jar","VisualCalc Home Equity Calculator",650,650,"hlp_homeequity.html","VisualCalc.jar");
			break;

		case "homeequity2":
			putInfo("homeequity2.txt",765,835,"VCAux2.jar","homeequity2.jar","VisualCalc Home Equity2 Calculator",715,715,"hlp_homeequity2.html","VisualCalc.jar");
			break;
			
		case "realestroi":
			putInfo("realestroi.txt",550,620,"VCAux1.jar","realestroi.jar","VisualCalc Home Real Estate ROI Calculator",500,500,"hlp_realestroi.html","VisualCalc.jar");
			break;

		case "commission":
			putInfo("commission.txt",550,620,"VCAux1.jar","commission.jar","VisualCalc Real Estate Commission Calculator",500,500,"hlp_commission.html","VisualCalc.jar");
			break;
			
		// Auto Suite
		
		case "auto2":
			putInfo("autoloan2.txt",650,470,"VCAux2.jar","mortgage.jar","VisualCalc Auto Loan Calculator",600,350,"hlp_auto2.html","VisualCalc.jar");
			break;

		case "autobw":
			putInfo("autobw.txt",650,470,"VCAux2.jar","biweekly.jar","VisualCalc Biweekly Auto Loan Calculator",600,350,"hlp_biweekly.html","VisualCalc.jar");
			break;

		case "leaseloan":
			putInfo("leaseloan.txt",650,670,"VCAux2.jar","leaseloan.jar","VisualCalc Lease or Buy Calculator",600,550,"hlp_leaseloan.html","VisualCalc.jar");
			break;

		case "raterebate":
			putInfo("raterebate.txt",550,620,"VCAux2.jar","raterebate.jar","VisualCalc Rate vs. Rebate Calculator",500,500,"hlp_raterebate.html","VisualCalc.jar");
			break;

		case "creditcard":
			putInfo("creditcard.txt",650,665,"VCAux2.jar","creditcard.jar","VisualCalc Credit Card Calculator",600,545,"hlp_creditcard.html","VisualCalc.jar");
			break;

		// Savings Suite
		
		case "savings":
			putInfo("savings.txt",650,570,"VCAux2.jar","savings.jar","VisualCalc Saving for a Goal Calculator",600,450,"hlp_savings.html","VisualCalc.jar");
			break;

		case "college":
			putInfo("college.txt",650,520,"VCAux2.jar","college.jar","VisualCalc College Planner Calculator",600,400,"hlp_college.html","VisualCalc.jar");
			break;

		case "lease":
			putInfo("lease.txt",450,620,"VCAux1.jar","lease.jar","VisualCalc Lease Analysis Calculator",400,500,"hlp_lease.html","VisualCalc.jar");
			break;

		case "annuity":
			putInfo("annuity.txt",650,670,"VCAux3.jar","annuity.jar","VisualCalc Annuity  Calculator",600,550,"hlp_annuity.html","VisualCalc.jar");
			break;

		case "cdladder":
			putInfo("cdladder.txt",575,840,"VCAux2.jar","ladder.jar","VisualCalc CD Laddering Calculator",525,750,"hlp_cdladder.html","VisualCalc.jar");
			break;

		case "blendrate":
			putInfo("blendrate.txt",650,470,"VCAux2.jar","blendrate.jar","VisualCalc Blended Rate Calculator",600,350,"hlp_blendrate.html","VisualCalc.jar");
			break;

		case "hsacontrib":
			putInfo("hsacontrib.txt",500,670,"VCAux2.jar","hsacontrib.jar","VisualCalc Health Savings Account Calculator",450,550,"hlp_hsacontrib.html","VisualCalc.jar");
			break;
			
		case "hsavalue":
			putInfo("hsavalue.txt",500,790,"VCAux2.jar","hsavalue.jar","VisualCalc Health Savings Account Future Value Calculator",450,670,"hlp_hsavalue.html","VisualCalc.jar")
			break;
			

		// Retirement Suite
		
		case "withold":
			putInfo("withold.txt",700,520,"VCAux2.jar","withold.jar","VisualCalc Income Witholding Calculator",650,400,"hlp_withold.html","VisualCalc.jar");
			break;

		case "retire":
			putInfo("retire.txt",550,620,"VCAux1.jar","retire.jar","VisualCalc Retirement Planner Calculator",500,500,"hlp_retire.html","VisualCalc.jar");
			break;
	
		case "rdist":
			putInfo("rdist.txt",600,470,"VCAux1.jar","rdist.jar","VisualCalc Retirement Distribution Calculator",550,350,"hlp_rdist.html","VisualCalc.jar");
			break;
	
		case "nestegg":
			putInfo("nestegg.txt",500,645,"VCAux1.jar","nestegg.jar","VisualCalc Nest Egg Calculator",450,525,"hlp_nestegg.html","VisualCalc.jar");
			break;
	
		case "taxdefc":
			putInfo("taxdefc.txt",475,620,"VCAux1.jar","taxdefc.jar","VisualCalc Tax-Deferred Savings Comparison Calculator",425,500,"hlp_taxdefc.html","VisualCalc.jar");
			break;

		case "iracomp":
			putInfo("iracomp.txt",450,620,"VCAux1.jar","iracomp.jar","VisualCalc IRA Comparison Calculator",400,500,"hlp_iracomp.html","VisualCalc.jar");
			break;
	
		case "iraconv":
			putInfo("iraconv.txt",450,620,"VCAux1.jar","iraconv.jar","VisualCalc ROTH IRA Conversion Calculator",400,500,"hlp_iraconv.html","VisualCalc.jar");
			break;

		// Income & Insurance Suite
		
		case "estatetax":
			putInfo("estatetax.txt",550,720,"VCAux2.jar","stdestatetax.jar","VisualCalc Estate Tax Calculator",500,600,"hlp_estatetax.html","VisualCalc.jar");
			break;
	
		case "incomegrowth":
			putInfo("incomegrowth.txt",550,620,"VCAux2.jar","incomegrowth.jar","VisualCalc Income Growth Calculator",500,500,"hlp_incomegrowth.html","VisualCalc.jar");
			break;
	
		case "raisingchildren":
			putInfo("raisingchildren.txt",550,720,"VCAux2.jar","stdraisingchildren.jar","VisualCalc Cost of Raising Children Calculator",500,600,"hlp_raisingchildren.html","VisualCalc.jar");
			break;
				
		case "cashflow":
			putInfo("cashflow.txt",575,645,"VCAux2.jar","stdcashflow.jar","VisualCalc Cash Flow Calculator",525,525,"hlp_cashflow.html","VisualCalc.jar");
			break;			
				
		case "networth":
			putInfo("networth.txt",550,670,"VCAux2.jar","stdnetworth.jar","VisualCalc Net Worth Calculator",500,550,"hlp_networth.html","VisualCalc.jar");
			break;
				
		case "insurlife":
			putInfo("insurlife.txt",650,670,"VCAux2.jar","stdinsurance.jar","VisualCalc Life Insurance Calculator",600,550,"hlp_insurlife.html","VisualCalc.jar");
			break;
				
		case "insurdisability":
			putInfo("insurdisability.txt",650,670,"VCAux2.jar","stdinsurance.jar","VisualCalc Disability Insurance Calculator",600,550,"hlp_insurdisability.html","VisualCalc.jar");
			break;
				
		case "lifeexp":
			putInfo("lifeexp.txt",500,420,"VCAux2.jar","lifeexp.jar","VisualCalc Life Expectancy Calculator",450,300,"hlp_lifeexp.html","VisualCalc.jar");
			break;

		// Business Analyzers
		
		case "breakeven":
			putInfo("breakeven.txt",600,470,"VCAux1.jar","breakeven.jar","VisualCalc Break Even Analysis Calculator",550,350,"hlp_breakeven.html","VisualCalc.jar");
			break;
			
		// Synergex ROI
		
		case "synergexroi":
			putInfo("synergexroi.txt",690,620,"VCAux2_synergex.jar","SynergexROI.jar","VisualCalc Synergex VisualSmart ROI Tool",640,500,"blank.html","VisualCalc_synergex.jar");
			break;
			
		// Special Apps
		
		case "autoloaninscu":
			putInfo("autoloaninscu.txt",650,470,"VCAux2.jar","mortgageins.jar","VisualCalc Auto Loan with Insurance Calculator",600,350,"hlp_autoloanins.html","VisualCalc.jar");
			break;

		// Custom Hosted Apps
		
		case "ccbbyol":
			putInfo("ccbbyol.txt",575,870,"VCAux2_byol.jar","custombyol.jar","VisualCalc Build Your Own CD Ladder Calculator",525,750,"hlp_byol.html","VisualCalc_byol.jar");
			break;


		default:
		alert("Try another calculator");
	} 
	}

// the putInfo function is used by the getCalc function, above. It populates variables with real data
	function putInfo(calctxt,winwid,winhi,auxname,jarname,titlename,appwid,apphi,helphtml,vcjar){
		//closechild ();
		//open a smallwindow with the size and specs provided
		smallwindow = window.open ( "calc.html", "smallwindow", "toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes" );
		smallwindow.opener = this;
		window.calctxt = calctxt;
		window.winwid = winwid;
		window.winhi = winhi;
		window.auxname = auxname;
		window.jarname = jarname;
		window.titlename = titlename;
		window.appwid = appwid;
		window.apphi = apphi;
		window.helphtml = helphtml;
		window.vcjar = vcjar;

		smallwindow.resizeTo ( winwid+5,winhi+35 );
		smallwindow.focus();  // bring smallwindow to the front
	 }

// the closechild function closes a window without complaining about JavaScript not having opened the window.
	function closechild () {
		if ( window.smallwindow && !smallwindow.closed )
			smallwindow.close ();
	}

	function writecontent () {
		document.open(); // open a document in the smallwindow and stuff it full of html and applet tag
		document.write ( '<head>\n <title>\n'+window.opener.titlename+'</title>\n</head>\n<body>\n' );
		document.write ( '<table cellspacing="0" cellpadding="0" border="0" align="center">\n<tr>\n<td colspan="3" valign="middle">\n ' );
		document.write ( '<applet name="vcapp" code="vc.VisualCalc.class" codebase="http://www.visualcalc.com/vcclient" archive="' + window.opener.vcjar + ',' + window.opener.auxname + ',' + window.opener.jarname + '"' + ' width=' + window.opener.appwid + ' height=' + window.opener.apphi + '>\n' );
		document.write ( '<param name="copyrite" value="Copyright 1996-2009, VisualCalc, Inc. All rights reserved.">' );
		document.write ( '<param name="initstr" value="http://www.visualcalc.com/products/' + window.opener.calctxt + '">' );
		document.write ( '<param name="imgloc" value="http://www.visualcalc.com/images">' );
		document.write ( '<param name="vcpfn" value="http://www.visualcalc.com/vcclient/vcp.vcp">' );  
		document.write ( '<h2>VisualCalc applications require that your browser be Java-enabled. This VisualCalc application will not run because Java is NOT enabled in your browser. Please enable Java in your browser. If you do not know how to enable Java in your browser, please contact your system administrator. To download and install a Java Virtual Machine so Java applications can run on your computer, go to <a href="http://www.visualcalc.com/jvmsunredirect/jvmsunredirect.html">Sun Microsystems</a>.</h2>\n' );    
		document.write ( '</applet>\n' );
		document.write ( '</td>\n</tr>\n<tr>\n<td width="40%">\n' );
		writehelp ();
		document.write ( '</td>\n<td width="15%">\n' );
		printit ();
		document.write ( '</td>\n<td align="right" width="45%">\n' );
		writecopyright ();
		document.write ( '</td>\n</tr>\n</table>\n</body>\n' );
		document.close();
	}

// the writehead function writes out the variable calc title name - used by calc.html	
	function writehead () {	
		document.open(); // open a document in the smallwindow and stuff it full of html and applet tag
		document.write ( '<head><title>'+window.opener.titlename+'</title></head>' );
		document.close();
}	

// the closehelp function closes the help window 
	function closehelp () {
		help = window.open ("calc.html", "help", "toolbar=no, location=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=600, height=700");
		help.opener = this;	
		if ( window.help && !help.closed )
			help.close ();
	}

// the writehelp function writes out the variable calc help file - used by calc.html	
	function writehelp () {
		//closehelp ();
		document.open ();
		document.write   ( '<a href="http://www.visualcalc.com/help/' + window.opener.helphtml + '" target="help" onclick="window.open(\'http://www.visualcalc.com/help/' + window.opener.helphtml +'\', \'help\', \'toolbar=no, location=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=600, height=700\'); return false;"><span style="font-weight:900;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:8pt;">Help for this calculator</span></a>\n' );  
		document.close (); 
		//help.focus;	
	}


function printit () {
	document.open();
	document.write('<button type="button" style="width:40px;height:15pt;font-size:8pt;" onClick="window.print ();"><span style="font-family:Arial,Helvetica,Verdana,sans-serif;font-size:8pt;" >Print</span></button>');
	document.close();//-->
}	


function writecopyright () {
	document.open();
	document.write('<a href="http://www.visualcalc.com/" target="_blank"><img src="http://www.visualcalc.com/images/vcpower.gif" width="173" height="30" border="0"></a><br><span style="font-weight:900;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:8pt;">Copyright&copy; 2010, VisualCalc, Inc.</span>');
	document.close();//-->
}	


	function preconfig_getCalc(calcspec) {
	switch(calcspec)
	{
	// Home Suite
		case "home2":
			preconfig_putInfo("preconfig_calc/calc_home2.htm","homeloan2.txt",700,470,"VCAux2.jar","mortgage.jar","VisualCalc Mortgage Calculator",650,350,"hlp_home2.html","VisualCalc.jar");
			break;
		
		case "rentbuy":
			preconfig_putInfo("preconfig_calc/calc_rentbuy.htm","rentbuy.txt",700,620,"VCAux2.jar","rentbuy.jar","VisualCalc Rent or Buy Calculator",650,500,"hlp_rentbuy.html","VisualCalc.jar");
			break;
			
		case "refinance":
			preconfig_putInfo("preconfig_calc/calc_refinance.htm","refinance.txt",650,670,"VCAux1.jar","refinance.jar","VisualCalc Refinance Calculator",600,550,"hlp_refinance.html","VisualCalc.jar");
			break;
			
		case "biweekly":
			preconfig_putInfo("preconfig_calc/calc_biweekly.htm","biweekly.txt",650,470,"VCAux2.jar","biweekly.jar","VisualCalc Biweekly Mortgage Calculator",600,350,"hlp_biweekly.html","VisualCalc.jar");
			break;
			
		case "mortgpts":
			preconfig_putInfo("preconfig_calc/calc_mortgpts.htm","mortgpts.txt",650,645,"VCAux1.jar","mortgpts.jar","VisualCalc Mortgage Points Calculator",600,525,"hlp_mortgpts.html","VisualCalc.jar");
			break;
			
		case "affordability":
			preconfig_putInfo("preconfig_calc/calc_affordability.htm","affordability.txt",650,470,"VCAux2.jar","affordability.jar","VisualCalc Mortgage Affordability Calculator",600,350,"hlp_aff.html","VisualCalc.jar");
			break;
			
		case "adj2wide":
			preconfig_putInfo("preconfig_calc/calc_adj2wide.htm","adj2wide.txt",650,620,"VCAux2.jar","adj2.jar","VisualCalc Fixed vs. Adjustable Calculator",600,500,"hlp_adj2.html","VisualCalc.jar");
			break;
			
		case "downpmtcomp":
			preconfig_putInfo("preconfig_calc/calc_downpmtcomp.htm","downpmtcomp.txt",650,620,"VCAux2.jar","downpmtcomp.jar","VisualCalc Down Payment Calculator",600,500,"hlp_downpmtcomp.html","VisualCalc.jar");
			break;
			
		case "homeequity":
			preconfig_putInfo("preconfig_calc/calc_homeequity.htm","homeequity.txt",700,770,"VCAux2.jar","homeequity.jar","VisualCalc Home Equity Calculator",650,650,"hlp_homeequity.html","VisualCalc.jar");
			break;

		case "homeequity2":
			preconfig_putInfo("preconfig_calc/calc_homeequity2.htm","homeequity2.txt",765,835,"VCAux2.jar","homeequity2.jar","VisualCalc Home Equity2 Calculator",715,715,"hlp_homeequity2.html","VisualCalc.jar");
			break;
			
		case "realestroi":
			preconfig_putInfo("preconfig_calc/calc_realestroi.htm","realestroi.txt",550,620,"VCAux1.jar","realestroi.jar","VisualCalc Home Real Estate ROI Calculator",500,500,"hlp_realestroi.html","VisualCalc.jar");
			break;

		case "commission":
			preconfig_putInfo("preconfig_calc/calc_commission.htm","commission.txt",550,620,"VCAux1.jar","commission.jar","VisualCalc Real Estate Commission Calculator",500,500,"hlp_commission.html","VisualCalc.jar");
			break;	
			
		// Auto Suite
		
		case "auto2":
			preconfig_putInfo("preconfig_calc/calc_auto2.htm","autoloan2.txt",650,470,"VCAux2.jar","mortgage.jar","VisualCalc Auto Loan Calculator",600,350,"hlp_auto2.html","VisualCalc.jar");
			break;

		case "autobw":
			preconfig_putInfo("preconfig_calc/calc_autobw.htm","autobw.txt",650,470,"VCAux2.jar","biweekly.jar","VisualCalc Biweekly Auto Loan Calculator",600,350,"hlp_biweekly.html","VisualCalc.jar");
			break;

		case "leaseloan":
			preconfig_putInfo("preconfig_calc/calc_leaseloan.htm","leaseloan.txt",650,670,"VCAux2.jar","leaseloan.jar","VisualCalc Lease or Buy Calculator",600,550,"hlp_leaseloan.html","VisualCalc.jar");
			break;

		case "raterebate":
			preconfig_putInfo("preconfig_calc/calc_raterebate.htm","raterebate.txt",550,620,"VCAux2.jar","raterebate.jar","VisualCalc Rate vs. Rebate Calculator",500,500,"hlp_raterebate.html","VisualCalc.jar");
			break;
			
		case "creditcard":
			preconfig_putInfo("preconfig_calc/calc_creditcard.htm","creditcard.txt",650,665,"VCAux2.jar","creditcard.jar","VisualCalc Credit Card Calculator",600,545,"hlp_creditcard.html","VisualCalc.jar");
			break;
			

		// Savings Suite
		
		case "savings":
			preconfig_putInfo("preconfig_calc/calc_savings.htm","savings.txt",650,570,"VCAux2.jar","savings.jar","VisualCalc Saving for a Goal Calculator",600,450,"hlp_savings.html","VisualCalc.jar");
			break;

		case "college":
			preconfig_putInfo("preconfig_calc/calc_college.htm","college.txt",650,520,"VCAux2.jar","college.jar","VisualCalc College Planner Calculator",600,400,"hlp_college.html","VisualCalc.jar");
			break;

		case "lease":
			preconfig_putInfo("preconfig_calc/calc_lease.htm","lease.txt",450,620,"VCAux1.jar","lease.jar","VisualCalc Lease Analysis Calculator",400,500,"hlp_lease.html","VisualCalc.jar");
			break;

		case "annuity":
			preconfig_putInfo("preconfig_calc/calc_annuity.htm","annuity.txt",650,670,"VCAux3.jar","annuity.jar","VisualCalc Annuity  Calculator",600,550,"hlp_annuity.html","VisualCalc.jar");
			break;

		case "cdladder":
			preconfig_putInfo("preconfig_calc/calc_cdladder.htm","cdladder.txt",575,840,"VCAux2.jar","ladder.jar","VisualCalc CD Laddering Calculator",525,750,"hlp_cdladder.html","VisualCalc.jar");
			break;

		case "blendrate":
			preconfig_putInfo("preconfig_calc/calc_blendrate.htm","blendrate.txt",650,470,"VCAux2.jar","blendrate.jar","VisualCalc Blended Rate Calculator",600,350,"hlp_blendrate.html","VisualCalc.jar");
			break;

		// Retirement Suite
		
		case "withold":
			preconfig_putInfo("preconfig_calc/calc_withold.htm","withold.txt",700,520,"VCAux2.jar","withold.jar","VisualCalc Income Witholding Calculator",650,400,"hlp_withold.html","VisualCalc.jar");
			break;

		case "retire":
			preconfig_putInfo("preconfig_calc/calc_retire.htm","retire.txt",550,620,"VCAux1.jar","retire.jar","VisualCalc Retirement Planner Calculator",500,500,"hlp_retire.html","VisualCalc.jar");
			break;
	
		case "rdist":
			preconfig_putInfo("preconfig_calc/calc_rdist.htm","rdist.txt",600,470,"VCAux1.jar","rdist.jar","VisualCalc Retirement Distribution Calculator",550,350,"hlp_rdist.html","VisualCalc.jar");
			break;
	
		case "nestegg":
			preconfig_putInfo("preconfig_calc/calc_nestegg.htm","nestegg.txt",500,645,"VCAux1.jar","nestegg.jar","VisualCalc Nest Egg Calculator",450,525,"hlp_nestegg.html","VisualCalc.jar");
			break;
	
		case "taxdefc":
			preconfig_putInfo("preconfig_calc/calc_taxdefc.htm","taxdefc.txt",475,620,"VCAux1.jar","taxdefc.jar","VisualCalc Tax-Deferred Savings Comparison Calculator",425,500,"hlp_taxdefc.html","VisualCalc.jar");
			break;

		case "iracomp":
			preconfig_putInfo("preconfig_calc/calc_iracomp.htm","iracomp.txt",450,620,"VCAux1.jar","iracomp.jar","VisualCalc IRA Comparison Calculator",400,500,"hlp_iracomp.html","VisualCalc.jar");
			break;
	
		case "iraconv":
			preconfig_putInfo("preconfig_calc/calc_iraconv.htm","iraconv.txt",450,620,"VCAux1.jar","iraconv.jar","VisualCalc ROTH IRA Conversion Calculator",400,500,"hlp_iraconv.html","VisualCalc.jar");
			break;

		// Income & Insurance Suite
		
		case "estatetax":
			preconfig_putInfo("preconfig_calc/calc_estatetax.htm","estatetax.txt",550,720,"VCAux2.jar","stdestatetax.jar","VisualCalc Estate Tax Calculator",500,600,"hlp_estatetax.html","VisualCalc.jar");
			break;
	
		case "incomegrowth":
			preconfig_putInfo("preconfig_calc/calc_incomegrowth.htm","incomegrowth.txt",550,620,"VCAux2.jar","incomegrowth.jar","VisualCalc Income Growth Calculator",500,500,"hlp_incomegrowth.html","VisualCalc.jar");
			break;
	
		case "raisingchildren":
			preconfig_putInfo("preconfig_calc/calc_raisingchildren.htm","raisingchildren.txt",550,720,"VCAux2.jar","stdraisingchildren.jar","VisualCalc Cost of Raising Children Calculator",500,600,"hlp_raisingchildren.html","VisualCalc.jar");
			break;
				
		case "cashflow":
			preconfig_putInfo("preconfig_calc/calc_cashflow.htm","cashflow.txt",575,645,"VCAux2.jar","stdcashflow.jar","VisualCalc Cash Flow Calculator",525,525,"hlp_cashflow.html","VisualCalc.jar");
			break;			
				
		case "networth":
			preconfig_putInfo("preconfig_calc/calc_networth.htm","networth.txt",550,670,"VCAux2.jar","stdnetworth.jar","VisualCalc Net Worth Calculator",500,550,"hlp_networth.html","VisualCalc.jar");
			break;
				
		case "insurlife":
			preconfig_putInfo("preconfig_calc/calc_insurlife.htm","insurlife.txt",650,670,"VCAux2.jar","stdinsurance.jar","VisualCalc Life Insurance Calculator",600,550,"hlp_insurlife.html","VisualCalc.jar");
			break;
				
		case "insurdisability":
			preconfig_putInfo("preconfig_calc/calc_insurdisability.htm","insurdisability.txt",650,670,"VCAux2.jar","stdinsurance.jar","VisualCalc Disability Insurance Calculator",600,550,"hlp_insurdisability.html","VisualCalc.jar");
			break;
				
		case "lifeexp":
			preconfig_putInfo("preconfig_calc/calc_lifeexp.htm","lifeexp.txt",500,420,"VCAux2.jar","lifeexp.jar","VisualCalc Life Expectancy Calculator",450,300,"hlp_lifeexp.html","VisualCalc.jar");
			break;

		case "hsacontrib":
			preconfig_putInfo("preconfig_calc/calc_hsacontrib.htm","hsacontrib.txt",500,670,"VCAux2.jar","hsacontrib.jar","VisualCalc Health Savings Account Calculator",450,550,"hlp_hsacontrib.html","VisualCalc.jar");
			break;
			
		case "hsavalue":
			preconfig_putInfo("preconfig_calc/calc_hsavalue.htm","hsavalue.txt",500,790,"VCAux2.jar","hsavalue.jar","VisualCalc Health Savings Account Future Value Calculator",450,670,"hlp_hsavalue.html","VisualCalc.jar")
			break;

		// Business Analyzers
		
		case "breakeven":
			preconfig_putInfo("preconfig_calc/calc_breakeven.htm","breakeven.txt",600,470,"VCAux1.jar","breakeven.jar","VisualCalc Break Even Analysis Calculator",550,350,"hlp_breakeven.html","VisualCalc.jar");
			break;
			
		// Synergex ROI
		
		case "synergexroi":
			preconfig_putInfo("preconfig_calc/calc_synergexroi.htm","synergexroi.txt",690,620,"VCAux2_synergex.jar","SynergexROI.jar","VisualCalc Synergex VisualSmart ROI Tool",640,500,"blank.html","VisualCalc_synergex.jar");
			break;
			
		// Special Apps
		
		case "autoloaninscu":
			preconfig_putInfo("preconfig_calc/calc_autoloaninscu.htm","autoloaninscu.txt",650,470,"VCAux2.jar","mortgageins.jar","VisualCalc Auto Loan with Insurance Calculator",600,350,"hlp_autoloanins.html","VisualCalc.jar");
			break;

		default:
		alert("Try another calculator");
	} 
	}

// the putInfo function is used by the getCalc function, above. It populates variables with real data
	function preconfig_putInfo(htmlframe, calctxt,winwid,winhi,auxname,jarname,titlename,appwid,apphi,helphtml,vcjar){
		//closechild ();
		//open a smallwindow with the size and specs provided
		smallwindow = window.open ( htmlframe, "smallwindow", "toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes" );
		smallwindow.opener = this;
		window.calctxt = calctxt;
		window.winwid = winwid;
		window.winhi = winhi;
		window.auxname = auxname;
		window.jarname = jarname;
		window.titlename = titlename;
                //if (parseInt(appwid) > 545) { // cap so it fits in calculator frame
                 // appwid = "545";
                //}
		window.appwid = appwid;
		window.apphi = apphi;
		window.helphtml = helphtml;
		window.vcjar = vcjar;
                var newwinhi = winhi+180;
                if (winwid < 605) {
                  winwid = 605; // do not want the window to be too small
                }
                var newwinwid = winwid+210;
		smallwindow.resizeTo ( newwinwid,newwinhi );
		smallwindow.focus();  // bring smallwindow to the front

	 }

// the writehelp function writes out the variable calc help file - used by calc.html	
	function preconfig_writehelp () {
                function openHelpWin() {
                }
		//closehelp ();
		document.open ();
		document.write   ( '<button type="button" style="width:40px;height:15pt;font-size:8pt;" onclick="window.open(\'http://www.visualcalc.com/help/' + window.opener.helphtml +'\', \'help\', \'toolbar=no, location=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=600, height=700\'); return false;"><span style="font-family:Arial,Helvetica,Verdana,sans-serif;font-size:8pt;" >Help</span></button>' );  
		document.close (); 
		//help.focus;	
	}

	// for preconfigured calculators
	function preconfig_writecontent () {
		document.write ( '<table cellspacing="0" cellpadding="0" border="0" align="center">\n<tr>\n<td colspan="3" valign="middle">\n ' );
		document.write ( '<applet name="vcapp" code="vc.VisualCalc.class" codebase="http://www.visualcalc.com/vcclient" archive="' + window.opener.vcjar + ',' + window.opener.auxname + ',' + window.opener.jarname + '"' + ' width=' + window.opener.appwid + ' height=' + window.opener.apphi + '>\n' );
		document.write ( '<param name="copyrite" value="Copyright 1996-2009, VisualCalc, Inc. All rights reserved.">' );
		document.write ( '<param name="initstr" value="http://www.visualcalc.com/products/' + window.opener.calctxt + '">' );
		document.write ( '<param name="imgloc" value="http://www.visualcalc.com/images">' );
		document.write ( '<param name="vcpfn" value="http://www.visualcalc.com/vcclient/vcp.vcp">' );  
		document.write ( '<h2>VisualCalc applications require that your browser be Java-enabled. This VisualCalc application will not run because Java is NOT enabled in your browser. Please enable Java in your browser. If you do not know how to enable Java in your browser, please contact your system administrator. To download and install a Java Virtual Machine so Java applications can run on your computer, go to <a href="http://www.visualcalc.com/jvmsunredirect/jvmsunredirect.html">Sun Microsystems</a>.</h2>\n' );    
		document.write ( '</applet>\n' );
		document.write ( '</td>\n</tr>\n<tr>\n<td width="55%">\n' );
		preconfig_writehelp ();
                document.write ('&nbsp; ');
		printit ();
                document.write ('&nbsp; ');
                document.write   ( '<button type="button" style="width:40px;height:15pt;font-size:8pt;" onclick="window.close();"><span style="font-family:Arial,Helvetica,Verdana,sans-serif;font-size:8pt;" >Close</span></button>' );  
		document.write ( '</td>\n<td align="right" width="45%">\n' );
		writecopyright ();
		document.write ( '</td>\n</tr>\n</table>\n' );
	}



