function keepToolTipOpen() { // $("#tooltip_container").css('display','block'); } /* ------------------------------------------------------------------ */ function showToolTip(id, width, text, offsetLeft, offsetTop) { var offset = $("#"+id).offset(); var posFromLeft = Math.floor(offset.left); posFromLeft = parseInt(posFromLeft) + parseInt(offsetLeft); var posFromTop = Math.floor(offset.top); posFromTop = parseInt(posFromTop) + parseInt(offsetTop); var cssObj = { 'position' : 'absolute', 'top' : posFromTop+'px', 'left' : posFromLeft+'px', 'display' : 'block', 'width' : width+'px' } //setTimeout(function(){ $("#tooltip_container").css(cssObj); $("#tooltip_text").html(text); // },1000) } /* ------------------------------------------------------------------ */ function hideToolTip() { $("#tooltip_container").css('display','none'); $("#tooltip_text").html(''); } /* ------------------------------------------------------------------ */ function updatePosition() { } /* ------------------------------------------------------------------ */ function togglePossibleConditionsHiddenContainer() { $("#possible_conditions_hidden_container").slideToggle(); var visible = $("#possible_conditions_hidden_container").css('display'); var handle_text = $("#possible_conditions_toggle_handle").html(); var n=handle_text.indexOf("expand"); if (n==0) { var handle_text2 = $("#possible_conditions_toggle_handle").html(); $("#possible_conditions_nb_results").html(handle_text2); $("#possible_conditions_toggle_handle").html("collapse"); } else { var handle_text2 = $("#possible_conditions_nb_results").html(); $("#possible_conditions_toggle_handle").html(handle_text2); } } /* ------------------------------------------------------------------ */ function reloadListOfSymptoms() { hideToolTip(); var inclusions_content = $("#inclusions").html(); var exclusions_content = $("#exclusions").html(); //alert('INC = '+inclusions_content+' ||| EXC = '+exclusions_content); if ((inclusions_content=='Please choose a symptom...') && (exclusions_content=='Please choose a symptom...')) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'reloadDefaultList'}, dataType: "html" }); request.done(function(msg) { $("#symptoms_checker_search_results").html( msg ); }); } else { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'reloadListWithSymptomsFromConditionsHavingIncludedSymptoms'}, dataType: "html" }); request.done(function(msg) { $("#symptoms_checker_search_results").html( msg ); }); } } /* ------------------------------------------------------------------ */ function submitSymptomSearch() { hideToolTip(); var term = $("#symptoms_list_header2_input").val(); if (term=='Symptom...') { $("#symptoms_checker_search_results").html('
'); var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'reloadDefaultList'}, dataType: "html" }); request.done(function(msg) { $("#symptoms_checker_search_results").html( msg ); }); } else { $("#symptoms_checker_search_results").html('
'); $("#symptom_checker_search_icon") .attr('src','/images/symptoms_checker_search_icon_x.jpg') .removeAttr('onclick') .attr('onclick','removeSymptomSearch()'); var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'searchSymptoms', term: term}, dataType: "html" }); request.done(function(msg) { $("#symptoms_checker_search_results").html( msg ); }); } } /* ------------------------------------------------------------------ */ function removeSymptomSearch() { hideToolTip(); $("#symptoms_list_header2_input").val('Symptom...'); $("#symptom_checker_search_icon") .attr('src','/images/symptoms_checker_search_icon.jpg') .removeAttr('onclick') .attr('onclick','submitSymptomSearch()'); submitSymptomSearch(); } /* ------------------------------------------------------------------ */ function checkIfEnterPressed(e) { var term = $("#symptoms_list_header2_input").val(); if (term!='') { if (e.keyCode == 13) { submitSymptomSearch(); } } else { if (e.keyCode == 13) { removeSymptomSearch(); } } } /* ------------------------------------------------------------------ */ function onblurSymptomSearch() { var term = $("#symptoms_list_header2_input").val(); if (term=='') { $("#symptoms_list_header2_input").val('Symptom...'); } } /* ----------------------------------------------------------------------------------------- */ function onfocusSymptomSearch() { var term = $("#symptoms_list_header2_input").val(); if (term=='Symptom...') { $("#symptoms_list_header2_input").val(''); } } /* ------------------------------------------------------------------ */ function loadPossibleConditions() { hideToolTip(); $("#possible_conditions").html('
'); var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: { action : 'loadPossibleConditions' }, dataType: "html" }); request.done(function(msg) { $("#possible_conditions").html( msg ); window.scrollTo(0,0); }); } /* ------------------------------------------------------------------ */ function symptomAddToList(id) { hideToolTip(); var excluded = "#excluded_symptom_"+id; if ($(excluded).length==1) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'removeExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'includeSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $(excluded).remove(); var exclusions_content = $("#exclusions").html(); if (exclusions_content=='') { $("#exclusions").html('Please choose a symptom...'); } var inclusions_content = $("#inclusions").html(); if (inclusions_content=='Please choose a symptom...') { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayIncludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#inclusions").html( msg ); reloadListOfSymptoms(); loadPossibleConditions(); }); } else { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayIncludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#inclusions").append( msg ); reloadListOfSymptoms(); loadPossibleConditions(); }); } }); }); } else { $("#includeSymptom_"+id) .attr('src','/images/symptoms_checker_list_remove.jpg') .removeAttr('onclick') .attr('onclick','symptomRemoveFromSelected('+id+')'); var inclusions_content = $("#inclusions").html(); if (inclusions_content=='Please choose a symptom...') { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayIncludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#inclusions").html( msg ); }); } else { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayIncludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#inclusions").append( msg ); }); } var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'includeSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#symptoms_checker_search_results").html('
'); setTimeout(function(){ reloadListOfSymptoms(); },1000) }); loadPossibleConditions(); } } /* ------------------------------------------------------------------ */ function symptomRemoveFromSelected(id) { hideToolTip(); $("#search_result_item_actions_"+id).html(''); $("#included_symptom_"+id).remove(); var inclusions_content = $("#inclusions").html(); if (inclusions_content=='') { $("#inclusions").html('Please choose a symptom...'); } var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'removeIncludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { setTimeout(function(){ reloadListOfSymptoms(); },1000) }); loadPossibleConditions(); } /* ------------------------------------------------------------------ */ function symptomAddToExcludedList(id) { hideToolTip(); var included = "#included_symptom_"+id; if ($(included).length==1) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'removeIncludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'excludeSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $(included).remove(); var inclusions_content = $("#inclusions").html(); if (inclusions_content=='') { $("#inclusions").html('Please choose a symptom...'); } var exclusions_content = $("#exclusions").html(); if (exclusions_content=='Please choose a symptom...') { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#exclusions").html( msg ); reloadListOfSymptoms(); loadPossibleConditions(); }); } else { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#exclusions").append( msg ); reloadListOfSymptoms(); loadPossibleConditions(); }); } }); }); } else { var btn = "#excludeSymptom_"+id; $(btn) .removeAttr('onclick') .attr('src','/images/symptoms_checker_list_remove.jpg') .attr('onclick','symptomRemoveFromSelected('+id+')'); var exclusions_content = $("#exclusions").html(); if (exclusions_content=='Please choose a symptom...') { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'excludeSymptom', id: id}, dataType: "html" }); request.done(function(msg) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#exclusions").html( msg ); loadPossibleConditions(); }); }); } else { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'excludeSymptom', id: id}, dataType: "html" }); request.done(function(msg) { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", data: {action : 'displayExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { $("#exclusions").append( msg ); loadPossibleConditions(); }); }); } reloadListOfSymptoms(); } } /* ------------------------------------------------------------------ */ function symptomRemoveFromExcludedList(id) { hideToolTip(); var btn = "#excludeSymptom_"+id; var btn_exists = $(btn).length; if (btn_exists=='1') { $(btn).removeAttr('onclick') .attr('src','/images/symptoms_checker_list_remove.jpg') .attr('onclick','symptomRemoveFromSelected('+id+')'); } var div = "#excluded_symptom_"+id; $(div).remove(); var exclusions_content = $("#exclusions").html(); if (exclusions_content=='Please choose a symptom...') { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'removeExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { loadPossibleConditions(); }); } else { var request = $.ajax({ url: "/ajax/symptom_checker.php", type: "POST", async: false, data: {action : 'removeExcludedSymptom', id: id}, dataType: "html" }); request.done(function(msg) { loadPossibleConditions(); }); } var exclusions_content = $("#exclusions").html(); if (exclusions_content=='') { $("#exclusions").html('Please choose a symptom...'); } reloadListOfSymptoms(); }