function wizard_start () { var ajax = new Ajax.Request ( '1_kwp.php', { method: 'post', postBody: '', onComplete: load_step_handle, onLoading: load_step_loading_handle } ); } function load_step (step) { /* @DESCRIPTION: gestisce i vari step di input del wizard @PARAMS: step è il nome dello step corrente da gestire */ if ( step == "2_installazione" ) { if ( $F("taglia_impianto").length == 0 ) { alert("Specificare un valore per la taglia dell'impianto"); return false; } if ( isNaN($F("taglia_impianto")) ) { alert("E' necessario specificare un numero di kWp per l'impianto"); return false; } if ( $F("taglia_impianto") < 1 ) { alert("Potenza minima di impianto 1kWp"); return false; } variabili = "step=" + escape(step) + "&taglia_impianto=" + escape($F("taglia_impianto")); } if ( step == "step_input_modalita" ) { if ( $F("modalita").length == 0 ) return false; variabili = "step=" + escape(step) + "&modalita=" + escape($F("modalita")); } var ajax = new Ajax.Request ( 'step.php', { method: 'post', postBody: variabili, onComplete: load_step_handle, onLoading: load_step_loading_handle } ); } /* Gestione dell'input INSTALLAZIONE */ function load_step_installazione (valore) { if ( valore.length == 0 ) return false; variabili = "step=3_modalita" + "&posizionamento=" + escape(valore); var ajax = new Ajax.Request ( 'step.php', { method: 'post', postBody: variabili, onComplete: load_step_handle, onLoading: load_step_loading_handle } ); } /* Gestione dell'input MODALITA */ function load_step_modalita (valore) { if ( valore.length == 0 ) return false; variabili = "step=4_risultato" + "&modalita=" + escape(valore); var ajax = new Ajax.Request ( 'step.php', { method: 'post', postBody: variabili, onComplete: load_step_handle, onLoading: load_step_loading_handle } ); } /* Gestion del menu di navigazione */ function go_to_step (step) { if ( step.length == 0 ) return false; variabili = "step=" + step; var ajax = new Ajax.Request ( 'step.php', { method: 'post', postBody: variabili, onComplete: load_step_handle, onLoading: load_step_loading_handle } ); } /* Handle delle chiamate AJAX */ function load_step_loading_handle (request) { //Effect.Fade('container-wizard-acb'); } /* Handle delle chiamate AJAX */ function load_step_handle (request) { if ( request.responseText == "fail" ) { alert("ERRORE"); } else { $("container-wizard-acb").update(request.responseText); } }