var Config =
{
    ApplicationRoot: '/',
    Platform: 'dotnet',
    WebServiceBaseClass: function() {       
        return (Config.Platform.toLowerCase() == "java") ? new JavaWebService() : new DotNetWebService();
    },
    Content:
    {
        Location: '/content',
        Extension: '.html'
    },
    BlockUI:
    {
        LoadingMessage  : "Loading...",
        MessageTemplate : "",//'<div class="ajaxLoaderBlockUI" style="margin:0 auto;background:#fff;width:600px;height:80px;text-align:center;"><div style="height:30px;width:580px;margin:0 auto;padding-top:10px;text-align:center;"><img src="js/lib/images/ajax-loader-blue.gif" alt="Loading..." border="0"/></div><div style="height:30px;text-align:center; color:#5177B3; font:9pt Arial; font-weight:bold; white-space: nowrap; margin:5px; padding:5px;">%%MESSAGE%%</div></div>',
        Options : 
        {
            overlayCSS: 
            { 
                backgroundColor: '#fff',
                opacity: '0' 
            },
            css: 
            { 
                width: '600px',
                height: '80px',
                border: 'none', 
                padding: '15px', 
                backgroundColor: 'gray', 
                '-webkit-border-radius': '10px',
                '-moz-border-radius' : '10px',
                opacity: '.5', 
                color: '#fff' 
            },
            centerY: false
        }
    },
    SiteTemplate:
    {
        URL: '/templates/template.html',
        TemplateContainerId: '#application',
        ContentContainerId: '#content',
        DetailURL: '/templates/template-detail.html',
        TemplateDetailContainerId: '#applicationDetail',
        ContentDetailContainerId: '#contentDetail'
    },
    Print: {
    	TemplateLocation : '/content/print.html',
	    Token: '<!-- PRINT TOKEN -->',
	    PrintContentHTML: function(htmlString,windowName, windowAttr,callback) {
			var windowName = windowName || '';
			var windowAttr = windowAttr || '';
			$.ajax
		     ({
		           type: 'GET',
		            url: Config.Print.TemplateLocation,
		       dataType: 'html',
		    contentType: 'text/html',
		        success: function(html)
		                 {
			                var w = window.open('print.html',windowName,windowAttr);
		                 	html = html.replace(Config.Print.Token,htmlString);
							w.document.open("text/html", "replace");
				            w.document.write(html);
				            w.document.close();
				            w.focus();
							w.document.getElementById('printContainer').style.visibility = 'visible';
		
							if (callback) { callback(); }
		                 }                         
		      });
		}
    },
	Analytics: {
		Enabled: true,
		Interval: 0,
        Client: 'BCBSSC',
        Version: 'EPD 3.0 phase 4.2'
	},
    Application_Loaded: function() {
        //MV.Page.RequireScript("/js/lib/medvantage/framework.debug.js");
        MV.Page.RequireScript("/js/lib/jquery/min/jquery-blockui-2.0.min.js");
        MV.WebServices.Add("Strings", "/js/lib/medvantage/webservice-strings.js", Config.ApplicationRoot + 'strings.asmx');
        MV.WebServices.Add("EPD", "/js/webservice-epd.js", Config.ApplicationRoot + 'webservice.asmx');

        // Only instantiate the Analytics object if analytics are enabled.
        if (Config.Analytics && Config.Analytics.Enabled) {
            MV.WebServices.Add('Analytics', '/js/analytics/webservice.js', Config.ApplicationRoot + 'analytics.asmx', function () {
                MV.Analytics = new AnalyticsEngine();
                MV.Analytics.Start();
                // Track the start of the session.
                var event = new ApplicationLoadEvent();
                event.SetSecureStatus(isSecurePath());
                event.SetClientReferrerCode(getBaseReferrerCode());
                MV.Analytics.TrackEvent(event);
            });
        }
    },
    Page_BeforeLoad: function(pageName) {
        //if (console) { console.log("Page Before Loaded: " + pageName); }
        
        MV.Page.Name = pageName.toLowerCase();
        
    },
    Page_Loaded: function(pageName) {
        //if (console) { console.log("Page Loaded: " + pageName); }
    }
};


var EPDConfig = {
    providerTypes: {
        'P000': {
            id: 'practitioner',
            controlType: 'practitioner',
            groupCode: 'G000',
            hospitalCode: 'H000',
            isPrimaryTypeForGroup: true
        },
        'G000': {
            id: 'grouppractice',
            controlType: 'office',
            providerCode: 'P000'
        },
        'H000': {
            id: 'hospital',
            controlType: 'hospital',
            providerCode: 'P000'
        },
        'F000': {
            id: 'otherfacility',
            controlType: 'other',
            groupCode: 'G000',
            hospitalCode: 'H000'
        },
        'BP00': {
            id: 'behavioralpractitioners',
            controlType: 'other',
            groupCode: 'BG00',
            hospitalCode: 'H000',
            isPrimaryTypeForGroup: true
        },
        'BG00': {
            id: 'behavioraloffices',
            controlType: 'office',
            providerCode: 'BP00'
        },
        'BF00': {
            id: 'behavioralfacility',
            controlType: 'hospital',
            providerCode: 'BP00'
        },
        'D000': {
            id: 'dental',
            controlType: 'other',
            providerCode: 'D000',
            groupCode: 'G000',
            hospitalCode: 'H000'
        },
        'V000': {
            id: 'vision',
            controlType: 'other',
            providerCode: 'V000',
            groupCode: 'G000',
            hospitalCode: 'H000'
        },
        'PH00': {
            id: 'pharmacy',
            controlType: 'other',
            groupCode: 'G000',
            hospitalCode: 'H000'
        },
        'NB00': {
            id: 'naturalblue',
            controlType: 'other',
            groupCode: 'G000',
            hospitalCode: 'H000'
        },
        'N_P000': {
            id: 'national_practitioner',
            controlType: 'other',
            groupCode: 'N_G000',
            hospitalCode: 'N_H000',
            isPrimaryTypeForGroup: true
        },
        'N_H000': {
            id: 'national_hospital',
            controlType: 'hospital',
            providerCode: 'N_P000'
        },
        'N_G000': {
            id: 'national_offices',
            controlType: 'office',
            providerCode: 'N_P000'
        },
        'N_F000': {
            id: 'national_otherfacility',
            controlType: 'other',
            groupCode: 'N_G000',
            hospitalCode: 'N_H000'
        }
    },

    qualityDataTables: {
        headings: {
            primary: {
                HospitalScore: {
                    label: 'Hospital Score',
                    hoverHelp: null
                },
                StateBenchmark: {
                    label: 'State Benchmark',
                    hoverHelp: 'The 90th percentile for all reporting hospitals in South Carolina'
                },
                StateAverage: {
                    label: 'State Average',
                    hoverHelp: 'The average for all reporting hospitals in South Carolina'
                },
                NationalAverage: {
                    label: 'National Average',
                    hoverHelp: 'The average for all reporting hospitals in the United States'
                },
                MedicalServicesHeader: {
                    label: 'Medical Services'
                },
                SurgicalCareHeader: {
                    label: 'Surgical Care'
                },
                MortalityHeader: {
                    label: 'Mortality and Re-admission'
                },
                PatientExperienceHeader: {
                    label: 'Patient Experience'
                },
                QualityIndicator: {
                    label: 'Quality Indicator'
                },
                DeathRate: {
                    label: 'Death Rate',
                    hoverHelp: 'The mortality experience (death rate) for certain illnesses and procedures'
                },
                VolumeCount: {
                    label: 'Volume Count',
                    hoverHelp: 'The number of admissions in which these services were performed'
                },
                UtilizationRate: {
                    label: 'Utilization Rate',
                    hoverHelp: 'The number of times a hospital performs a specific procedure on a specific targeted population. Research has shown that these types of procedures are sometimes overused and others are not used enough'
                }
            },
            national: {
                HospitalScore: {
                    label: 'Hospital Score',
                    hoverHelp: null
                },
                StateAverage: {
                    label: 'State Average',
                    hoverHelp: 'The average for all reporting hospitals in the state'
                },
                NationalAverage: {
                    label: 'National Average',
                    hoverHelp: 'The average for all reporting hospitals in the United States.  Data is not available for Surgical Infection Prevention and Medical Services Optimal Care Measures.'
                },
                Top10Percentile: {
                    label: 'Top 10 Percentile',
                    hoverHelp: null
                },
                MedicalServicesHeader: {
                    label: 'Medical Services'
                },
                SurgicalCareHeader: {
                    label: 'Surgical Care'
                },
                MortalityHeader: {
                    label: 'Mortality and Re-admissions'
                },
                PatientExperienceHeader: {
                    label: 'Patient Experience'
                }
            }
        },
        types: {
            'Profile': {
                code: 1,
                columns: [{ Name: 'HospitalScore', DataType: 'percent' }, { Name: 'StateBenchmark', DataType: 'percent' }, { Name: 'StateAverage', DataType: 'percent'}],
                columnProfile: 'threeColumn'
            },
            'Medical Services': {
                code: 2,
                columns: [{ Name: 'MedicalServicesHeader', DataType: 'string' }, { Name: 'HospitalScore', DataType: 'percent' }, { Name: 'StateBenchmark', DataType: 'percent' }, { Name: 'StateAverage', DataType: 'percent' }, { Name: 'NationalAverage', DataType: 'percent'}],
                nationalColumns: [{ Name: 'MedicalServicesHeader', DataType: 'string' }, { Name: 'HospitalScore', DataType: 'percent' }, { Name: 'StateAverage', DataType: 'percent' }, { Name: 'NationalAverage', DataType: 'percent' }, { Name: 'Top10Percentile', DataType: 'percent'}],
                columnProfile: 'fiveColumn'
            },
            'Surgical Care': {
                code: 3,
                columns: [{ Name: 'SurgicalCareHeader', DataType: 'string' }, { Name: 'HospitalScore', DataType: 'percent' }, { Name: 'StateBenchmark', DataType: 'percent' }, { Name: 'StateAverage', DataType: 'percent'}],
                nationalColumns: [{ Name: 'SurgicalCareHeader', DataType: 'string' }, { Name: 'HospitalScore', DataType: 'percent' }, { Name: 'StateAverage', DataType: 'percent' }, { Name: 'NationalAverage', DataType: 'percent' }, { Name: 'Top10Percentile', DataType: 'percent'}],
                columnProfile: 'fiveColumn'

            },
            'Mortality and Readmissions': {
                code: 4,
                columns: [{ Name: 'MortalityHeader', DataType: 'string' }, { Name: 'HospitalScore', DataType: 'percent'}],
                columnProfile: 'twoColumn'
            },
            'Patient Experience': {
                code: 5,
                columns: [{ Name: 'PatientExperienceHeader', DataType: 'string' }, { Name: 'HospitalScore', DataType: 'percent' }, { Name: 'StateAverage', DataType: 'percent' }, { Name: 'NationalAverage', DataType: 'percent'}],
                columnProfile: 'fourColumn'
            },
            'Mortality Rates': {
                code: 6,
                columns: [{ Name: 'QualityIndicator', DataType: 'string' }, { Name: 'StateAverage', DataType: 'decimal' }, { Name: 'DeathRate', DataType: 'string' }],
                columnProfile: 'threeColumn'
            },
            'Utilization Rates': {
                code: 7,
                columns: [{ Name: 'QualityIndicator', DataType: 'String' }, { Name: 'UtilizationRate', DataType: 'percent'}],
                columnProfile: 'twoColumn'
            }
        }
    }
};
