// Javascript copyright Sean T. McHugh
//Cambridge in Colour Photography
// http://www.cambridgeincolour.com

<!-- Begin Panorama Calculator
function pano_calc(pano_form) {
orig_aperture = pano_form.orig_aperture.value;
orig_focal = pano_form.orig_focal.value;
mosaic_size = pano_form.mosaic_size.value;
percent_overlap = pano_form.percent_overlap.value;

if (isNaN(orig_focal)) {
alert('Please enter a numerical value for lens focal length.');
document.pano_form.orig_focal.focus();
document.pano_form.orig_focal.select();
}
else {
if (isNaN(percent_overlap)) {
alert('Please enter a numerical value for approximate percent overlap between photographs.');
document.pano_form.percent_overlap.focus();
document.pano_form.percent_overlap.select();
}
else {

overlap_fraction = percent_overlap / 100;
req_focal = orig_focal * (overlap_fraction + mosaic_size * (1-overlap_fraction));
req_aperture = orig_aperture * (req_focal/orig_focal) * (req_focal/orig_focal);
req_shutter = (req_aperture/orig_aperture) * (req_aperture/orig_aperture);
temp1 = (overlap_fraction + mosaic_size * (1 - overlap_fraction));
req_megapixels = temp1 * temp1;

pano_form.req_focal.value = Math.round(10 * req_focal) / 10 + " mm";
pano_form.req_aperture.value = "f/" + Math.round(10 * req_aperture) / 10;
pano_form.req_shutter.value = Math.round(10 * req_shutter) / 10 + "X";
pano_form.req_megapixels.value = Math.round(10 * req_megapixels) / 10 + "X";

	}
	}
}
//  End Panorama Calculator -->

<!-- Begin Panorama Efficiency Calculator
function panoeff_calc(pano_form0) {
mosaic_size0 = pano_form0.mosaic_size0.value;
percent_overlap0 = pano_form0.percent_overlap0.value;

if (isNaN(percent_overlap0)) {
alert('Please enter a numerical value for approximate percent overlap between photographs.');
document.pano_form0.percent_overlap0.focus();
document.pano_form0.percent_overlap0.select();
}
else {

overlap_fraction0 = percent_overlap0 / 100;
temp2 = overlap_fraction0 + mosaic_size0*(1-overlap_fraction0);
efficiency = 100 * temp2 * temp2 / (mosaic_size0 * mosaic_size0);

pano_form0.efficiency.value = Math.round(10 * efficiency) / 10 + " %";

	}
}
//  End Panorama Efficiency Calculator -->