// IE Bug
this.IE=0;
this.IEapp=(navigator.appName=="Microsoft Internet Explorer") ? 1 : 0;
if(this.IEapp) {
	document.writeln('<link href="/css/print.css" rel="stylesheet" type="text/css" media="print">');
}


// Rot13

Rot13 = {
    map: null,

    convert: function(a) {
        Rot13.init();

        var s = "";
        for (i=0; i < a.length; i++) {
            var b = a.charAt(i);
            s += ((b>='A' && b<='Z') || (b>='a' && b<='z') ? Rot13.map[b] : b);
        }
        return s;
    },

    init: function() {
        if (Rot13.map != null)
            return;
              
        var map = new Array();
        var s   = "abcdefghijklmnopqrstuvwxyz";

        for (i=0; i<s.length; i++)
            map[s.charAt(i)] = s.charAt((i+13)%26);
        for (i=0; i<s.length; i++)
            map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase();

        Rot13.map = map;
    },

    LinkTOMail: function(a) {
        location.href= "mailto:" + Rot13.convert(a);
    },

    write: function(a) {
	document.write(Rot13.convert(a));
    }
}

// SetCSS

function SetCSS(title) {
	var i, a;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			a.disabled = true;
		}
		if (a.getAttribute("title") == title) {
			a.disabled = false;
		}
	}
}

// Find afdeling change image

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		syd_dot_over = newImage("/gfx/findafd/syd.gif");
		sjaelland_dot_over = newImage("/gfx/findafd/sjaelland.gif");
		midt_dot_over = newImage("/gfx/findafd/midt.gif");
		hovedstaden_dot_over = newImage("/gfx/findafd/hovedstaden.gif");
		nord_dot_over = newImage("/gfx/findafd/nord.gif");
		preloadFlag = true;
	}
}
