var configuratorData={initial:{imgSrc:F6.CONTEXT+"/img/demo/packInitial_sm.png",imgAlt:"pack Initial",pxPoste:29,forfaitTxt:"OPTION FORFAIT __duree__H VERS MOBILES POUR TOUTES VOS LIGNES FIXES","0":0,"4h":31.2,"6h":46.8,"8h":62.4,"10h":78,"12h":93.6,"16h":124.8,"20h":156,"30h":234,ligneDefaultText:"<span class='txtGrey2'>LIGNE SUPPL&Eacute;MENTAIRE</span>",fax:"LIGNE FAX",tpe:"LIGNE TPE",alarm:"LIGNE ALARME",autre:"AUTRE",autreLigneTxt:"",pxLigne:17.3},intensif:{imgSrc:F6.CONTEXT+"/img/demo/packIntensif_sm.png",imgAlt:"pack Intensif",pxPoste:59,forfaitTxt:"APPELS ILLIMIT&Eacute;S VERS MOBILES TOUS OP&Eacute;RATEURS",ligneDefaultText:"<span class='txtGrey2'>LIGNE SUPPL&Eacute;MENTAIRE</span>",fax:"LIGNE FAX",tpe:"LIGNE TPE",alarm:"LIGNE ALARME",autre:"AUTRE",pxLigne:17.3}};
function refreshConfigurator(){var B=QS2OBJ($("configurator").toQueryString());
var A=configuratorData[B.packTelephonie];
var C=74;
$("total_systemeCommunication").value=74;
if(!A){$("initial").checked=true;
$("initial").getParent("label").addClass("check");
$("forfait").selectedIndex=0;
A=configuratorData.initial
}if(!B.nbPostes){$("poste2").checked=true;
$("poste2").getParent("label").addClass("check");
B=QS2OBJ($("configurator").toQueryString())
}if(!B.fax1){$("fax1").checked=true;
$("fax1").getParent("label").addClass("check");
B=QS2OBJ($("configurator").toQueryString())
}$("packImg").src=A.imgSrc;
if(B.nbPostes.toInt()>=5){$("posteSupp").set("html",B.nbPostes.toInt()-3);
$("nbPostesFixes").set("html",B.nbPostes.toInt());
$("nbPosteSupp").set("html","3");
$("nbPosteSupp2").set("html",B.nbPostes.toInt())
}else{$("posteSupp").set("html","1");
$("nbPostesFixes").set("html",B.nbPostes.toInt());
$("nbPosteSupp").set("html",B.nbPostes.toInt()-1);
$("nbPosteSupp2").set("html",B.nbPostes.toInt())
}$("pxUnit").set("html",A.pxPoste.toInt());
$("prixOptionsTelFixe").set("html",A.pxPoste.toInt()*(B.nbPostes.toInt())+"<span>&euro; HT</span>");
C+=A.pxPoste.toInt()*(B.nbPostes.toInt());
$("total_pack").value=A.pxPoste.toInt()*(B.nbPostes.toInt()+1);
if(!B.ligne2){$("ligne2Txt").set("html",A.ligneDefaultText);
$("prixLigne2").set("html","<div class='txtGrey2'>{euros},<span>{cents}&euro; HT</span></div>".substitute(BOL_BT.Basket.splitPrice(A.pxLigne)));
$("total_ligne2").value=0
}else{$("ligne2Txt").set("html",A[B.ligne2]);
$("prixLigne2").set("html","{euros},<span>{cents}&euro; HT</span>".substitute(BOL_BT.Basket.splitPrice(A.pxLigne)));
C+=A.pxLigne;
$("total_ligne2").value=A.pxLigne
}if(!B.ligne3){$("ligne3Txt").set("html",A.ligneDefaultText);
$("prixLigne3").set("html","<div class='txtGrey2'>{euros},<span>{cents}&euro; HT</span></div>".substitute(BOL_BT.Basket.splitPrice(A.pxLigne)));
$("total_ligne3").value=0
}else{$("ligne3Txt").set("html",A[B.ligne3]);
$("prixLigne3").set("html","{euros},<span>{cents}&euro; HT</span>".substitute(BOL_BT.Basket.splitPrice(A.pxLigne)));
C+=A.pxLigne;
$("total_ligne3").value=A.pxLigne
}if(!B.ligne4){$("ligne4Txt").set("html",A.ligneDefaultText);
$("prixLigne4").set("html","<div class='txtGrey2'>{euros},<span>{cents}&euro; HT</span></div>".substitute(BOL_BT.Basket.splitPrice(A.pxLigne)));
$("total_ligne4").value=0
}else{$("ligne4Txt").set("html",A[B.ligne4]);
$("prixLigne4").set("html","{euros},<span>{cents}&euro; HT</span>".substitute(BOL_BT.Basket.splitPrice(A.pxLigne)));
C+=A.pxLigne;
$("total_ligne4").value=A.pxLigne
}switch(true){case B.packTelephonie=="initial":if(B.forfait==0){$("optionsTelFixeForfaitTxt").set("html","<span class='txtGrey2'>OPTION FORFAIT <br />VERS MOBILE NON-SELECTIONNE</span>");
$("prixOptionsTelFixeForfait").set("html","");
$("total_forfaitOption").value=0
}else{$("optionsTelFixeForfaitTxt").set("html",A.forfaitTxt.replace(/__duree__/,B.forfait.toInt()));
$("prixOptionsTelFixeForfait").set("html","{euros},<span>{cents}&euro; HT</span>".substitute(BOL_BT.Basket.splitPrice(A[B.forfait])));
$("total_forfaitOption").value=A[B.forfait]
}C+=A[B.forfait];
break;
case B.packTelephonie=="intensif":if(!$("prixOptionsTelFixeForfait").getElement("img")){$("prixOptionsTelFixeForfait").set("html",'<img height="18" alt="" src="'+F6.CONTEXT+'/img/demo/offert_sm.png" />')
}$("optionsTelFixeForfaitTxt").set("html",A.forfaitTxt);
break
}C=(C*100).toInt()/100;
$("prixTotal").set("html","{euros},<span>{cents}&euro;<br/>HT/mois</span>".substitute(BOL_BT.Basket.splitPrice(C)));
$("total_montant").value=C
}function QS2OBJ(C){if(!C){C=document.location.search
}if(C[0]=="?"){C=C.substring(1)
}var A=C.split("&");
var B={};
A.each(function(E,D){var F=E.split("=");
B[F[0]]=F[1]
});
return B
}addEvent("load",function(){$("configurator").getElements("input[type=radio]").addEvent("click",function(){refreshConfigurator()
});
$("configurator").getElements("select").addEvent("change",function(){refreshConfigurator()
});
refreshConfigurator()
});