/* SearchField written by Alen Grakalic, provided by Css Globe (cssglobe.com) please visit http://cssglobe.com/post/1202/style-your-websites-search-field-with-jscss/ for more info */ this.searchfield = function(){ var id = "keyword"; var btnid = "go"; var defaultText = "Search / Keyword"; var suggestion = true; var suggestionText = "Revival Ministries, Great Awakening Tour, River Church, River Bible Institute, River School of Worship, Rodney Howard-Browne, Adonica Howard-Browne, Webcast, Live Broadcast, Videos, Itinerary, Events, Giving, Online Giving, Donations, Script, Soulwinning Script, Tools, Soulwinning, Service Times, Downloads, Contact, Sign up, Register, Event Registration, Forgot Password, Gospel Script, Revival Media"; var field = document.getElementById(id); var gobutton = document.getElementById(btnid); var classInactive = "sf_inactive"; var classActive = "sf_active"; var classText = "sf_text"; var classSuggestion = "sf_suggestion"; //this.safari = ((parseInt(navigator.productSub)>=20020000)&&(navigator.vendor.indexOf("Apple Computer")!=-1)); this.safari = false; if(gobutton){ gobutton.onclick = function(){ location.href="/search.aspx?q=" + escape(field.value).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');; }; } if(field && !safari){ field.value = defaultText; field.c = field.className; field.className = field.c + " " + classInactive; field.onfocus = function(){ this.className = this.c + " " + classActive; this.value = (this.value == "" || this.value == defaultText) ? "" : this.value; }; field.onblur = function(){ this.className = (this.value != "" && this.value != defaultText) ? this.c + " " + classText : this.c + " " + classInactive; this.value = (this.value != "" && this.value != defaultText) ? this.value : defaultText; clearList(); }; if (suggestion){ var selectedIndex = 0; field.setAttribute("autocomplete", "off"); var div = document.createElement("div"); var list = document.createElement("ul"); list.style.display = "none"; div.className = classSuggestion; list.style.width = field.offsetWidth + "px"; div.appendChild(list); field.parentNode.appendChild(div); field.onkeypress = function(e){ var key = getKeyCode(e); if(key == 13){ // enter //selectList(); //selectedIndex = 0; location.href="/search.aspx?q=" + escape(field.value).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');; return false; }; }; field.onkeyup = function(e){ var key = getKeyCode(e); switch(key){ case 13: return false; break; case 27: // esc field.value = ""; selectedIndex = 0; clearList(); break; case 38: // up navList("up"); break; case 40: // down navList("down"); break; default: startList(); break; }; }; this.startList = function(){ var arr = getListItems(field.value); if(field.value.length > 0){ createList(arr); } else { clearList(); }; }; this.getListItems = function(value){ var arr = new Array(); var src = suggestionText; var src = src.replace(/, /g, ","); var arrSrc = src.split(","); for(i=0;i 0) { for(i=0;i li.length) selectedIndex = 1; navListItem(selectedIndex); }; this.navListItem = function(index){ selectedIndex = index; li = list.getElementsByTagName("li"); for(var i=0;i