var MultiSearch = {		searchDelay : 500,	timeoutID : null,	init : function(queryFieldID,places) {		this.queryFieldID = queryFieldID;		this.places = places;	},		searchOKP : function(e) {		if (this.timeoutID) window.clearTimeout(this.timeoutID);		this.timeoutID = window.setTimeout("MultiSearch.search();",this.searchDelay);				var evtobj = window.event ? event : e;		var unicode=evtobj.charCode ? evtobj.charCode : evtobj.keyCode;		if (unicode == 13) return false; else return true;			},		search : function(query) {		document.getElementById("where").value = '';		if (this.timeoutID) window.clearTimeout(this.timeoutID);			this._createSearchContainer();				if (!query) query = document.getElementById(this.queryFieldID).value;		this.query = query;			if(this.query.length > 2){			if (query != "") {					for (var i in this.places)				this._searchInDb(this.places[i],query+'*');			} 		}		else {			this.container.style.display = "none";			this.showheader(false);			}				return false;	},	search1 : function(query) {				if (this.timeoutID) window.clearTimeout(this.timeoutID);			this._createSearchContainer();				if (!query) query = document.getElementById(this.queryFieldID).value;		this.query = query;			if(this.query.length > 2){			if (query != "") {					for (var i in this.places)				this._searchInDb(this.places[i],query+'*');			} 		}		else {			this.container.style.display = "none";			this.showheader(false);			}				return false;	},	reSearch : function(id,amount) {		document.getElementById("where").value = id;		var place = this._getPlaceById(id);				if (place) this._searchInDb(place,this.query+'*',amount);		return false;	},		_getPlaceById : function(id) {		for (var i in this.places)			if (this.places[i].id == id) return this.places[i];		return null;	},		_getPlacePositionById : function(id) {		for (var i in this.places)			if (this.places[i].id == id) return i;		return 0;	},		_searchInDb : function(place,query,amount) {		this._createSearchDbContainer(place);		DocPublisher.get("/servlet/search?db=" + escape(place.path) + "&view=" + escape(place.view) + "&count=" + (amount!=null?amount:place.amount) + "&query=" + escape(query),"",place.node.id,"search",place.title,place.htmlID);	},		_createSearchDbContainer : function(place) {		if (!place.node) {			var pos = this._getPlacePositionById(place.id);			place.node = document.createElement("div");			place.node.id = place.id;			place.node.className='place-holder';							if (pos % 2) {				this.main_right.appendChild(place.node);			} else {				this.main_left.appendChild(place.node);						}								} else {			place.node.innerHTML = "";		}	},		_createSearchContainer : function() {		if (!this.container) {			this.showheader(true);			var parentNode= document.getElementById("search-content");			this.container = document.createElement("div");			var main = document.createElement("div");			main.id = "search-result";			main.className = "box";			this.container.appendChild(main);							var h3=document.createElement("h3");			var image=document.createElement("img");			image.className='right-align icon';			image.src='search.png';			h3.appendChild(image);						var span=document.createElement("span");				span.id="search-query";						var h3Text=document.createTextNode('S\u00F6kresultat p\u00E5 frasen ['+document.getElementById(this.queryFieldID).value+'], uppdelat i kategorier');			span.appendChild(h3Text);						h3.appendChild(span);						main.appendChild(h3);									var content = document.createElement("div");			content.id = "search-result-content";			content.className="box-cnt";						this.main_left = document.createElement("div");			this.main_left.className = "s-box left-align";			this.main_left.id='searchBoxLeft';						content.appendChild(this.main_left);						this.main_right = document.createElement("div");			this.main_right.className = "s-box right-align";			this.main_right.id='searchBoxRight';						content.appendChild(this.main_right);						this.closer =document.createElement("a");			this.closer.id='s-close';			this.closer.className='clear';			this.closer.href='javascript:MultiSearch.closeSearch();';						this.closerText=document.createTextNode('St\u00E4ng/d\u00F6lj s\u00F6krutorna');			this.closer.appendChild(this.closerText);						content.appendChild(this.closer);						main.appendChild(content);							parentNode.parentNode.insertBefore(this.container,parentNode.nextSibling);		} else {			this.container.style.display = "block";			this.showheader(true);			this.uppdateSearchQuery();		}			},	showheader:function(show){		this.searchheader=document.getElementById('content-search-header');		this.pageheader=document.getElementById('content-header');				if(show){			this.searchheader.className='page-header';			this.pageheader.className='search-header';			}		else{			this.searchheader.className='search-header';			this.pageheader.className='page-header';		}		},	uppdateSearchQuery:function(){		this.searchquery=document.getElementById('search-query');		var children=this.searchquery.childNodes;		this.searchquery.removeChild(children[0]);		var h3Text=document.createTextNode('S\u00F6kresultat p\u00E5 frasen ['+document.getElementById(this.queryFieldID).value+'], uppdelat i kategorier');		this.searchquery.appendChild(h3Text);					},	closeSearch:function(){		this.container.style.display = "none";		document.getElementById(this.queryFieldID).value = '';		this.showheader(false);	}}