
var SelectReportPresenter = function(){}

SelectReportPresenter.prototype={  
	LoadSummaryReport:function(source)
    {
        locationID = this.View.GetSelectedLocation(source);
        classificationID = this.View.GetSelectedClassification();        
        this.Model.SaveSettings(locationID, classificationID);
        this.Model.RetrieveSummaryReport(locationID, classificationID, source);       
        this.View.ShowHideLoadingPanel($get("defaultLoadingDiv"), loadingPanel, true);

        return false;
    },
 	OnLoadSummaryReportComplete:function( searchResults ) {
	if (searchResults.SubClassificationSummaries.length > 0) {
	    this.View.DisplaySummaryReport(searchResults);
    }
	    this.View.ShowHideLoadingPanel($get("defaultLoadingDiv"), loadingPanel, false);

  	},

	OnLoadSummaryReportFailed:function( errorType, errorMessage )
    {
        this.View.DisplayError(errorType, errorMessage);
        this.View.ShowHideLoadingPanel($get("defaultLoadingDiv"), loadingPanel, false);

    }, 
    
	LoadJobTitlesWithCount:function(locationID, subClassificationID)
    {    
        this.Model.RetrieveJobTitlesWithCount(locationID, subClassificationID);
    }, 
    
	OnLoadJobTitlesWithCountComplete:function( searchResults )  
    {
        this.View.DisplayJobTitlesWithCount(searchResults);
    },

	OnLoadJobTitlesWithCountFailed:function( errorType, errorMessage )
    {
        this.View.DisplayError(errorType, errorMessage);
    },
    
    LoadSubClassification:function(locationID, classificationID)
    {    
        this.Model.LoadSubClassification(locationID, classificationID);
        
    }, 
    
	OnLoadSubClassificationComplete:function( subClassificationResults )  
    {
        this.View.DisplaySubClassification(subClassificationResults);
    },

	OnLoadSubClassificationFailed:function( errorType, errorMessage )
    {
        this.View.DisplayError(errorType, errorMessage);
    }, 
    
    OnShowMoreTitles:function(id)
    {
        this.View.HideShowTitles('SummaryShort_' + id, 'none');
        this.View.HideShowTitles('SummaryFull_' + id, 'block');
    },      

    OnShowLessTitles:function(id)
    {
        this.View.HideShowTitles('SummaryShort_' + id, 'block');
        this.View.HideShowTitles('SummaryFull_' + id, 'none');
    },         
    
	Initialize:function()
    {
        this.View = new SelectReportView();
        this.Model = new SelectReportModel();        
        this.Model.Presenter = this;                
        this.View.Presenter = this;
      
        this.LoadSummaryReport('displayedcheck')
        this.View.GoInitialize();  
        
        this.Analytics = new SetOmniture();
        this.Analytics.View = this.View;
        this.Analytics.Initialize();
        this.Analytics.PayCheckReportHomeOmni();

    },
    
    Dispose:function()
    {                
        if (this.View == undefined)
            return;
        this.View.Dispose();
        this.View = new SelectReportView();
        this.Model = new SelectReportModel();        
        this.Model.Presenter = null;
        this.View.Presenter = null;               
    }

}
SelectReportPresenter.registerClass('SelectReportPresenter');

var selectReportPresenter = new SelectReportPresenter();
