Подскажите, пожалуйста, что не так. Скрипр работает во всех браузерах кроме Firefox.
<script language="javascript">
function getValue(SomeSelect) {
SomeSel_Obj = document.forms["SForm"].elements[SomeSelect].options;
SomeSel_Val = SomeSel_Obj[SomeSel_Obj.selectedIndex].value;
if(SomeSel_Val) { return SomeSel_Val; } else { return null; }
}
function calculate()
{
var WSquare, LSquare, CSquare, RSquare, ActualSquare, AddCooficient, WTypeSum, AddSum, Val_a, Val_b, Val_c, LWType, RWType, ImpOrPritv, WMaterial, WColor, WPacket, SlivType, PodokonnikType, PodokWidth, AlumOklad, OtkosWidth, MosquitoL, MosquitoR, Mounting;
Val_a = parseInt(document.forms["SForm"].elements["val_a"].value,0);
Val_b = parseInt(document.forms["SForm"].elements["val_b"].value,0);
Val_c = parseInt(document.forms["SForm"].elements["val_c"].value,0);
LWType = parseInt(getValue('Sleft'),0);
RWType = parseInt(getValue('Sright'),0);
WMaterial = parseInt(getValue('WMaterial'),0);
WColor = parseInt(getValue('WColor'),0);
WPacket = parseInt(getValue('WPacket'),0);
SlivType = parseInt(getValue('SlivType'),0);
PodokonnikType = parseInt(getValue('PodokonnikType'),0);
PodokWidth = parseInt(getValue('PodokWidth'),0);
if(document.forms["SForm"].elements["AlumOklad"].checked) AlumOklad = true; else AlumOklad = false;
if(document.forms["SForm"].OtkosType[0].checked) OtkosType = document.forms["SForm"].OtkosType[0].value;
if(document.forms["SForm"].OtkosType[1].checked) OtkosType = document.forms["SForm"].OtkosType[1].value;
if(document.forms["SForm"].OtkosType[2].checked) OtkosType = document.forms["SForm"].OtkosType[2].value;
OtkosWidth = parseInt(getValue('OtkosWidth'),0);
if(document.forms["SForm"].elements["MosquitoL"].checked) MosquitoL = true; else MosquitoL = false;
if(document.forms["SForm"].elements["MosquitoR"].checked) MosquitoR = true; else MosquitoR = false;
if(document.forms["SForm"].elements["Mounting"].checked) Mounting = true; else Mounting = false;
// Predefined values (prices)
var WindowT1_CPS = 155;
var WindowT2_CPS = 165;
var WindowT3_CPS = 217;
var WindowT4_CPS = 236;
var WindowT6_CPS = 230;
var WindowT7_CPS = 249;
var WndWoodM2_Coof = 0.11;
var WndWoodM3_Coof = 0.15;
var WndWoodM4_Coof = 0.15;
var WndWoodM5_Coof = 0.21;
var WndWoodM6_Coof = 0.3;
var WndWoodM7_Coof = 0.7;
var WndWoodM8_Coof = 0.9;
var WndColorC2_CPS = 15;
var WndColorC3_CPS = 15;
var SteklopacketT2_CPS = 6;
var SteklopacketT3_CPS = 50;
.............................
var OtkosT1_7 = 42; var OtkosT2_7 = OtkosT1_7 * 2.2; var OtkosT3_7 = OtkosT1_7;
var Mosquete_CPS = 35;
var Mounting_CPS = 40;
// Square results
LSquare = (Val_a * Val_b)/1000000;
RSquare = (Val_a * Val_c)/1000000;
ActualSquare = LSquare + RSquare;
WTypeSum = 0; AddSum = 0; AddCooficient = 1;
// Calculate price for each type of window
// Calculate price for each type of window
if(LWType==1) WTypeSum = WTypeSum + (LSquare*WindowT1_CPS);
if(RWType==1) WTypeSum = WTypeSum + (RSquare*WindowT1_CPS);
if(LWType==2) WTypeSum = WTypeSum + (LSquare*WindowT2_CPS);
if(RWType==2) WTypeSum = WTypeSum + (RSquare*WindowT2_CPS);
if(LWType==3) WTypeSum = WTypeSum + (LSquare*WindowT3_CPS);
if(RWType==3) WTypeSum = WTypeSum + (RSquare*WindowT3_CPS);
if(LWType==4) WTypeSum = WTypeSum + (LSquare*WindowT4_CPS);
if(RWType==4) WTypeSum = WTypeSum + (RSquare*WindowT4_CPS);
if(LWType==5) WTypeSum = WTypeSum + (LSquare*WindowT4_CPS) + 11;
if(RWType==5) WTypeSum = WTypeSum + (RSquare*WindowT4_CPS) + 11;
// Window Material
if(WMaterial==2) AddCooficient = AddCooficient + WndWoodM2_Coof;
if(WMaterial==3) AddCooficient = AddCooficient + WndWoodM3_Coof;
if(WMaterial==4) AddCooficient = AddCooficient + WndWoodM4_Coof;
if(WMaterial==5) AddCooficient = AddCooficient + WndWoodM5_Coof;
if(WMaterial==6) AddCooficient = AddCooficient + WndWoodM6_Coof;
if(WMaterial==7) AddCooficient = AddCooficient + WndWoodM7_Coof;
if(WMaterial==8) AddCooficient = AddCooficient + WndWoodM8_Coof;
// Window Color
if(WColor==2) AddSum = AddSum + (ActualSquare * WndColorC2_CPS);
if(WColor==3) AddSum = AddSum + (ActualSquare * WndColorC3_CPS);
// Steklopaket
if(WPacket==2) AddSum = AddSum - (ActualSquare * SteklopacketT2_CPS);
if(WPacket==3) AddSum = AddSum + (ActualSquare * SteklopacketT3_CPS);
if(WPacket==4) AddSum = AddSum + (ActualSquare * SteklopacketT4_CPS);
if(WPacket==5) AddSum = AddSum + (ActualSquare * SteklopacketT5_CPS);
if(WPacket==6) AddSum = AddSum + (ActualSquare * SteklopacketT6_CPS);
// Sliv
SlivLength = Val_b + Val_c;
if(SlivType==1) AddSum = AddSum + 5;
if(SlivType==2) AddSum = AddSum + (SlivLength * SlivTO1_CPM / 1000);
if(SlivType==3) AddSum = AddSum + (SlivLength * SlivTO2_CPM / 1000);
if(SlivType==4) AddSum = AddSum + (SlivLength * SlivTO3_CPM / 1000);
if(SlivType==5) AddSum = AddSum + (SlivLength * SlivTO4_CPM / 1000);
if(SlivType==6) AddSum = AddSum + (SlivLength * SlivTO5_CPM / 1000);
if(SlivType==7) AddSum = AddSum + (SlivLength * SlivTA1_CPM / 1000);
if(SlivType==8) AddSum = AddSum + (SlivLength * SlivTA2_CPM / 1000);
if(SlivType==9) AddSum = AddSum + (SlivLength * SlivTA3_CPM / 1000);
if(SlivType==10) AddSum = AddSum + (SlivLength * SlivTA4_CPM / 1000);
if(SlivType==11) AddSum = AddSum + (SlivLength * SlivTA5_CPM / 1000);
if(SlivType > 0) AddSum = AddSum + ( SlivLength / 1000 ) * 7;
// Podokonnik
if(PodokonnikType > 0) {
PodokLength = Val_b + Val_c;
PodokonnikSquareNPrc = ((PodokLength * PodokWidth) / 1000000 ) * 100;
if(PodokonnikType==1) AddSum = AddSum + PodokonnikSquareNPrc;
if(PodokonnikType==3) AddSum = AddSum + (PodokonnikSquareNPrc * ( WndWoodM3_Coof + 1) );
if(PodokonnikType==4) AddSum = AddSum + (PodokonnikSquareNPrc * ( WndWoodM4_Coof + 1) );
if(PodokonnikType==6) AddSum = AddSum + (PodokonnikSquareNPrc * ( WndWoodM6_Coof + 1) );
if(PodokonnikType==7) AddSum = AddSum + (PodokonnikSquareNPrc * ( WndWoodM7_Coof + 1) );
if(PodokonnikType==8) AddSum = AddSum + (PodokonnikSquareNPrc * ( WndWoodM8_Coof + 1) );
if(PodokonnikType==9) {
if(PodokWidth <= 200) AddSum = AddSum + (PodokPVH1_1 * ( PodokLength / 1000 ));
if((PodokWidth > 200) && (PodokWidth <= 250)) AddSum = AddSum + (PodokPVH1_2 * ( PodokLength / 1000 ));
if((PodokWidth > 250) && (PodokWidth <= 300)) AddSum = AddSum + (PodokPVH1_3 * ( PodokLength / 1000 ));
if((PodokWidth > 300) && (PodokWidth <= 350)) AddSum = AddSum + (PodokPVH1_4 * ( PodokLength / 1000 ));
if((PodokWidth > 350) && (PodokWidth <= 400)) AddSum = AddSum + (PodokPVH1_5 * ( PodokLength / 1000 ));
if((PodokWidth > 400) && (PodokWidth <= 450)) AddSum = AddSum + (PodokPVH1_6 * ( PodokLength / 1000 ));
if((PodokWidth > 450) && (PodokWidth <= 500)) AddSum = AddSum + (PodokPVH1_7 * ( PodokLength / 1000 ));
if(PodokWidth > 500) AddSum = AddSum + (PodokPVH1_8 * ( PodokLength / 1000 ));
}
if(PodokonnikType==10) {
if(PodokWidth <= 200) AddSum = AddSum + (PodokPVH2_1 * ( PodokLength / 1000 ));
if((PodokWidth > 200) && (PodokWidth <= 250)) AddSum = AddSum + (PodokPVH2_2 * ( PodokLength / 1000 ));
if((PodokWidth > 250) && (PodokWidth <= 300)) AddSum = AddSum + (PodokPVH2_3 * ( PodokLength / 1000 ));
if((PodokWidth > 300) && (PodokWidth <= 350)) AddSum = AddSum + (PodokPVH2_4 * ( PodokLength / 1000 ));
if((PodokWidth > 350) && (PodokWidth <= 400)) AddSum = AddSum + (PodokPVH2_5 * ( PodokLength / 1000 ));
if((PodokWidth > 400) && (PodokWidth <= 450)) AddSum = AddSum + (PodokPVH2_6 * ( PodokLength / 1000 ));
if((PodokWidth > 450) && (PodokWidth <= 500)) AddSum = AddSum + (PodokPVH2_7 * ( PodokLength / 1000 ));
if(PodokWidth > 500) AddSum = AddSum + (PodokPVH2_8 * ( PodokLength / 1000 ));
}
AddSum = AddSum + ( PodokLength / 1000 ) * 10;
}
// Alum oklad
if(AlumOklad==true) AddSum = AddSum + (ActualSquare * 125);
// Otkos
OtkosLength = Val_b + Val_c + (Val_a * 2);
var SubVal = 0;
if(OtkosType=='Plastic') SubVal = 1;
if(OtkosType=='PlasticC') SubVal = 2;
if(OtkosType=='Gips') SubVal = 3;
if(OtkosWidth > 0) {
var OMulti = eval('OtkosT' + SubVal + '_' + OtkosWidth);
AddSum = AddSum + (OtkosLength * OMulti / 1000);
}
// Mosquito web
ML_Square = LSquare; if(ML_Square < 1) ML_Square = 1;
MR_Square = RSquare; if(MR_Square < 1) MR_Square = 1;
if(MosquitoL==true) AddSum = AddSum + (ML_Square * Mosquete_CPS) + 5;
if(MosquitoR==true) AddSum = AddSum + (MR_Square * Mosquete_CPS) + 5;
// Mounting
if(Mounting==true) AddSum = AddSum + (ActualSquare * Mounting_CPS);
// alert('LSquare=' + LSquare + '; CSquare=' + CSquare + '; RSquare=' + RSquare);
// alert('AddSum=' + AddSum + '; Coof=' + AddCooficient);
// Cooficents
WTypeSum = WTypeSum * AddCooficient;
csum.innerText=Math.round(WTypeSum + AddSum)+1;
csss.innerText=(Math.round((ActualSquare)*100))/100;
}
</script>