function startInstall(data){

    if(!data){
        return;
    }
  
    if(!data['step']){
        data['step'] = 'unzip';
    
    }
    makePost('../install/install_011.php', data);
}

function makePost(url, data){

    data['action'] = 'getstartmsg';
    $.post({ 
        url: url,
        data: data,
        dataType: 'json'
    }).always(function(jsonData00) { 
        if(jsonData00 && jsonData00['ok']>=0){
            if( jsonData00['ok'] == 1){
                
                $( "#results>pre" ).append( jsonData00['msg']  );
                renderLoader();
                data['action'] = 'dostep' ;
                $.post({ 
                    url: url,
                    data: data,
                    dataType: 'json'
                }).always(function(jsonData) { 
                    clearLoader();
                    if(jsonData && jsonData['ok']>=0){
                        if( jsonData['ok'] == 1){ 
                            var pre = $("#results>pre");
                            pre.append( jsonData['msg']  );
                            

                            if( jsonData['next']){
                                data['step'] = jsonData['next'];
                                if(jsonData['cpfolder']){
                                    data['cpfolder'] = jsonData['cpfolder'];
                                }else{
                                    data['cpfolder'] = '';
                                }
                                if(jsonData['cpsubfolder']){
                                    data['cpsubfolder'] = jsonData['cpsubfolder'];
                                }else{
                                    data['cpsubfolder'] = '';
                                }

                                makePost(url, data);
                            }
        
                        }else{
                            alert(jsonData['msg']);
                            console.error(jsonData);
                        }
                    
                    }else{
                        console.error('Undefined Error'); 
                    }
                }); 
            }else{
                alert(jsonData00['msg']); 
            }
            
        }
       
    }); 
}

function renderLoader(){
    //#results
    $( '#results' ).append( 
        "<div class='loader'></div>" 
    );
}

function clearLoader(){
      //#results
    $( '#results .loader' ).remove();
}