this.searchfield = function(){
	
	// CONFIGURATION
	
	var id = "search";
	
	var defaultText = "Search the words available for purchase...";	
	
	var suggestion = true;
	
	var suggestionText = "ability, about, above, academy, accept, access, account, achieve, act, action, add, adult, advance, advertise, advice, affect, afford, age, agree, agriculture, aid, air, airfare, airline, all, alternative, always, amateur, America, analysis, animals, animation, anime, anyone, apartments, apply, architecture, archive, area, art, articles, artists, Asia, ask, assist, association, astrology, attention, auction, audio, author, auto, available, award, babes, baby, back, background, backup, bad, bag, balance, ball, band, bank, banners, bar, bargain, baseball, basic, basket, basketball, battle, bay, beach, beauty, become, beer, begin, believe, benefit, best, bet, better, beyond, big, bikini, bills, bingo, birds, blank, blog, blond, boats, body, books, borrow, bot, bottle, boys, brand, brief, bring, broad, browse, budget, build, business, button, buy, calls, cameras, can, capital, card, care, career, cars, cash, casino, cat, catalog, CDs, celebrity, change, charity, chat, cheap, check, choose, Christmas, cinema, claim, classifieds, click, clients, clothes, club, codes, collect, college, come, comics, communication, community, computer, connect, consider, consult, contact, continue, cook, cool, copyright, correct, cosmetics, cost, couple, coupons, crafts, create, credit, culture, cure, currency, customer, daily, dance, danger, dare, data, database, date, day, dealer, dear, decide, deep, default, defend, degree, delay, deliver, demand, department, describe, design, desktop, details, determine, develop, diamond, dictionary, diesel, diet, different, difficult, digital, direct, directory, discount, discuss, dish, display, distance, distribution, documents, dog, dollar, domain, door, double, download, draw, dream, dress, drink, drive, drugs, dvd, dynamic, early, earn, earth, Easter, easy, eat, ecological, e-commerce, economic, edit, edition, education, effective, effort, either, electronics, else, e-mail, employment, enable, end, energy, engineering, enjoy, ensure, enterprise, entertainment, entire, environment, equal, equipement, erotic, especially, estate, europe, event, ever, everyone, everything, example, excellent, exchange, excite, executive, exist, expect, experience, expert, explore, express, extensive, external, extra, face, facilities, facts, fall, family, fans, fantasy, far, fashion, fast, favorite, features, federal, feedback, feel, female, field, file, fill, films, final, finance, find, finish, fish, fit, fitness, flash, flights, flirt, flowers, focus, follow, fonts, food, football, force, form, format, forum, foto, free, freebies, freelancer, freeware, frequently, friends, full, fun, fund, funny, furniture, further, future, gain, gallery, gamble, games, gap, garden, gate, gay, gear, general, generation, generous, get, giant, gifts, girlfriend, girls, give, glad, glasses, global, glory, glossary, go, goal, gold, golf, good, gorgeus, govern, grab, graduation, grand, grant, graphic, great, greeting, ground, group, grow, guard, guest, guide, guidelines, gun, guys, habit, hail, hair, half, hand, handle, handsome, happen, happy, hard, hardware, harmony, hate, have, head, heal, hear, heart, heat, heaven, help, herbs, here, hero, hide, high, hilarious, hire, history, hit, hobby, hold, holiday, home, honest, hope, horoscope, horse, hospital, hostel, hosting, hot, hotels, hour, house, how, huge, human, humble, humor, hunt, idea, identify, idol, if, ignite, illusion, images, imagine, immediate, impact, impatient, import, important, impossible, impress, inbox, include, income, increase, independent, index, individual, industry, inevitable, info, inform, initial, initiative, inquiry, inside, inspire, instant, institute, insurance, intend, interesting, interface, internal, international, internet, intimate, introduce, invent, invest, invite, involved, island, issues, IT, item, jackpot, java, jealous, jet, jobs, join, jokes, journal, journey, joy, judge, jukebox, jump, justice, keep, key, kick, kids, kill, kind, kingdom, kiss, kitchen, know, label, lady, land, language, laptop, large, latest, latino, laugh, law, lawyer, leader, learn, leasing, leave, lend, lesbian, less, lesson, letter, level, library, license, life, lifestyle, light, like, limit, line, lingerie, link, list, listen, literature, little, live, loan, local, location, lock, login, lonely, long, look, lookup, loose, lottery, love, lovers, low, loyal, luck, lunch, lust, lyrics, machine, magazine, mail, main, maintenance, make, male, manage, manga, manual, map, mark, market, marketing, massage, master, match, mature, maximum, mean, media, medicine, meet, member, memory, men, menu, merchant, message, middle, military, millionaire, minimum, minutes, mission, mobile, model, mom, moment, money, monitor, months, more, morning, mortgage, motor, move, movies, mp3, multiple, museum, music, naked, name, national, nature, navigate, near, necessary, need, nervous, net, network, never, news, newspaper, next, nice, no, none, nonstop, normal, note, notice, now, nude, number, oasis, object, observe, obstacle, obtain, obvious, ocean, odd, offer, office, official, often, oil, OK, old, one, online, only, open, operation, opinion, opportunity, opposite, optical, option, order, ordinary, organic, organization, original, other, our, outdoor, outlet, outside, outstanding, over, overall, overcome, own, page, paint, panties, parent, part, partner, party, password, pay, PC, people, perfect, perfume, permit, personal, pet, phones, photos, pics, picture, pills, pizza, place, plants, play, players, please, poems, points, poker, porn, portal, practice, pray, present, press, prevent, price, print, privacy, prize, proceed, produce, products, profile, profit, program, progress, property, protect, provide, public, puppy, purchase, quality, question, quick, quit, quite, quiz, quote, queen, quantity, queue, qualified, query, quest, quiet, race, radio, range, rate, rather, reach, read, real, realize, receive, recent, recipes, recognize, recommended, record, reduce, reference, refinance, region, register, regular, relation, relatives, relax, relevant, religion, remain, remember, remote, rent, reply, report, represent, request, require, research, reserve, resort, resources, respect, responsible, rest, restaurant, results, resume, retail, return, review, rich, right, ring, ringtones, risk, road, room, run, safe, sales, satisfaction, save, say, schedule, science, score, sea, security, see, sell, send, SEO, serious, server, service, sex, share, shoes, show, significant, silver, simple, singles, site, skateboard, skill, slim, snowboard, soccer, software, solution, sound, spa, speak, special, spend, sport, star, state, stock, store, strategy, strip, style, succeed, suggest, super, supermodel, support, surf, surprise, survive, system, take, talk, target, task, tattoo, taxes, technology, teen, telephone, tell, template, tennis, term, test, text, thanks, theaters, thing, think, this, thread, tickets, time, titles, today, together, tomorrow, tool, top, topic, total, touch, tour, toys, track, trade, traffic, trailer, training, transfer, translate, transport, travel, treasure, trial, trip, true, trust, try, t-shirts, tuning, turn, tutorials, tv, UK, ultimate, understand, unique, unite, units, university, update, upgrade, urban, us, use, useful, usually, upcoming, vacation, value, van, various, vendor, version, very, vice, video, view, village, virtual, visit, visual, vital, vodka, voice, volume, vote, voyage, wallpaper, want, war, wash, watch, water, way, wealth, weather, web, webcam, webmaster, website, wedding, week, weekend, weight, wheels, whether, whiskey, whole, wide, win, wine, wireless, wish, women, word, work, world, worldwide, worth, write, www, xxx, year, yes, you, young, yet, yourself, zip, zone, zodiac, zero"; 
	
	// END CONFIGURATION

	var field = document.getElementById(id);	
	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));
	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;
					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<arrSrc.length;i++){
					if(arrSrc[i].substring(0,value.length).toLowerCase() == value.toLowerCase()){
						arr.push(arrSrc[i]);
					};
				};				
				return arr;
			};
			
			this.createList = function(arr){				
				resetList();			
				if(arr.length > 0) {
					for(i=0;i<arr.length;i++){				
						li = document.createElement("li");
						a = document.createElement("a");
						a.href = "javascript:void(0);";
						a.i = i+1;
						a.innerHTML = arr[i];
						li.i = i+1;
						li.onmouseover = function(){
							navListItem(this.i);
						};
						a.onmousedown = function(){
							selectedIndex = this.i;
							selectList(this.i);		
							return false;
						};					
						li.appendChild(a);
						list.setAttribute("tabindex", "-1");
						list.appendChild(li);	
					};	
					list.style.display = "block";				
				} else {
					clearList();
				};
			};	
			
			this.resetList = function(){
				var li = list.getElementsByTagName("li");
				var len = li.length;
				for(var i=0;i<len;i++){
					list.removeChild(li[0]);
				};
			};
			
			this.navList = function(dir){			
				selectedIndex += (dir == "down") ? 1 : -1;
				li = list.getElementsByTagName("li");
				if (selectedIndex < 1) selectedIndex =  li.length;
				if (selectedIndex > li.length) selectedIndex =  1;
				navListItem(selectedIndex);
			};
			
			this.navListItem = function(index){	
				selectedIndex = index;
				li = list.getElementsByTagName("li");
				for(var i=0;i<li.length;i++){
					li[i].className = (i==(selectedIndex-1)) ? "selected" : "";
				};
			};
			
			this.selectList = function(){
				li = list.getElementsByTagName("li");	
				a = li[selectedIndex-1].getElementsByTagName("a")[0];
				field.value = a.innerHTML;
				clearList();
			};			
			
		};
	};
	
	this.clearList = function(){
		if(list){
			list.style.display = "none";
			selectedIndex = 0;
		};
	};		
	this.getKeyCode = function(e){
		var code;
		if (!e) var e = window.event;
		if (e.keyCode) code = e.keyCode;
		return code;
	};
	
};

// script initiates on page load. 

this.addEvent = function(obj,type,fn){
	if(obj.attachEvent){
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn](window.event );}
		obj.attachEvent('on'+type, obj[type+fn]);
	} else {
		obj.addEventListener(type,fn,false);
	};
};
addEvent(window,"load",searchfield);

