function ich_loadValues()
{
	var parameters = ich_TermDeposit.getParameters();
	var pArray = parameters.split("&&");
	
	ich_MainForm.ich_vClientName.value = pArray[0];
	ich_MainForm.ich_vClientNum.value = pArray[1];
	ich_MainForm.ich_vCalc.value = pArray[2];
	ich_MainForm.ich_vDate.value = pArray[3];
	ich_MainForm.ich_vAmount.value = pArray[4];
	ich_MainForm.ich_vRate.value = pArray[5];
	ich_MainForm.ich_vTerm.value = pArray[6];
	ich_MainForm.ich_vInterestResult.value = pArray[7];
	

	ich_FriendForm.ich_vCalc.value = pArray[2];
	ich_FriendForm.ich_vDate.value = pArray[3];
	ich_FriendForm.ich_vAmount.value = pArray[4];
	ich_FriendForm.ich_vRate.value = pArray[5];
	ich_FriendForm.ich_vTerm.value = pArray[6];
	ich_FriendForm.ich_vInterestResult.value = pArray[7];
}	

function ich_saveCalc(amount,rate,term,interestResult)
{
	var winRef = window.open('','saveWindow','location=no,resizable=yes,scrollbars=yes,width=500,height=400,left=400,top=100');
	var s = ' ';
	s = ich_makeReport(amount,rate,term,interestResult);
	winRef.document.write(s);
	winRef.document.close();
}

function ich_makeReport(amount,rate,term,interestResult)
{
	var browserSupported = false;
	var browser = navigator.appName;
	var temp,version;	
	if (browser=="Microsoft Internet Explorer") {
		if (navigator.appVersion.indexOf("MSIE")!=-1) {
			temp = navigator.appVersion.split("MSIE");
			version = parseFloat(temp[1]);
		}
		if(version >= 5) {
			browserSupported = true;
		}
	}
	
	// generate the html page for the save table frame.
	var saveFrameStr = ich_saveHeader() +
	"<body>"+
	"<div id=\\'brandingColor\\'></div>"+
	"<div id=\\'global_container\\'>"+
		"<h2>Calculator Summary</h2>"+
		"<div id=\\'column_container\\'>"+
			"<h3>Term Deposit Details </h3>"+
				"<div class=\\'content_container\\'>"+
					"<p class=\\'column1\\'>"+
						"<strong>Amount :</strong> $"+amount+"<br>"+
						"<strong>Interest rate :</strong> "+rate+"%<br>"+
						"<strong>Investment term :</strong> "+term+" </p>"+
				"</div>"+
		"</div>"+
		"<div id=\\'results_container\\'>"+
			"<h3>Results</h3>"+
				"<div class=\\'content_container\\'>"+
					"<p class=\\'column1\\'>"+
						"<strong>"+interestResult+"</strong> </p>"+					
				"</div>"+
		"</div>" + 
	"</body>"+
	"</html>";
	
	// generate a html page consisting of the save button.
	var buttonFrameStr = ich_saveButtonPage();

	// generate a html page consisting of 2 frames: top frame contains save table.
	// bottom frame contains save button.
	var str = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"+
	"<html><head>"+ 
	"<title>Term Deposit Calculator Information</title>"+
	"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"+
	"<script type=\"text/javascript\">"+
	"function update() {"+
	    "window.saveFrame.document.open();"+
	    "window.saveFrame.document.write('"+saveFrameStr+"');"+
	    "window.saveFrame.document.close();"+
	    "window.buttonFrame.document.open();"+
	    "window.buttonFrame.document.write('"+buttonFrameStr+"');"+
	    "window.buttonFrame.document.close();"+
	"}"+
	
	"function doSaveAs() {"+
		"var browserSupported = false;"+
		"var browser = navigator.appName;"+
		"var temp,version;"+
		"if (browser==\"Microsoft Internet Explorer\") {"+
			"if (navigator.appVersion.indexOf(\"MSIE\")!=-1) {"+
				"temp = navigator.appVersion.split(\"MSIE\");"+
				"version = parseFloat(temp[1]);"+
				"if(version >= 5) {"+
					"browserSupported = true;"+
				"}"+
			"}"+
		"}"+
		"if(browserSupported) {	"+
			"window.saveFrame.document.execCommand('saveAs',false,'CalculatorResults.html');"+
		"} else {"+
			"var button = window.buttonFrame.document.getElementById('SaveForm');"+
			"button.parentNode.removeChild(button);"+
			"alert(\"Your browser does not support this save function. To save this page press ctrl-S.\");"+
		"}"+
	"}"+

	
	"document.write('<frameset rows=\"220,*\" onLoad=\"update()\" frameborder=no border=0>');"+
	"document.write('<frame src=\"\" name=saveFrame noresise=noresize>');"+
	"document.write('<frame src=\"\" name=buttonFrame noresise=noresize>');"+
	"document.write('</frameset>');"+
	"</script>"+
	"</head>"+	
	"</html>";
	
	return str;
}
