var uptodate = { addWindowOnload: function(onloadFunc) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = onloadFunc; } else { window.onload = function() { oldonload(); onloadFunc(); } } }, doSearch: function() { var objSearch = document.getElementById("txtSearch"); if (objSearch) { var searchTerm = objSearch.value; if (objSearch.defaultValue != searchTerm && searchTerm != "") { var url = document.getElementById("searchUrlBase").value; url += '?source=' + document.getElementById("utdSource").value; url += '&utm_campaign=' + document.getElementById("_CAMPAIGN").value; url += '&utm_medium=' + document.getElementById("_MEDIUM").value; url += '&utm_source=' + document.getElementById("_SOURCE").value; url += '&referer=' + escape(document.getElementById("_REFERER").value); if (document.getElementById("widgetClientId")) { url += '&widgetClientId=' + document.getElementById("widgetClientId").value; } url += '&search=' + encodeURIComponent(searchTerm); url += '&sp=3'; window.open(url, '_blank'); } } return false; }, clearSearchText: function() { var objSearch = document.getElementById("txtSearch"); if (objSearch.defaultValue == objSearch.value) { objSearch.value = ''; } else if (objSearch.value == '') { objSearch.value = objSearch.defaultValue; } }, installWidget: function() { var jsonObj = {"widgetCode":"\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n\t \n\n\t \n\t\n\t
\n\t\t\n\t\t\n\t\t\n\n\t\tGo\n\t\t\n\t\t\n\t\t\n\t\t\n\t
\n
\n\n\t\n\n\n\n\n\n \n"}; try { if (jsonObj.widgetCode) { var objContainer = document.getElementById("uptodatesearchcontainer"); if (objContainer) { objContainer.innerHTML = jsonObj.widgetCode; } } } catch (e) { //ignore } var objReferer = document.getElementById("_REFERER"); if (objReferer) { objReferer.value = window.location.href; } uptodate.initjQuery(); }, // if jQuery doesn't exist on the page, load it in no conflict mode jQueryScriptOutputted: false, initjQuery: function() { if (typeof(jQuery) == 'undefined') { if (!uptodate.jQueryScriptOutputted) { uptodate.jQueryScriptOutputted = true; var utdUrl = 'https://www.uptodate.com'; var s = document.createElement("script"); s.async = false; s.setAttribute("type", "text/javascript"); s.setAttribute("src",utdUrl + "/js/jquery-1.6.2.min.js"); document.body.appendChild(s); } setTimeout("uptodate.initjQuery()", 50); } else { if (uptodate.jQueryScriptOutputted) { jQuery.noConflict(); } jQuery(document).ready(function(){ jQuery('#benPatients').bind('click', uptodate.logWidgetHomeLinkEvent); }); } }, logWidgetHomeLinkEvent: function() { var utdUrl = 'https://www.uptodate.com'; var clientId = jQuery('#clientId').val(); var source = 'PAT_WIDGET'; if (clientId != null && source != null && clientId.length > 0) { var params = { eventType: "WidgetHomeLink", clientId: clientId, source: source}; var url = utdUrl + '/services/EventLog'; url = url + '?' + jQuery.param(params); jQuery.ajax(url, {cache: false}); } return true; } }; uptodate.addWindowOnload(uptodate.installWidget);