//////////////////////////////////
//                              //
// copyright(c) FOREX WATCHER   //
// 無断転載はお止めください     //
//                              //
//////////////////////////////////
function calc(){rate=new Array();rate[1]=1;rate[2]=document.form1.val0_2.value;rate[3]=1/document.form1.val0_3.value;rate[4]=1/document.form1.val0_4.value;rate[5]=document.form1.val0_5.value;rate[6]=1/document.form1.val0_6.value;rate[7]=1/document.form1.val0_7.value;rate[8]=document.form1.val0_8.value;rate[9]=document.form1.val0_9.value;rate[10]=document.form1.val0_10.value;rate[11]=document.form1.val0_11.value;rate[12]=document.form1.val0_12.value;for(i=1;i<=12;i++){for(j=1;j<=12;j++){if(i==2){if(i==j)eval("document.form1.val"+i+"_"+j+".value='------'");else{temp=rate[j]/rate[i]*100+0.00005;string=""+temp;if(temp<10)eval("document.form1.val"+i+"_"+j+".value=string.substring(0,6)");else eval("document.form1.val"+i+"_"+j+".value=string.substring(0,5)");}}else{if(i==j)eval("document.form1.val"+i+"_"+j+".value='------'");else{dummy=rate[j]/rate[i];if(j==2||j==12){if(dummy>=10)temp=dummy+0.005;else temp=dummy+0.0005;string=""+temp;if(temp>=100)eval("document.form1.val"+i+"_"+j+".value=string.substring(0,6)");else eval("document.form1.val"+i+"_"+j+".value=string.substring(0,5)");}else{temp=dummy+0.00005;string=""+temp;eval("document.form1.val"+i+"_"+j+".value=string.substring(0,6)");}}}}}}function chgrate(n){strg=n+"";nbr=strg.charAt(0);curr=strg.substring(1,3);fig=curr*1;if(curr=="02"){jpy=document.form1.val0_2.value;if(nbr==1)jpy=parseInt((jpy*1+0.01+0.005)*100)/100;else if(nbr==2)jpy=parseInt((jpy*1+0.1+0.005)*100)/100;else if(nbr==3)jpy=parseInt((jpy*1+1+0.005)*100)/100;else if(nbr==4)jpy=parseInt((jpy*1-0.01+0.005)*100)/100;else if(nbr==5)jpy=parseInt((jpy*1-0.1+0.005)*100)/100;else if(nbr==6)jpy=parseInt((jpy*1-1+0.005)*100)/100;if(document.form1.val0_2.value<=50){alert('やり過ぎです。これ以上、できません。');return false;}else document.form1.val0_2.value=jpy;}else if(curr=="12"){thb=document.form1.val0_12.value;if(nbr==1)thb=parseInt((thb*1+0.01+0.005)*100)/100;else if(nbr==2)thb=parseInt((thb*1+0.1+0.005)*100)/100;else if(nbr==3)thb=parseInt((thb*1+1+0.005)*100)/100;else if(nbr==4)thb=parseInt((thb*1-0.01+0.005)*100)/100;else if(nbr==5)thb=parseInt((thb*1-0.1+0.005)*100)/100;else if(nbr==6)thb=parseInt((thb*1-1+0.005)*100)/100;if(document.form1.val0_12.value<=10){alert('やり過ぎです。これ以上、できません。');return false;}else document.form1.val0_12.value=thb;}else{other=eval("document.form1.val0_"+fig+".value");if(nbr==1)other=parseInt((other*1+0.0001+0.00005)*10000)/10000;else if(nbr==2)other=parseInt((other*1+0.001+0.00005)*10000)/10000;else if(nbr==3)other=parseInt((other*1+0.01+0.00005)*10000)/10000;else if(nbr==4)other=parseInt((other*1-0.0001+0.00005)*10000)/10000;else if(nbr==5)other=parseInt((other*1-0.001+0.00005)*10000)/10000;else if(nbr==6)other=parseInt((other*1-0.01+0.00005)*10000)/10000;eval("document.form1.val0_"+fig+".value=other");}calc();}