var LAUNCH_PSO_ASSESSOR = false;
var LAUNCH_RA_ASSESSOR = false;
var symptom_assess_init = function()
{
    //alert("symptom_assess_init LAUNCH_PSO_ASSESSOR : " + LAUNCH_PSO_ASSESSOR);
    //alert("symptom_assess_init LAUNCH_RA_ASSESSOR : " + LAUNCH_RA_ASSESSOR);
    $("a.symp_assess_launch").click(launch_assessor);
    if(LAUNCH_PSO_ASSESSOR) launch_pop('psoriasis');
    if(LAUNCH_RA_ASSESSOR) launch_pop('rheumatoid-arthritis');
}


var launch_assessor = function(event)
{
    //alert('from a button click this.id : ' +  this.id);
    switch(this.id)
    {
        case "symptom_assessor_ra":
            file_path = SITEROOT + "/symptom-assessors/rheumatoid-arthritis/";
            mainSymptomAssessorTrack('launch', '', 'ra');
            break;
        case "symptom_assessor_psa":
            file_path = SITEROOT + "/symptom-assessors/psoriatic-arthritis/";
            mainSymptomAssessorTrack('launch', '', 'psa');
            break;
        case "symptom_assessor_pso":
            file_path = SITEROOT + "/symptom-assessors/psoriasis/";
            mecTrack('deienb_NEWEnbrelSymptomProfile_6');
            mainSymptomAssessorTrack('launch', '', 'pso');
            break;        
        default:
            file_path = "";
    }
    popwin(file_path);
}

var launch_pop = function(condi)
{
  //alert("launch_pop");
  file_path = SITEROOT + "/symptom-assessors/" + condi + "/";
  //alert("file_path :" + file_path + " condi : " +  condi);
  switch(condi)   {
        case "psoriasis":
            mecTrack('deienb_NEWEnbrelSymptomProfile_6');
            mainSymptomAssessorTrack('launch', '', 'pso');
            break;
        case "rheumatoid-arthritis":
            //mecTrack('deienb_NEWEnbrelSymptomProfile_6');
            //mainSymptomAssessorTrack('launch', '', 'pso');
            break;
    }
    popwin(file_path);
}

var popwin = function(fpath)
{
    if (!(newWin)) {
       if(( fpath.indexOf("psoriasis") != -1) || (fpath.indexOf("rheumatoid-arthritis") != -1)) {
        var newWin = window.open(fpath + "main.jspx","assessor_window","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600");
        newWin.moveTo((screen.availWidth - 800) / 2, (screen.availHeight - 600) / 2);
       } else {
        //temporary
        var newWin = window.open(fpath + "main.html","assessor_window","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600");
        newWin.moveTo((screen.availWidth - 800) / 2, (screen.availHeight - 600) / 2);
       }
    }
}


jQuery().ready(symptom_assess_init); 

