function toggleDisplayButtonmod_jcalc(obj,button){if(obj.style.display=='block'){obj.style.display='none'}else{obj.style.display='block'}if(button.innerHTML=='more...'){button.innerHTML='less...'}else{button.innerHTML='more...'}return false}var jcalcResult=0,jcalcOperator=0,jcalcSecond=0,jcalcReady=0,jcalcDone=1,jcalcComplete=0,jcalcInteger,jcalcCurrentValue;var Jcalc={deleteChar:function(){document.mod_jcalc.LED.value=document.mod_jcalc.LED.value.substring(0,document.mod_jcalc.LED.value.length-1)},reset:function(value){document.mod_jcalc.LED.value=value;jcalcResult=0;jcalcOperator=0;jcalcSecond=0;jcalcReady=0;jcalcDone=1;jcalcComplete=0},setValue:function(newValue){jcalcInteger=1;if(jcalcSecond||jcalcDone){jcalcSecond=0;jcalcDone=0;jcalcCurrentValue=newValue}for(var i=0;i<jcalcCurrentValue.length;i++){if(jcalcCurrentValue[i]=='.'){jcalcInteger=0}}},click:function(caption){jcalcCurrentValue=document.mod_jcalc.LED.value;jcalcCurrentValue=jcalcCurrentValue.replace(/^0+/g,"");if(caption=='.'){this.setValue('0');if(jcalcInteger){jcalcCurrentValue+=caption;document.mod_jcalc.LED.value=jcalcCurrentValue;jcalcComplete=0}}if(caption.length==1&&caption>='0'&&caption<='9'){this.setValue('');if(jcalcCurrentValue=='0'){jcalcCurrentValue=''}jcalcCurrentValue+=caption;document.mod_jcalc.LED.value=jcalcCurrentValue;jcalcComplete=1}if(caption=='pi'){jcalcCurrentValue=Math.PI;document.mod_jcalc.LED.value=jcalcCurrentValue;jcalcComplete=1}if(caption=='e'){jcalcCurrentValue=Math.E;document.mod_jcalc.LED.value=jcalcCurrentValue;jcalcComplete=1}if(caption=='-'||caption=='+'||caption=='/'||caption=='*'||caption=='^'){if(jcalcSecond){jcalcOperator=caption}else{if(!jcalcReady){jcalcOperator=caption;jcalcResult=jcalcCurrentValue;jcalcReady=1}else{if(jcalcOperator=='^'){jcalcResult=Math.pow(jcalcResult,jcalcCurrentValue)}else{jcalcResult=eval(jcalcResult+jcalcOperator+jcalcCurrentValue)}jcalcOperator=caption;document.mod_jcalc.LED.value=jcalcResult}jcalcComplete=0;jcalcSecond=1}}if(caption=='1/x'){jcalcResult=eval('1/'+jcalcCurrentValue);this.reset(jcalcResult)}if(caption=='sqrt'){jcalcResult=Math.sqrt(jcalcCurrentValue);this.reset(jcalcResult)}if(caption=='exp'){jcalcResult=Math.exp(jcalcCurrentValue);this.reset(jcalcResult)}if(caption=='log'){jcalcResult=Math.log(jcalcCurrentValue)/Math.LN10;this.reset(jcalcResult)}if(caption=='ln'){jcalcResult=Math.log(jcalcCurrentValue);this.reset(jcalcResult)}if(caption=='sin'){jcalcResult=jcalcCurrentValue;if(document.mod_jcalc.c_h_angle.value=="deg"){jcalcResult=jcalcResult*Math.PI/180}if(document.mod_jcalc.c_h_angle.value=="grd"){jcalcResult=jcalcResult*Math.PI/200}jcalcResult=Math.sin(jcalcResult);this.reset(jcalcResult)}if(caption=='cos'){jcalcResult=jcalcCurrentValue;if(document.mod_jcalc.c_h_angle.value=="deg"){jcalcResult=jcalcResult*Math.PI/180}if(document.mod_jcalc.c_h_angle.value=="grd"){jcalcResult=jcalcResult*Math.PI/200}jcalcResult=Math.cos(jcalcResult);this.reset(jcalcResult)}if(caption=='tan'){jcalcResult=jcalcCurrentValue;if(document.mod_jcalc.c_h_angle.value=="deg"){jcalcResult=jcalcResult*Math.PI/180}if(document.mod_jcalc.c_h_angle.value=="grd"){jcalcResult=jcalcResult*Math.PI/200}jcalcResult=Math.tan(jcalcResult);this.reset(jcalcResult)}if(caption=='asin'){jcalcResult=Math.asin(jcalcCurrentValue);if(document.mod_jcalc.c_h_angle.value=="deg"){jcalcResult=jcalcResult*180/Math.PI}if(document.mod_jcalc.c_h_angle.value=="grd"){jcalcResult=jcalcResult*200/Math.PI}this.reset(jcalcResult)}if(caption=='acos'){jcalcResult=Math.acos(jcalcCurrentValue);if(document.mod_jcalc.c_h_angle.value=="deg"){jcalcResult=jcalcResult*180/Math.PI}if(document.mod_jcalc.c_h_angle.value=="grd"){jcalcResult=jcalcResult*200/Math.PI}this.reset(jcalcResult)}if(caption=='atan'){jcalcResult=Math.atan(jcalcCurrentValue);if(document.mod_jcalc.c_h_angle.value=="deg"){jcalcResult=jcalcResult*180/Math.PI}if(document.mod_jcalc.c_h_angle.value=="grd"){jcalcResult=jcalcResult*200/Math.PI}this.reset(jcalcResult)}if(caption=='sinh'){jcalcResult=Math.exp(jcalcCurrentValue);jcalcResult=(jcalcResult-1/jcalcResult)/2;this.reset(jcalcResult)}if(caption=='cosh'){jcalcResult=Math.exp(jcalcCurrentValue);jcalcResult=(jcalcResult+1/jcalcResult)/2;this.reset(jcalcResult)}if(caption=='tanh'){jcalcResult=Math.exp(jcalcCurrentValue);jcalcResult=(jcalcResult-1/jcalcResult)/(jcalcResult+1/jcalcResult);this.reset(jcalcResult)}if(caption=='asinh'){jcalcResult=jcalcCurrentValue/Math.abs(jcalcCurrentValue)*Math.log(Math.abs(jcalcCurrentValue)+Math.sqrt(jcalcCurrentValue*jcalcCurrentValue+1));this.reset(jcalcResult)}if(caption=='acosh'){jcalcResult=2*Math.log(Math.sqrt((jcalcCurrentValue+1)/2)+Math.sqrt((jcalcCurrentValue-1)/2));this.reset(jcalcResult)}if(caption=='atanh'){jcalcResult=Math.log((jcalcCurrentValue-1)/(jcalcCurrentValue+1))/2;this.reset(jcalcResult)}if(caption=='+/-'){document.mod_jcalc.LED.value=eval(-jcalcCurrentValue)}if(caption=='='&&jcalcComplete&&jcalcOperator!='0'){if(jcalcOperator=='^'){jcalcResult=Math.pow(jcalcResult,jcalcCurrentValue);this.reset(jcalcResult)}else{this.reset(eval(jcalcResult+jcalcOperator+jcalcCurrentValue))}}if(caption=='C'){this.reset(0)}if(caption=='BKSP'){this.deleteChar()}if(caption=='deg'){document.mod_jcalc.c_deg.disabled=true;document.mod_jcalc.c_rad.disabled=false;document.mod_jcalc.c_grd.disabled=false;document.mod_jcalc.c_h_angle.value=caption}if(caption=='rad'){document.mod_jcalc.c_deg.disabled=false;document.mod_jcalc.c_rad.disabled=true;document.mod_jcalc.c_grd.disabled=false;document.mod_jcalc.c_h_angle.value=caption}if(caption=='grd'){document.mod_jcalc.c_deg.disabled=false;document.mod_jcalc.c_rad.disabled=false;document.mod_jcalc.c_grd.disabled=true;document.mod_jcalc.c_h_angle.value=caption}if(document.mod_jcalc.LED.value[0]=='.'){document.mod_jcalc.LED.value='0'+document.mod_jcalc.LED.value}}};