function ich_thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

function ich_loadValues()
{
	
}

function ich_saveCalc(purchase, residential, strata, firstHome, liveIn,	settlementFee, stampDuty, rego, total)
{
	var winRef = window.open('','saveWindow','location=no,resizable=yes,scrollbars=yes,width=500,height=400,left=400,top=100');
	var s = ' ';
	s = ich_makeReport(purchase, residential, strata, firstHome, liveIn, settlementFee, stampDuty, rego, total);
	winRef.document.write(s);
	winRef.document.close();
}

function ich_makeReport(purchase, residential, strata, firstHome, liveIn, settlementFee, stampDuty, rego, total)
{
	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("Settlement Costs Calculator Information") +
	"<body>"+
	"<div id=\\'brandingColor\\'></div>"+
	"<div id=\\'global_container\\'>"+
		"<h2>Calculator Summary</h2>"+
		"<div id=\\'column_container\\'>"+
			"<h3>Purchase Details </h3>"+
				"<div class=\\'content_container\\'>"+
					"<p class=\\'column1\\'>"+
						"<strong>Purchase price of property :</strong> $"+purchase+"<br>"+
						"<span>"+residential+"</span><br>"+
						"<span>"+strata+"</span><br>"+
						"<span>"+firstHome+"</span><br>"+
						"<span>"+liveIn+"</span></p>"+
				"</div>"+
		"</div>"+
		"<div id=\\'results_container\\'>"+
			"<h3>Results</h3>"+
				"<div class=\\'content_container\\'>"+
					"<p class=\\'column1\\'>"+
						"<strong>Settlement Fee :</strong> "+settlementFee+"<br>"+
						"<strong>Stamp Duty :</strong> "+stampDuty+"<br>"+
						"<strong>Registration of Transfer :</strong> "+rego+"<br><br>"+
						"<strong>Total :</strong> "+total+"<br>"+
					"</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>Settlement Costs 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=\"280,*\" 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;
}






