if (typeof ews == "undefined") var ews = {}; ews.CustomSearchBlock = {}; ews.CustomSearchBlock.Show = function(oBg, oResults, oCallBack) { document.body.appendChild(oBg); document.body.appendChild(oResults); $(oBg).fadeIn(500); $(oResults).fadeIn(500,oCallBack); } google.load('search', '1'); ews.CustomSearchBlock.LightBoxSearchByID = function (ID) { var oText = $("#" + ID + "_wSearchBox")[0]; ews.CustomSearchBlock.LightBoxSearch(oText.attributes["creator"].nodeValue, oText.attributes["searchid"].nodeValue, oText.value); return false; } ews.CustomSearchBlock.LightBoxSearch = function (Creator, SearchId, sSearchText) { var oBg = document.createElement('div'); var oResults = document.createElement('div'); oBg.id = "wSearchResultsLightBoxBg"; $(oBg).addClass("ews_gsb_lightboxbg"); oResults.id = "wSearchResultsLightBox"; $(oResults).addClass("ews_gsb_lightbox"); oResults.innerHTML = "Loading..."; $(oResults).hide(); ews.CustomSearchBlock.Show(oBg, oResults, function() { var customSearchControl = new google.search.CustomSearchControl(Creator + ":" + SearchId); var drawOptions = new google.search.DrawOptions(); customSearchControl.draw('wSearchResultsLightBox', drawOptions); customSearchControl.execute(sSearchText); $(".gsc-clear-button").click(ews.CustomSearchBlock.CloseLightBox); $(oBg).click(ews.CustomSearchBlock.CloseLightBox); }); } ews.CustomSearchBlock.CloseLightBox = function() { $("#wSearchResultsLightBox").fadeOut(function() { $("#wSearchResultsLightBox").remove(); }); $("#wSearchResultsLightBoxBg").fadeOut(function() { $("#wSearchResultsLightBoxBg").remove(); }); } ews.CustomSearchBlock.CheckEnterKey = function (e, oText) { var evt = (e) ? e : ((event) ? event : null); if (evt.keyCode == 13) { ews.CustomSearchBlock.LightBoxSearch(oText.attributes["creator"].nodeValue, oText.attributes["searchid"].nodeValue, oText.value); return false; } } if (typeof Sys != "undefined" && Sys && Sys.Application) { Sys.Application.notifyScriptLoaded(); }