/* sezione stock */
function MostraPrezzo(prezzo1,prezzo2,prezzo3,immagine,immagine2,immagine3){
document.getElementById("price1").innerHTML = "€ " + prezzo1;
document.getElementById("price1_value").value = prezzo1;
document.getElementById("price2").innerHTML = "€ " + prezzo2;
document.getElementById("price2_value").value= prezzo2;
document.getElementById("price3").innerHTML = "€ " + prezzo3;
document.getElementById("price3_value").value = prezzo3;
if(immagine !='' ) document.getElementById("immagine").innerHTML = '
';
if(immagine2 !='' ) document.getElementById("immagine2").innerHTML = '
';
if(immagine3 !='' ) document.getElementById("immagine3").innerHTML = '
';
if(document.forms[0].prezzo_scelto[0].checked===true) MostraPrezzoScelto(1);
if(document.forms[0].prezzo_scelto[1].checked===true) MostraPrezzoScelto(2);
if(document.forms[0].prezzo_scelto[2].checked===true) MostraPrezzoScelto(3);
}
function DisabilitaCampi(campo1,campo2){
var elemts = document.getElementById('step1').elements;
for ( var i = 0; i < elemts.length; i++ ) {
if ( /^radio$/.test(elemts[i].type) ) {
if(elemts[i].name=='prezzo_scelto' && elemts[i].checked===true){
var idx=campo1;++idx;
var idx2=campo2;++idx2;
var idx3=elemts[i].value;
document.step1.prezzo_scelto[campo1].checked=false;
document.step1.prezzo_scelto[campo2].checked=false;
document.getElementById("id_hd_ponti_"+idx).disabled=true;
document.getElementById("id_hd_ponti_"+idx2).disabled=true;
document.getElementById("id_hd_ponti_"+idx3).disabled=false;
document.getElementById("id_hd_meccaniche_"+idx).disabled=true;
document.getElementById("id_hd_meccaniche_"+idx2).disabled=true;
document.getElementById("id_hd_meccaniche_"+idx3).disabled=false;
document.getElementById("id_hd_mascherine_"+idx).disabled=true;
document.getElementById("id_hd_mascherine_"+idx2).disabled=true;
document.getElementById("id_hd_mascherine_"+idx3).disabled=false;
document.getElementById("id_hd_pickup_"+idx).disabled=true;
document.getElementById("id_hd_pickup_"+idx2).disabled=true;
document.getElementById("id_hd_pickup_"+idx3).disabled=false;
document.getElementById("id_finishing_"+idx).disabled=true;
document.getElementById("id_finishing_"+idx2).disabled=true;
document.getElementById("id_finishing_"+idx3).disabled=false;
}
}
}
}
function MostraPrezzoScelto(idx){
document.getElementById("prezzo_scelto_value").value = document.getElementById("price"+idx+"_value").value;
document.getElementById("show_totale_configurazione").innerHTML = 'TOTALE € ' + document.getElementById("prezzo_scelto_value").value +'';
}
function AssegnaCodice(codice){
document.getElementById("codice_configurazione").value = codice;
}
function checkPonti(){
if( http_a.readyState == 4 ) {
var a = new Array();
var b = new Array();
var c = new Array();
eval(http_a.responseText);
resetCombo(document.forms[0].name, 'id_hd_ponti_1');
buildCombo(document.forms[0].name, 'id_hd_ponti_1', a);
resetCombo(document.forms[0].name, 'id_hd_ponti_2');
buildCombo(document.forms[0].name, 'id_hd_ponti_2', b);
resetCombo(document.forms[0].name, 'id_hd_ponti_3');
buildCombo(document.forms[0].name, 'id_hd_ponti_3', c);
http_a = null;
}
}
function loadPonti(idmodello) {
if(idmodello != ''){
http_a = createRequestObject();
http_a.onreadystatechange = checkPonti;
http_a.open("GET", 'ajax/ajax_stock_ponti.php?idmodello=' + idmodello);
http_a.send(null);
}
}
function resetPonti(){
resetCombo(document.forms[0].name, 'id_hd_ponti_1');
resetCombo(document.forms[0].name, 'id_hd_ponti_2');
resetCombo(document.forms[0].name, 'id_hd_ponti_3');
}
function checkPickup(){
if( http_pu.readyState == 4 ) {
var a = new Array();
var b = new Array();
var c = new Array();
eval(http_pu.responseText);
resetCombo(document.forms[0].name, 'id_hd_pickup_1');
buildCombo(document.forms[0].name, 'id_hd_pickup_1', a);
resetCombo(document.forms[0].name, 'id_hd_pickup_2');
buildCombo(document.forms[0].name, 'id_hd_pickup_2', b);
resetCombo(document.forms[0].name, 'id_hd_pickup_3');
buildCombo(document.forms[0].name, 'id_hd_pickup_3', c);
http_pu = null;
}
}
function loadPickup(idmodello) {
if(idmodello != ''){
http_pu = createRequestObject();
http_pu.onreadystatechange = checkPickup;
http_pu.open("GET", 'ajax/ajax_stock_pickup.php?idmodello=' + idmodello);
http_pu.send(null);
}
}
function resetPickup(){
resetCombo(document.forms[0].name, 'id_hd_pickup_1');
resetCombo(document.forms[0].name, 'id_hd_pickup_2');
resetCombo(document.forms[0].name, 'id_hd_pickup_3');
}
function checkMeccaniche(){
if( http_mec.readyState == 4 ) {
var a = new Array();
var b = new Array();
var c = new Array();
eval(http_mec.responseText);
resetCombo(document.forms[0].name, 'id_hd_meccaniche_1');
buildCombo(document.forms[0].name, 'id_hd_meccaniche_1', a);
resetCombo(document.forms[0].name, 'id_hd_meccaniche_2');
buildCombo(document.forms[0].name, 'id_hd_meccaniche_2', b);
resetCombo(document.forms[0].name, 'id_hd_meccaniche_3');
buildCombo(document.forms[0].name, 'id_hd_meccaniche_3', c);
http_mec = null;
}
}
function loadMeccaniche(idmodello) {
if(idmodello != ''){
http_mec = createRequestObject();
http_mec.onreadystatechange = checkMeccaniche;
http_mec.open("GET", 'ajax/ajax_stock_meccaniche.php?idmodello=' + idmodello);
http_mec.send(null);
}
}
function resetMeccaniche(){
resetCombo(document.forms[0].name, 'id_hd_meccaniche_1');
resetCombo(document.forms[0].name, 'id_hd_meccaniche_2');
resetCombo(document.forms[0].name, 'id_hd_meccaniche_3');
}
function checkMascherine(){
if( http_mas.readyState == 4 ) {
var a = new Array();
var b = new Array();
var c = new Array();
eval(http_mas.responseText);
resetCombo(document.forms[0].name, 'id_hd_mascherine_1');
buildCombo(document.forms[0].name, 'id_hd_mascherine_1', a);
resetCombo(document.forms[0].name, 'id_hd_mascherine_2');
buildCombo(document.forms[0].name, 'id_hd_mascherine_2', b);
resetCombo(document.forms[0].name, 'id_hd_mascherine_3');
buildCombo(document.forms[0].name, 'id_hd_mascherine_3', c);
http_mas= null;
}
}
function loadMascherine(idmodello) {
if(idmodello != ''){
http_mas = createRequestObject();
http_mas.onreadystatechange = checkMascherine;
http_mas.open("GET", 'ajax/ajax_stock_mascherine.php?idmodello=' + idmodello);
http_mas.send(null);
}
}
function resetMascherine(){
resetCombo(document.forms[0].name, 'id_hd_meccaniche_1');
resetCombo(document.forms[0].name, 'id_hd_meccaniche_2');
resetCombo(document.forms[0].name, 'id_hd_meccaniche_3');
}
function checkTestoStock(){
if( http_stock.readyState == 4 ) {
eval(http_stock.responseText);
document.getElementById("testostock").innerHTML = testoStock;
http_stock = null;
}
}
function loadTestoStock( id ) {
if(id != ''){
http_stock = createRequestObject();
http_stock.onreadystatechange = checkTestoStock;
http_stock.open("GET", 'ajax/ajax_testo_stock.php?id=' + id);
http_stock.send(null);
}
}