$(document).ready(function(){
var scegli = '<option value="0">Scegli...</option>';
var attendere = '<option value="0">Attendere...</option>';
$("select#Diametro").html(scegli);
$("select#Diametro").attr("disabled", "disabled");
$("select#TipoSupporto").html(scegli);
$("select#TipoSupporto").attr("disabled", "disabled");
$("select#TipoLamiera").html(scegli);
$("select#TipoLamiera").attr("disabled", "disabled");
$("select#TipoPavimenti").html(scegli);
$("select#TipoPavimenti").attr("disabled", "disabled");
$("select#volvenza").html(scegli);
$("select#volvenza").attr("disabled", "disabled");
$("select#TipoRuota").html(scegli);
$("select#TipoRuota").attr("disabled", "disabled");
$("select#Portata").html(scegli);
$("select#Portata").attr("disabled", "disabled");
$("select#SerieSupporti").html(scegli);
$("select#SerieSupporti").attr("disabled", "disabled");
$("select#applicazione").change(function(){ SelezionaTabelle(); });
$("select#comeRuota").change(function(){ SelezionaTabelle(); });
$("select#Diametro").change(function(){ ContaRecords() });
$("select#TipoSupporto").change(function(){ ContaRecords() });
$("select#TipoLamiera").change(function(){ ContaRecords() });
$("select#volvenza").change(function(){ ContaRecords() });
$("select#TipoRuota").change(function(){ ContaRecords() });
$("select#Portata").change(function(){ ContaRecords() });
$("select#SerieSupporti").change(function(){ ContaRecords() });
function SelezionaTabelle()
{
var applic = $("select#applicazione option:selected").attr('value');
var comeR = $("select#comeRuota option:selected").attr('value');
// applicazione non scelto è di default Collettività
// comeruota non scelta è di default Ruota montata
if(applic==0) {applic=1}; if(comeR==0) {comeR=3};
var lang = 'it';
loadXMLDoc('select#Diametro', 'Diametro', applic, comeR, lang);
loadXMLDoc('select#TipoSupporto', 'Supporto', applic, comeR, lang);
loadXMLDoc('select#TipoLamiera', 'Lamiera', applic, comeR, lang);
loadXMLDoc('select#TipoPavimenti', 'Pavimenti', applic, comeR, lang);
loadXMLDoc('select#volvenza', 'Volvenza', applic, comeR, lang);
loadXMLDoc('select#TipoRuota', 'Ruota', applic, comeR, lang);
loadXMLDoc('select#Portata', 'Portata', applic, comeR, lang);
loadXMLDoc('select#SerieSupporti', 'SerieSup', applic, comeR, lang);
ContaRecords();
return;
}
function loadXMLDoc(form_tag, funzione, applic, comeR, lang)
{
var xmlhttp;
$(form_tag).html(attendere);
$(form_tag).attr("disabled", "disabled");
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
$(form_tag).removeAttr("disabled");
$(form_tag).html(xmlhttp.responseText);
}
}
xmlhttp.open("POST","characteristics.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send
(
"funzione=" + funzione
+ "&id=" + applic
+ "&id2=" + comeR
+ "&lng=" + lang
);
}
function ContaRecords() {
var applic = $("select#applicazione option:selected").attr('value');
var comeR = $("select#comeRuota option:selected").attr('value');
var v_dmt = $("select#Diametro option:selected").attr('value');
var v_suppt = $("select#TipoSupporto option:selected").attr('value');
var v_lamier = $("select#TipoLamiera option:selected").attr('value');
var v_vol = $("select#volvenza option:selected").attr('value');
var v_Ruot = $("select#TipoRuota option:selected").attr('value');
var v_por = $("select#Portata option:selected").attr('value');
var v_seriesup = $("select#SerieSupporti option:selected").attr('value');
var v_pavt = $("select#TipoPavimenti option:selected").attr('value');
//var t_applic = $("select#applicazione option:selected").text();
//var t_comeR = $("select#comeRuota option:selected").text();
//var t_dmt = $("select#Diametro option:selected").text();
//var t_suppt = $("select#TipoSupporto option:selected").text();
//var t_lamier = $("select#TipoLamiera option:selected").text();
//var t_vol = $("select#volvenza option:selected").text();
//var t_Ruot = $("select#TipoRuota option:selected").text();
//var t_por = $("select#Portata option:selected").text();
//var t_seriesup = $("select#SerieSupporti option:selected").text();
//var t_pavt = $("select#TipoPavimenti option:selected").text();
if(applic==0) {applic=1}; if(comeR==0) {comeR=3};
var xmlhttp;
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); }
else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
$("#result").html(xmlhttp.responseText);
}
}
xmlhttp.open("POST","elementscount.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send
(
"id=" + applic
+ "&id2=" + comeR
+ "&dmt=" + v_dmt
+ "&suppt=" + v_suppt
+ "&lamier=" + v_lamier
+ "&vol=" + v_vol
+ "&Ruot=" + v_Ruot
+ "&por=" + v_por
+ "&seriesup=" + v_seriesup
+ "&pavt=" + v_pavt
//+ "&tid=" + t_applic
//+ "&tid2=" + t_comeR
//+ "&tdmt=" + t_dmt
//+ "&tsuppt=" + t_suppt
//+ "&tlamier=" + t_lamier
//+ "&tvol=" + t_vol
//+ "&tRuot=" + t_Ruot
//+ "&tpor=" + t_por
//+ "&tseriesup=" + t_seriesup
//+ "&tpavt=" + t_pavt
);
}
});