//This file MUST be saved in unicode - NP!

window.status='Middelfart Bibliotek';

function getdate() {
	var currenttime = new Date()
	var month = currenttime.getMonth() + 1;
	var day = currenttime.getDate();
	var year = currenttime.getFullYear();

	if (month == 1) 
	{
		month = "januar"
	}
	else if (month == 2)
	{
		month = "februar"
	}
	else if (month == 3)
	{
		month = "marts"
	}
	else if (month == 4)
	{
		month = "april"
	}
	else if (month == 5)
	{
		month = "maj"
	}
	else if (month == 6)
	{
		month = "juni"
	}
	else if (month == 7)
	{
		month = "juli"
	}
	else if (month == 8)
	{
		month = "august"
	}
	else if (month == 9)
	{
		month = "september"
	}
	else if (month == 10)
	{
		month = "oktober"
	}
	else if (month == 11)
	{
		month = "november"
	}
	else if (month == 12)
	{
		month = "december"
	}

	document.getElementById("currentdate").innerHTML = day + ". " + month + " " + year
}

function getupdatedate(dater) {
	var currenttime = dater
	var month = currenttime.substr(3,2);
	var day = currenttime.substr(0,2);
	var year = currenttime.substr(6,4);
	
	if (day == '01') 
	{
		day = 1
	}
	else if (day == '02')
	{
		day = 2
	}
	else if (day == '03')
	{
		day = 3
	}
	else if (day == '04')
	{
		day = 4
	}
	else if (day == '05')
	{
		day = 5
	}
	else if (day == '06')
	{
		day = 6
	}
	else if (day == '07')
	{
		day = 7
	}
	else if (day == '08')
	{
		day = 8
	}
	else if (day == '09')
	{
		day = 9
	}
	
	
	if (month == '01') 
	{
		month = "januar"
	}
	else if (month == '02')
	{
		month = "februar"
	}
	else if (month == '03')
	{
		month = "marts"
	}
	else if (month == '04')
	{
		month = "april"
	}
	else if (month == '05')
	{
		month = "maj"
	}
	else if (month == '06')
	{
		month = "juni"
	}
	else if (month == '07')
	{
		month = "juli"
	}
	else if (month == '08')
	{
		month = "august"
	}
	else if (month == '09')
	{
		month = "september"
	}
	else if (month == '10')
	{
		month = "oktober"
	}
	else if (month == '11')
	{
		month = "november"
	}
	else if (month == '12')
	{
		month = "december"
	}

    document.getElementById("dwpageupdatedate").innerHTML = "Opdateret den " + day + ". " + month + " " + year
}

function getpagelinks()
{
    oColl = document.links
    for (var x = 0;x < oColl.length;x++)
   {
        var iurl = oColl[x];
        
        if (iurl.href.indexOf('WMFBIB') != -1)
        {
            furl = 'http://www.middelfartbibliotek.dk/Default.aspx?ID=46&iurl=' + escape(iurl)
            document.links[x].href = furl.replace('http%3A//biblioteksbaserne','https%3A//biblioteksbaserne')
        }
    }
}

function submitsearch()
{
    var sValue = document.searchForm.scode_freetext.value + '';

	var str = sValue.toLowerCase();
str = str.replace('æ', '%E6');
str = str.replace('ø', '%F8');
str = str.replace('å', '%E5');
str = str.replace('é', '%E9');
str = str.replace('ü', '%FC');
sValue = str;

    var loc = "https://biblioteksbaserne.dk/sites/WMFBIB/pub/search.html?doaction=search&data=scode_ccl=" + sValue;
    //var loc = 'http://www.middelfartbibliotek.dk/Default.aspx?ID=46&svalue=' + escape(sValue);
    //window.location.href = loc;
    window.open (loc,"mywindow");
    return false;
}