function findObj(n, d) { 
    var p,i,x;  
    if(!d) d=document; 
    if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
    }
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); 
    return x;
}



function showHideLayers() { 
    var i,p,v,obj,args=showHideLayers.arguments;

    for (i=0; i<(args.length-1); i+=2) 
    if ((obj=findObj(args[i]))!=null) { 
        v=args[i+1];
        if (obj.style) {     
        var x = obj.style.display;
        obj=obj.style; 
        v=(v=='show')?'block':(v=='hide')?'none':(v=='toggle' & x=='block')?'none':(v=='toggle' & x=='none')?'block':v; 
        }
        obj.display=v; 
    }
}


function skrivDato(){

// Array of day names
var dayNames = new Array("Søndag","Mandag","Tirsdag","Onsdag",
				"Torsdag","Fredag","Lørdag");

// Array of month Names
var monthNames = new Array(
"januar","februar","mars","april","mai","juni","juli",
"august","september","oktober","november","desember");

var now = new Date();
return now.getDate() + ". " + monthNames[now.getMonth()]  + " " + now.getFullYear();
}

UTF8 = {
	encode: function(s){
		for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
			s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
		);
		return s.join("");
	},
	decode: function(s){
		for(var a, b, i = -1, l = (s = s.split("")).length, o = String.fromCharCode, c = "charCodeAt"; ++i < l;
			((a = s[i][c](0)) & 0x80) &&
			(s[i] = (a & 0xfc) == 0xc0 && ((b = s[i + 1][c](0)) & 0xc0) == 0x80 ?
			o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), s[++i] = "")
		);
		return s.join("");
	}
};

function Search(){	        
	        var search_query = document.getElementById('src_query'); 
	        var sokeurl = 'http://www.bokkilden.no/SamboWeb/sok.do?rom=KForl&innsnevre=nei&romsok=KForl&overskrift=Kunnskapsforlaget&enkeltsok=' + search_query.value; 	       	
	       	window.open(UTF8.encode(sokeurl));    
	       }  

