/***** init section, begin *****/
$(document).ready(
    function() {
        step7Init();
    }
    );


function step7Init()
{
    step7BindEvents();
}

function step7BindEvents()
{
    
}

function verifyStep7()
{
    //debugLog("verifyStep6");
    return true;
}

function goStep7()
{
    var params = {
        "opinion_estimate" : $('input:radio[name=opinion_estimate]:checked').val(),
        "comments_estimate": $("#comments_estimate").val(),
        "data_format" : 'json',
        "step" : 7
    };
    var submitUrl;

    //showBlockUILoading("#eurotax_valuation_form" );

    submitUrl = BASE_URL + "eurotax/goStep7";

    $.ajax({
        url: submitUrl,
        global: true,
        type: "GET",
        data: params,
        dataType: "json",
        success: function(jsonData){
            goStep7CallBack(jsonData);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown){
            //debugLog("goStep6 Error: " + $(this).dump()); // the options for this ajax request
        }
    });
    
    
}

function goStep7CallBack(jsonData)
{
    if (jsonData.info.status == operationStatus.Error) 
    {
        $("#step6_content").html('<br><p>'+jsonData.info.error_info+'</p>');
    } 
    else 
    {    	
    	if(jsonData['opinion_estimate'] != 'nettement-inferieure' || $("#verif_step").val() == 0){
    		$("#title_good_estimate").show();
    		$("#message_good_estimate").hide();    		
    		$("#title_bad_estimate").hide();    		
    		$("#message_bad_estimate").hide();
    		$("#message_rdv_bad_estimate").hide();
    		$("#help_estimate").hide(); 
    		$("#message_cotisation_300").hide(); 
            $("#expertise").show();
    	} else {
    		$("#title_good_estimate").hide();
    		$("#message_good_estimate").hide();    		
    		$("#title_bad_estimate").show();    		
    		$("#message_bad_estimate").show();
    		$("#message_rdv_bad_estimate").show();
    		$("#help_estimate").show();
    		$("#message_cotisation_300").hide(); 
            $("#expertise").hide();
    	}
        
        //trackConfirmation();
        showStepForm(formStatus.currentStep);
    }    
    
    $("#step_form_btn").hide();
    
    hideBlockUI("#eurotax_valuation_form");
}
