var baseRef = location.href.substring(0, location.href.lastIndexOf('.nsf') + 4);
var searchOnEnterKey = false;
function setSelected(ort){
	sel = document.getElementById("dest");
	if (sel) {
		for (i=0; i<sel.options.length; i++) {
			if (sel.options[i].text == ort) {
    				sel.selectedIndex = i;
			}
		}
	}
}
function kH(e) {
	var pK = document.all? window.event.keyCode:e.which;
	if ( pK == 13 && searchOnEnterKey == true ) {
		Search();		
		return false;
	}
	return true;
}
document.onkeydown = kH;
if (document.layers) document.captureEvents(Event.KEYDOWN);
function Search() {
	var dbPath = location.href.substring(0, location.href.lastIndexOf(".nsf") + 4);
	if(document.forms[0].query.value == "") {
		//alert("Enter text to search for");
		return false;
	}
	document.getElementById("searchi").src = dbPath + "/(search)?SearchView&Searchorder=4&Query=FIELD+body+contains+" + escape(document.forms[0].query.value);
	//location.href = dbPath + "/(search)?SearchView&Searchorder=4&Query=FIELD+body+contains+" + escape(document.forms[0].query.value);
	document.cookie = "query=" +  escape(document.forms[0].query.value);
	document.getElementById("searchresults").style.display="block";
	document.getElementById("hidemain4search").style.display="none";
	return false;
}
function getCookie(name){                                                         
	c=document.cookie;                                    
	citems = c.split("; ");                            
	for (i=0; i<citems.length; i++){                                                         
		citem = citems[i].split("=");              
		if (citem[0]==name){                                                         
			return unescape(citem[1]);                            
		}                                                         
	}                                                         
	return "";                                                
}   
function edit(id) {
	//alert('För att redigera sidan måste du vara inloggad samt ha rätt redigeringsbehörighet.\n\nRedigering fungerar bara med webbläsaren Internet Explorer.');
	var baseRef = location.href.substring(0, location.href.lastIndexOf('.nsf') + 4);
	//var id = '6EE0EF8B9970EA07C1257796003C3767';
	var url = baseRef + '/(SidorEd)/'+ id +'?EditDocument&chk=125743 PM';
	window.open( url, '', 'left=10,top=10,height=725,width=670,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');
}
