http://sakura-wheels.ru/tyrecalculator.php
var mm2px=0.5; //scale var mm2pxRR=0.5; //scale
var showTire=1; var showTireRR=1; var showRim=1; var showRimRR=1;
var x0=160; var x0RR=160; var y0=220; var y0RR=220;
var spaceW=320-80; var spaceH=440-80; var spaceWRR=320-80; var spaceHRR=440-80;
var frameName='frame1'; var frameNameRR='frame2';
function resizeParentFrame(){
if(parent==null) return;
d=parent.document;
if(d.all==null) return;
for(i=0;i
els=document.forms[1].elements; if(el.name=='showTireRR'){ if(el.checked){ showTireRR=1; } else{ showTireRR=0; showRimRR=1; els.showRimRR.checked=true; } } if(el.name=='showRimRR'){ if(el.checked){ showRimRR=1; } else{ showRimRR=0; showTireRR=1; els.showTireRR.checked=true; } } if(showRimRR==0) document.all.rimMenuRR.style.display = "none"; else document.all.rimMenuRR.style.display = "inline"; if(showTireRR==0) document.all.tireMenuRR.style.display = "none"; else document.all.tireMenuRR.style.display = "inline";
if(el.name=='bdRR'){
//biddiameter
els.rdRR.selectedIndex=el.selectedIndex;
}
if(el.name=='rdRR'){
//rim diameter
els.bdRR.selectedIndex=el.selectedIndex;
}
if(el.name=='swRR'){
//section width
swRR=els.swRR.options[els.swRR.selectedIndex].value;
arRR=els.arRR.options[els.arRR.selectedIndex].value;
rwRR=els.rwRR.options[els.rwRR.selectedIndex].value;
rwRR=rwRR*25.4;
if(rwRR>swRR){
//wheel is wider than tire
maxRimWRR=rimWidthMax(swRR,arRR);
setSelect(els.rwRR,maxRimWRR);
}
}
if(el.name=='swRR' || el.name=='arRR'){
swRR=els.swRR.options[els.swRR.selectedIndex].value;
arRR=els.arRR.options[els.arRR.selectedIndex].value;
rwRR=els.rwRR.options[els.rwRR.selectedIndex].value;
if(rwRR
render();
}
function rimWidthMax(sectionwidth,aspectratio){ //rim shouldn't be wider than tire rimwidthmax = sectionwidth/25.4; rimwidthmax = Math.round(rimwidthmax*2.0)/2.0; rimwidthmax -= 0.5; //at least half inch narrower than tire return rimwidthmax; }
function rimWidthMin(sectionwidth,aspectratio){ //rim shouldn't be narrower than tire walls can be bended inward //calculation is from assumption that max. allowed bend is: wall*a+b wall = sectionwidth*aspectratio/100; rimwidthmin = (sectionwidth - 0.21*wall - 47.49 )/25.4; rimwidthmin = Math.ceil(rimwidthmin*2.0)/2.0; return rimwidthmin; }
var tireHeight_mm=0; var tireHeight_mmRR=0; var tireWidth_mm=0; var tireWidth_mmRR=0; var tireWall_mm=0; var tireWall_mmRR=0; var rimWidth_mm=0; var rimWidth_mmRR=0; var rimHeight_mm=0; var rimHeight_mmRR=0; var maxW_mm=0; var maxW_mmRR=0; var maxH_mm=0; var maxH_mmRR=0; var padW_mm=0; var padW_mmRR=0; var padH_mm=0; var padH_mmRR=0; var et_mm=0; var et_mmRR=0; var backspace_mm=0; var backspace_mmRR=0;
function calculateSizes(){ e=document.forms[0].elements; eRR=document.forms[1].elements;
sw=1*e.sw.options[e.sw.selectedIndex].value; swRR=1*eRR.swRR.options[eRR.swRR.selectedIndex].value;
ar=1*e.ar.options[e.ar.selectedIndex].value; arRR=1*eRR.arRR.options[eRR.arRR.selectedIndex].value;
bd=Math.round(25.4*e.bd.options[e.bd.selectedIndex].value); bdRR=Math.round(25.4*eRR.bdRR.options[eRR.bdRR.selectedIndex].value);
rd=Math.round(25.4*e.rd.options[e.rd.selectedIndex].value); rdRR=Math.round(25.4*eRR.rdRR.options[eRR.rdRR.selectedIndex].value);
rw=Math.round(25.4*e.rw.options[e.rw.selectedIndex].value); rwRR=Math.round(25.4*eRR.rwRR.options[eRR.rwRR.selectedIndex].value);
et=1*e.et.options[e.et.selectedIndex].value; etRR=1*eRR.etRR.options[eRR.etRR.selectedIndex].value;
if(showRim==0){ rw=Math.round(sw-30); } if(showRimRR==0){ rwRR=Math.round(swRR-30); }
et_mm=et; et_mmRR=etRR;
rimHeight_mm=rd; rimWidth_mm=rw; tireWidth_mm=sw; tireWall_mm=Math.round(tireWidth_mm*ar/100); tireHeight_mm=rimHeight_mm+tireWall_mm*2;
rimHeight_mmRR=rdRR; rimWidth_mmRR=rwRR; tireWidth_mmRR=swRR; tireWall_mmRR=Math.round(tireWidth_mmRR*arRR/100); tireHeight_mmRR=rimHeight_mmRR+tireWall_mmRR*2;
maxW_mm=tireWidth_mm; maxH_mm=tireHeight_mm; if(showTire==0){ maxW_mm=rimWidth_mm; maxH_mm=rimHeight_mm; } mm2px=Math.min(spaceW/maxW_mm,spaceH/maxH_mm); //save desirable value e.mm2pxMy.value=mm2px; //inform other frame
maxW_mmRR=tireWidth_mmRR; maxH_mmRR=tireHeight_mmRR; if(showTireRR==0){ maxW_mmRR=rimWidth_mmRR; maxH_mmRR=rimHeight_mmRR; } mm2pxRR=Math.min(spaceWRR/maxW_mmRR,spaceHRR/maxH_mmRR); //save desirable value eRR.mm2pxMy.value=mm2pxRR; //inform other frame
/////////////////////////////////////////////////////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /////////////////////////////////////////////////////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /////////////////////////////////////////////////////////////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! document.forms[0].elements.mm2pxOther.value=document.forms[1].elements.mm2pxMy.value; //take his value too document.forms[1].elements.mm2pxOther.value=document.forms[0].elements.mm2pxMy.value; resize();
if(e.mm2pxOther.value>0) mm2px=Math.min(e.mm2pxMy.value,e.mm2pxOther.value);
if(eRR.mm2pxOther.value>0) mm2pxRR=Math.min(eRR.mm2pxMy.value,eRR.mm2pxOther.value);
padW_mm=110/93*40; padH_mm=110/93*174;
padW_mmRR=110/93*40; padH_mmRR=110/93*174;
backspace_mm=rimWidth_mm/2+et_mm; backspace_mmRR=rimWidth_mmRR/2+et_mmRR;
}
var maxW=0; var maxH=0; var tireX=0; var tireY=0; var tireW=0; var tireH=0; var rimX=0; var rimY=0; var rimW=0; var rimH=0; var lipH; var tire2lipIn=0; var tire2lipDown=0; var padX=0; var padW=0; var padH=0; var tireOutR=32; var tireInR=15; var rubberH=9; var wallH=0; var tireBend=0;
var maxWRR=0; var maxHRR=0; var tireXRR=0; var tireYRR=0; var tireWRR=0; var tireHRR=0; var rimXRR=0; var rimYRR=0; var rimWRR=0; var rimHRR=0; var lipHRR; var tire2lipInRR=0; var tire2lipDownRR=0; var padXRR=0; var padWRR=0; var padHRR=0; var tireOutRRR=32; var tireInRRR=15; var rubberHRR=9; var wallHRR=0; var tireBendRR=0;
function calculateCoordinates(){ maxH=Math.floor(maxH_mm*mm2px); if(maxH%2==0) maxH++; maxW=Math.floor(maxW_mm*mm2px); if(maxW%2==0) maxW++;
tireH=Math.floor(tireHeight_mm*mm2px); if(tireH%2==0) tireH++; tireW=Math.floor(tireWidth_mm*mm2px); if(tireW%2==0) tireW++; tireX=x0-(tireW-1)/2; tireY=y0-(tireH-1)/2;
rimH=Math.floor(rimHeight_mm*mm2px); if(rimH%2==0) rimH++; rimW=Math.floor(rimWidth_mm*mm2px); if(rimW%2==0) rimW++; rimX=x0-(rimW-1)/2; rimY=y0-(rimH-1)/2;
lipH=Math.round(rimW/200*47);
padH=Math.floor(padH_mm*mm2px); if(padH%2==0) padH++; padW=Math.round(padW_mm*mm2px); padX=Math.round((rimWidth_mm/2-et_mm)*mm2px)-padW+1;
rubberH=Math.round(tireH/50);
tire2lipIn=Math.round(rimW/200*12); tire2lipDown=Math.round(rimW/200*18);
wallH=Math.round((tireH-rimH)/2); tireBend=(tireW-rimW)/2+tire2lipIn; if(tireBend<1) tireBend=0; tireOutR=Math.round(wallH/3); tireInR=tireBend; if(tireOutR+tireInR>=wallH){ tireInR=wallH-tireOutR; }
maxHRR=Math.floor(maxH_mmRR*mm2pxRR); if(maxHRR%2==0) maxHRR++; maxWRR=Math.floor(maxW_mmRR*mm2pxRR); if(maxWRR%2==0) maxWRR++;
tireHRR=Math.floor(tireHeight_mmRR*mm2pxRR); if(tireHRR%2==0) tireHRR++; tireWRR=Math.floor(tireWidth_mmRR*mm2pxRR); if(tireWRR%2==0) tireWRR++; tireXRR=x0RR-(tireWRR-1)/2; tireYRR=y0RR-(tireHRR-1)/2;
rimHRR=Math.floor(rimHeight_mmRR*mm2pxRR); if(rimHRR%2==0) rimHRR++; rimWRR=Math.floor(rimWidth_mmRR*mm2pxRR); if(rimWRR%2==0) rimWRR++; rimXRR=x0RR-(rimWRR-1)/2; rimYRR=y0RR-(rimHRR-1)/2;
lipHRR=Math.round(rimWRR/200*47);
padHRR=Math.floor(padH_mmRR*mm2pxRR); if(padHRR%2==0) padHRR++; padWRR=Math.round(padW_mmRR*mm2pxRR); padXRR=Math.round((rimWidth_mmRR/2-et_mmRR)*mm2pxRR)-padWRR+1;
rubberHRR=Math.round(tireHRR/50);
tire2lipInRR=Math.round(rimWRR/200*12); tire2lipDownRR=Math.round(rimWRR/200*18);
wallHRR=Math.round((tireHRR-rimHRR)/2); tireBendRR=(tireWRR-rimWRR)/2+tire2lipInRR; if(tireBendRR<1) tireBendRR=0; tireOutRRR=Math.round(wallHRR/3); tireInRRR=tireBendRR; if(tireOutRRR+tireInRRR>=wallHRR){ tireInRRR=wallHRR-tireOutRRR; }
}
function setElement(id,x,y,w,h){ es=document.getElementById(id).style; es.left=x; es.top=y; es.width=w; es.height=h; }
var rendering=1; var resizingRequired=0; var renderingRR=1; var resizingRequiredRR=0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////// function render(){ rendering=1; renderingRR=1; calculateSizes(); calculateCoordinates(); draw(); rendering=0; renderingRR=0; if(resizingRequired==1) resize(); compareSizes();
} //////////////////////////////////////////////////////////////////////////////////////////////////////////
function resize(){ if(rendering==1){ resizingRequired=1; return; } rendering=1; e=document.forms[0].elements; if(mm2px!=Math.min(e.mm2pxMy.value,e.mm2pxOther.value)){ mm2px=Math.min(e.mm2pxMy.value,e.mm2pxOther.value); calculateCoordinates(); draw(); } rendering=0; resizingRequired=0; }
function setShowSize(id,text,whichSide,placeText,x,y,w,h){ //whichSide: up,down,left,right //placeText: up,down,center sizeLineInShift=4; textBoxW=100; textBoxH=30; if(whichSide=='left' || whichSide=='right'){ //vertical size setElement(id+"_bar1",x,y,w,1); setElement(id+"_bar2",x,y+h-1,w,1); sizeLineX=x+sizeLineInShift; //left if(whichSide=='right') sizeLineX=x+w-sizeLineInShift-1; setElement(id+"_sizeLine",sizeLineX,y,1,h); setElement(id+"_arrow1",sizeLineX-2,y+1,5,5); setElement(id+"_arrow2",sizeLineX-2,y+h-6,5,5); setElement(id+"_text",sizeLineX-textBoxW/2,h*0.2,textBoxW,h*0.6); } else{ //horisontal size if(w<0){ w=-w+2; x=x-w+1; } setElement(id+"_bar1",x,y,1,h); setElement(id+"_bar2",x+w-1,y,1,h); sizeLineY=y+sizeLineInShift; //top if(whichSide=='down') sizeLineY=y+h-sizeLineInShift-1; setElement(id+"_sizeLine",x,sizeLineY,Math.max(w,40),1); if(w>12){ setElement(id+"_arrow1",x+1,sizeLineY-2,5,5); setElement(id+"_arrow2",x+w-6,sizeLineY-2,5,5); } else{ setElement(id+"_arrow1",x+w,sizeLineY-2,5,5); setElement(id+"_arrow2",x-5,sizeLineY-2,5,5); } setElement(id+"_text",x,sizeLineY-textBoxH/2,w,textBoxH);
}
innerHTML="
"+text+" |
";
document.getElementById(id+"_text").innerHTML = innerHTML; }
function setShowPointer(id,text,whichSide,placeText,x,y,ln){ //whichSide: up,down,left,right //placeText: up,down,center textBoxW=100; textBoxH=30; if(whichSide=='left'){ setElement(id+"_line",x,y,ln,1); setElement(id+"_arrow",x+1,y-2,5,5); setElement(id+"_text",x,y-textBoxH/2,ln,textBoxH); } else if(whichSide=='right'){ setElement(id+"_line",x-ln,y,ln,1); setElement(id+"_arrow",x-6,y-2,5,5); setElement(id+"_text",x-ln,y-textBoxH/2,ln,textBoxH); } else{ alert("Not ready"); }
innerHTML="
"+text+" |
";
document.getElementById(id+"_text").innerHTML = innerHTML; }
function mmAndInches(mm){ if(mm==0) return "0"; inches=(Math.round(mm*10.0/25.4))/10.0; mm=Math.round(mm); return ""+mm+"mm ("+inches+"'')"; }
function hideGroup(groupName){
for(i=0;i
setElement("tireSVl",x-tireH/2,y0-tireH/2,tireH,tireH); setElement("tireSV2",x-tireH/2+1,y0-tireH/2+1,tireH-2,tireH-2); setElement("tireSV3",x-rimH/2,y0-rimH/2,rimH,rimH); setElement("tireSV4",x-rimH/2+1,y0-rimH/2+1,rimH-2,rimH-2);
setElement("tireDiv",tireX,tireY,tireW,tireH); //tire bended walls if(tireBend<1) hideGroup("tireBW"); else{ h=tireH-wallH*2+tireInR*2; setElement("tireBWl",0,wallH-tireInR,tireBend,h); setElement("tireBWr",tireW-tireBend,wallH-tireInR,tireBend,h); //hide visible from inside part (only lower part)--> setElement("tireBWH",tireInR,tireH-wallH,tireW-tireInR*2,tireInR); } //tire outer corners if(tireOutR<=1) hideGroup("tireOC"); else{ setElement("tireOCnw",0,0,tireOutR,tireOutR); setElement("tireOCne",tireW-tireOutR,0,tireOutR,tireOutR); setElement("tireOCse",tireW-tireOutR,tireH-tireOutR,tireOutR,tireOutR); setElement("tireOCsw",0,tireH-tireOutR,tireOutR,tireOutR); //tire outer corners radius (gray cut) r=tireOutR-rubberH; if(r<1) hideGroup("tireOCR"); else{ setElement("tireOCRnw",rubberH,rubberH,r,r); setElement("tireOCRne",tireW-tireOutR,rubberH,r,r); setElement("tireOCRse",tireW-tireOutR,tireH-tireOutR,r,r); setElement("tireOCRsw",rubberH,tireH-tireOutR,r,r); } } //tire inner corners if(tireInR<=1) hideGroup("tireIC"); else{ setElement("tireICnw",0,tireH-wallH,tireInR,tireInR); setElement("tireICne",tireW-tireInR,tireH-wallH,tireInR,tireInR); setElement("tireICse",tireW-tireInR,wallH-tireInR,tireInR,tireInR); setElement("tireICsw",0,wallH-tireInR,tireInR,tireInR); //tire inner corners radius (gray cut) r=tireInR-rubberH; if(r<1) hideGroup("tireICR"); else{ setElement("tireICRnw",rubberH,tireH-wallH+rubberH,r,r); setElement("tireICRne",tireW-tireInR,tireH-wallH+rubberH,r,r); setElement("tireICRse",tireW-tireInR,wallH-tireInR,r,r); setElement("tireICRsw",rubberH,wallH-tireInR,r,r); } } //tire work surface setElement("tireWSn",tireOutR,0,tireW-tireOutR*2,rubberH); setElement("tireWSs",tireOutR,tireH-rubberH,tireW-tireOutR*2,rubberH); //tire side walls r=wallH-tireOutR-tireInR; if(r<1) hideGroup("tireSW"); else{ setElement("tireSWnw",0,tireOutR,rubberH,r); setElement("tireSWsw",0,tireH-tireOutR-r,rubberH,r); setElement("tireSWne",tireW-rubberH,tireOutR,rubberH,r); setElement("tireSWse",tireW-rubberH,tireH-tireOutR-r,rubberH,r); } //tire 2 rim "in" r=rubberH+tireBend-tireInR; setElement("tire2RInw",tireInR,wallH-rubberH,r,rubberH); setElement("tire2RIne",tireW-tireBend-rubberH,wallH-rubberH,r,rubberH); setElement("tire2RIsw",tireInR,tireH-wallH,r,rubberH); setElement("tire2RIse",tireW-tireBend-rubberH,tireH-wallH,r,rubberH); //tire 2 rim "down" setElement("tire2RDnw",tireBend,wallH,rubberH,tire2lipDown); setElement("tire2RDne",tireW-tireBend-rubberH,wallH,rubberH,tire2lipDown); setElement("tire2RDsw",tireBend,tireH-wallH-tire2lipDown,rubberH,tire2lipDown); setElement("tire2RDse",tireW-tireBend-rubberH,tireH-wallH-tire2lipDown,rubberH,tire2lipDown); //tire "lips" setElement("tireLPl",tireBend,wallH+tire2lipDown,rubberH,tireH-wallH*2-tire2lipDown*2); setElement("tireLPr",tireW-tireBend-rubberH,wallH+tire2lipDown,rubberH,tireH-wallH*2-tire2lipDown*2); //tire sizes setShowSize("tireH",mmAndInches(tireHeight_mm),"right","up",tireW-25,2,60,tireH-4); setShowSize("tireW",mmAndInches(tireWidth_mm),"down","down",2,tireH-20,maxW-4,35); } if(showRim==0) hideGroup("rim"); else{ //side view x=320+5; if(frameName.indexOf("2")>0) x=0-5; setElement("rimSVl",x-rimH/2,y0-rimH/2,rimH,rimH); setElement("rimSV2",x-rimH/2+1,y0-rimH/2+1,rimH-2,rimH-2);
setElement("rimDiv",rimX,rimY,rimW,rimH); setElement("rimBckg",0,0,rimW,rimH); //lips if(showTire==0){ setElement("rimLip1n",0,0,rimW,lipH); setElement("rimLip1s",0,rimH-lipH,rimW,lipH); hideGroup("rimLip2"); } else{ hideGroup("rimLip1"); setElement("rimLip2n",0,0,rimW,lipH); setElement("rimLip2s",0,rimH-lipH,rimW,lipH); //tire to lip down setElement("rimLip2TDnw",tire2lipIn,0,rubberH,tire2lipDown); setElement("rimLip2TDne",rimW-rubberH-tire2lipIn,0,rubberH,tire2lipDown); setElement("rimLip2TDsw",tire2lipIn,rimH-tire2lipDown,rubberH,tire2lipDown); setElement("rimLip2TDse",rimW-rubberH-tire2lipIn,rimH-tire2lipDown,rubberH,tire2lipDown); } //set spokes setElement("rimSpokes",padX,0,padW,rimH); el=document.getElementById("rimSpokes"); if(et_mm>30) el.src="spokes00.gif"; else if(et_mm<-30) el.src="spokes00.gif"; else el.src="spokes00.gif"; setElement("rimPad",padX,rimH/2-padH/2,padW,padH); //rim sizes setShowSize("rimH",mmAndInches(rimHeight_mm),"left","down",rimW/2-maxW/2-25,7,(maxW-rimW)/2+35,rimH-14); setShowSize("rimW",mmAndInches(rimWidth_mm),"up","up",5,(rimH-maxH)/2-15,rimW-10,(maxH-rimH)/2+40); //backspace setShowSize("rimBS"," "+mmAndInches(backspace_mm+12),"up","up",padX+padW-1,rimH/2-30,rimW-padX-padW+1,10); //Ширина обода //offset setShowSize("rimET"," Вылет "+mmAndInches(et_mm),"down","down",padX+padW-1,rimH/2+10,rimW/2-padX-padW+2,padH/2); //mounting pad setShowPointer("rimMP","Посадочная плоскость","left","up",padX+padW,rimH/2+20,120); //rim face setShowPointer("rimRF","Лицевая сторона","right","up",90,y0-50,70); } setElement("centerLineVertical",x0,y0-maxH/2-5,1,maxH+10); setElement("centerLineHorisonal",x0-maxW/2-5,y0,maxW+10,1); drawRR(); } function drawRR(){ if(showTireRR==0) hideGroup("RRtire"); else{ //side view xRR=0-5; setElement("RRtireSVl",xRR-tireHRR/2,y0RR-tireHRR/2,tireHRR,tireHRR); setElement("RRtireSV2",xRR-tireHRR/2+1,y0RR-tireHRR/2+1,tireHRR-2,tireHRR-2); setElement("RRtireSV3",xRR-rimHRR/2,y0RR-rimHRR/2,rimHRR,rimHRR); setElement("RRtireSV4",xRR-rimHRR/2+1,y0RR-rimHRR/2+1,rimHRR-2,rimHRR-2); setElement("RRtireDiv",tireXRR,tireYRR,tireWRR,tireHRR); //tire bended walls if(tireBend<1) hideGroup("RRtireBW"); else{ hRR=tireHRR-wallHRR*2+tireInRRR*2; setElement("RRtireBWl",0,wallHRR-tireInRRR,tireBendRR,hRR); setElement("RRtireBWr",tireWRR-tireBendRR,wallHRR-tireInRRR,tireBendRR,hRR); //hide visible from inside part (only lower part)--> setElement("RRtireBWH",tireInRRR,tireHRR-wallHRR,tireWRR-tireInRRR*2,tireInRRR); }
//tire outer corners
if(tireOutRRR<=1)
hideGroup("RRtireOC");
else{
setElement("RRtireOCnw",0,0,tireOutRRR,tireOutRRR);
setElement("RRtireOCne",tireWRR-tireOutRRR,0,tireOutRRR,tireOutRRR);
setElement("RRtireOCse",tireWRR-tireOutRRR,tireHRR-tireOutRRR,tireOutRRR,tireOutRRR);
setElement("RRtireOCsw",0,tireHRR-tireOutRRR,tireOutRRR,tireOutRRR);
//tire outer corners radius (gray cut)
rRR=tireOutRRR-rubberHRR;
if(rRR<1)
hideGroup("RRtireOCR");
else{
setElement("RRtireOCRnw",rubberHRR,rubberHRR,rRR,rRR);
setElement("RRtireOCRne",tireWRR-tireOutRRR,rubberHRR,rRR,rRR);
setElement("RRtireOCRse",tireWRR-tireOutRRR,tireHRR-tireOutRRR,rRR,rRR);
setElement("RRtireOCRsw",rubberHRR,tireHRR-tireOutRRR,rRR,rRR);
}
}
//tire inner corners
if(tireInRRR<=1)
hideGroup("RRtireIC");
else{
setElement("RRtireICnw",0,tireHRR-wallHRR,tireInRRR,tireInRRR);
setElement("RRtireICne",tireWRR-tireInRRR,tireHRR-wallHRR,tireInRRR,tireInRRR);
setElement("RRtireICse",tireWRR-tireInRRR,wallHRR-tireInRRR,tireInRRR,tireInRRR);
setElement("RRtireICsw",0,wallHRR-tireInRRR,tireInRRR,tireInRRR);
//tire inner corners radius (gray cut)
rRR=tireInRRR-rubberHRR;
if(rRR<1)
hideGroup("RRtireICR");
else{
setElement("RRtireICRnw",rubberHRR,tireHRR-wallHRR+rubberHRR,rRR,rRR);
setElement("RRtireICRne",tireWRR-tireInRRR,tireHRR-wallHRR+rubberHRR,rRR,rRR);
setElement("RRtireICRse",tireWRR-tireInRRR,wallHRR-tireInRRR,rRR,rRR);
setElement("RRtireICRsw",rubberHRR,wallHRR-tireInRRR,rRR,rRR);
}
}
//tire work surface
setElement("RRtireWSn",tireOutRRR,0,tireWRR-tireOutRRR*2,rubberHRR);
setElement("RRtireWSs",tireOutRRR,tireHRR-rubberHRR,tireWRR-tireOutRRR*2,rubberHRR);
//tire side walls
rRR=wallHRR-tireOutRRR-tireInRRR;
if(rRR<1)
hideGroup("RRtireSW");
else{
setElement("RRtireSWnw",0,tireOutRRR,rubberHRR,rRR);
setElement("RRtireSWsw",0,tireHRR-tireOutRRR-rRR,rubberHRR,rRR);
setElement("RRtireSWne",tireWRR-rubberHRR,tireOutRRR,rubberHRR,rRR);
setElement("RRtireSWse",tireWRR-rubberHRR,tireHRR-tireOutRRR-rRR,rubberHRR,rRR);
}
//tire 2 rim "in"
rRR=rubberHRR+tireBendRR-tireInRRR;
setElement("RRtire2RInw",tireInRRR,wallHRR-rubberHRR,rRR,rubberHRR);
setElement("RRtire2RIne",tireWRR-tireBendRR-rubberHRR,wallHRR-rubberHRR,rRR,rubberHRR);
setElement("RRtire2RIsw",tireInRRR,tireHRR-wallHRR,rRR,rubberHRR);
setElement("RRtire2RIse",tireWRR-tireBendRR-rubberHRR,tireHRR-wallHRR,rRR,rubberHRR);
//tire 2 rim "down"
setElement("RRtire2RDnw",tireBendRR,wallHRR,rubberHRR,tire2lipDownRR);
setElement("RRtire2RDne",tireWRR-tireBendRR-rubberHRR,wallHRR,rubberHRR,tire2lipDownRR);
setElement("RRtire2RDsw",tireBendRR,tireHRR-wallHRR-tire2lipDownRR,rubberHRR,tire2lipDownRR);
setElement("RRtire2RDse",tireWRR-tireBendRR-rubberHRR,tireHRR-wallHRR-tire2lipDownRR,rubberHRR,tire2lipDownRR);
//tire "lips"
setElement("RRtireLPl",tireBendRR,wallHRR+tire2lipDownRR,rubberHRR,tireHRR-wallHRR*2-tire2lipDownRR*2);
setElement("RRtireLPr",tireWRR-tireBendRR-rubberHRR,wallHRR+tire2lipDownRR,rubberHRR,tireHRR-wallHRR*2-tire2lipDownRR*2);
//tire sizes
setShowSize("RRtireH",mmAndInches(tireHeight_mmRR),"right","up",tireWRR-25,2,60,tireHRR-4);
setShowSize("RRtireW",mmAndInches(tireWidth_mmRR),"down","down",2,tireHRR-20,maxWRR-4,35);
}
if(showRimRR==0)
hideGroup("RRrim");
else{
//side view
xRR=0-5;
setElement("RRrimSVl",xRR-rimHRR/2,y0RR-rimHRR/2,rimHRR,rimHRR);
setElement("RRrimSV2",xRR-rimHRR/2+1,y0RR-rimHRR/2+1,rimHRR-2,rimHRR-2);
setElement("RRrimDiv",rimXRR,rimYRR,rimWRR,rimHRR);
setElement("RRrimBckg",0,0,rimWRR,rimHRR);
//lips
if(showTireRR==0){
setElement("RRrimLip1n",0,0,rimWRR,lipHRR);
setElement("RRrimLip1s",0,rimHRR-lipHRR,rimWRR,lipHRR);
hideGroup("RRrimLip2");
}
else{
hideGroup("RRrimLip1");
setElement("RRrimLip2n",0,0,rimWRR,lipHRR);
setElement("RRrimLip2s",0,rimHRR-lipHRR,rimWRR,lipHRR);
//tire to lip down
setElement("RRrimLip2TDnw",tire2lipInRR,0,rubberHRR,tire2lipDownRR);
setElement("RRrimLip2TDne",rimWRR-rubberHRR-tire2lipInRR,0,rubberHRR,tire2lipDownRR);
setElement("RRrimLip2TDsw",tire2lipInRR,rimHRR-tire2lipDownRR,rubberHRR,tire2lipDownRR);
setElement("RRrimLip2TDse",rimWRR-rubberHRR-tire2lipInRR,rimHRR-tire2lipDownRR,rubberHRR,tire2lipDownRR);
}
//set spokes
setElement("RRrimSpokes",padXRR,0,padWRR,rimHRR);
el=document.getElementById("RRrimSpokes");
if(et_mmRR>30)
el.src="spokes00.gif";
else
if(et_mmRR<-30)
el.src="spokes00.gif";
else
el.src="spokes00.gif";
setElement("RRrimPad",padXRR,rimHRR/2-padHRR/2,padWRR,padHRR);
//rim sizes
setShowSize("RRrimH",mmAndInches(rimHeight_mmRR),"left","down",rimWRR/2-maxWRR/2-25,7,(maxWRR-rimWRR)/2+35,rimHRR-14);
setShowSize("RRrimW",mmAndInches(rimWidth_mmRR),"up","up",5,(rimHRR-maxHRR)/2-15,rimWRR-10,(maxHRR-rimHRR)/2+40);
//backspace
setShowSize("RRrimBS"," "+mmAndInches(backspace_mmRR+12),"up","up",padXRR+padWRR-1,rimHRR/2-30,rimWRR-padXRR-padWRR+1,10); //Ширина обода
//offset
setShowSize("RRrimET"," Вылет "+mmAndInches(et_mmRR),"down","down",padXRR+padWRR-1,rimHRR/2+10,rimWRR/2-padXRR-padWRR+2,padHRR/2);
//mounting pad
setShowPointer("RRrimMP","Посадочная плоскость","left","up",padXRR+padWRR,rimHRR/2+20,120);
//rim face
setShowPointer("RRrimRF","Лицевая сторона","right","up",90,y0RR-50,70);
}
setElement("RRcenterLineVertical",x0RR,y0RR-maxHRR/2-5,1,maxHRR+10);
setElement("RRcenterLineHorisonal",x0RR-maxWRR/2-5,y0RR,maxWRR+10,1);
}
|
|
actionOnLoad();
function actionOnLoad(){ document.forms[0].Name="iframe1"; document.forms[0].showRim.value=1; document.forms[0].showTire.value=1; document.forms[0].sw.value=235; document.forms[0].ar.value=55; document.forms[0].bd.value=17; document.forms[0].rd.value=17; document.forms[0].rw.value="7.5"; document.forms[0].et.value=36;
document.forms[1].Name="iframe2"; document.forms[1].showRimRR.value=1; document.forms[1].showTireRR.value=1; document.forms[1].swRR.value=245; document.forms[1].arRR.value=45; document.forms[1].bdRR.value=18; document.forms[1].rdRR.value=18; document.forms[1].rwRR.value="8.5"; document.forms[1].etRR.value=30; }