//coc calculator written by john hendry info@johnhendry.com copyright sept 2001;
// <!--
function toDouble(num){;num=Math.round(num*100);num=parseFloat(num/100);if(num==parseInt(num)){return(num+".00");};if((num*10)==parseInt(num*10)){return(num+"0");};return(num);};function toQuadruple(num){;num=Math.round(num*1000);num=parseFloat(num/1000);if(num==parseInt(num)){return(num+".000");};if((num*100)==parseInt(num*100)){return(num+"0");};if((num*10)==parseInt(num*10)){return(num+"0");};return(num);};function diagonal(height,width){;diag=Math.sqrt(Math.pow(height,2)+Math.pow(width,2));return(diag);};var neg=new Array();var paper=new Array();neg[0]='24 36 35mm';neg[1]='41 56 6x45';neg[2]='56 56 6x6';neg[3]='56 65.3 6x7';neg[4]='56 84 6x9';neg[5]='56 112 6x12';neg[6]='56 158.7 6x17';neg[7]='101.6 127 4"x5"';neg[8]='127 177.8 5"x7"';neg[9]='203.2 254 8"x10"';paper[0]='5 7';paper[1]='8 10';paper[2]='11 14';paper[3]='12 16';paper[4]='16 20';paper[5]='20 24';paper[6]='30 40';function calccoc(){;var filmformat=document.f1.combo1.selectedIndex;var paperformat=document.f1.combo2.selectedIndex;var lpi=document.f1.lpi.options[document.f1.lpi.selectedIndex].value;negspec=neg[filmformat];splitArray=negspec.split(' ');negheight=splitArray[0];negwidth=splitArray[1];paperspec=paper[paperformat];splitArray=paperspec.split(' ');paperheight=splitArray[0];paperwidth=splitArray[1];negaspect=(negwidth/negheight);paperaspect=(paperwidth/paperheight);if(negaspect>=paperaspect){;imageheight=(paperwidth/negaspect);imagewidth=paperwidth;}else{;imagewidth=(paperheight*negaspect);imageheight=paperheight;};imageaspect=(imagewidth/imageheight);negdiag=diagonal(negheight,negwidth);paperdiag=25.4*diagonal(paperheight,paperwidth);imagediag=25.4*diagonal(imageheight,imagewidth);efactor=(imagediag/negdiag);resfactor=lpi*efactor;coc=(1/resfactor);document.f1.negheight.value=toDouble(negheight)+' mm';document.f1.negwidth.value=toDouble(negwidth)+' mm';document.f1.negaspect.value=toDouble(negaspect);document.f1.negdiag.value=toDouble(negdiag)+' mm';document.f1.paperheight.value=toDouble(paperheight)+' inches';document.f1.paperwidth.value=toDouble(paperwidth)+' inches';document.f1.paperaspect.value=toDouble(paperaspect);document.f1.paperdiag.value=toDouble(paperdiag)+' mm';document.f1.imageheight.value=toDouble(imageheight)+' inches';document.f1.imagewidth.value=toDouble(imagewidth)+' inches';document.f1.imageaspect.value=toDouble(imageaspect);document.f1.imagediag.value=toDouble(imagediag)+' mm';document.f1.efactor.value=toDouble(efactor);document.f1.resfactor.value=toDouble(resfactor);document.f1.coc.value=toQuadruple(coc);};
// -->