// rot13 part
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));
    }
};
jQuery(document).ready(function(){
	var msg = "Åbner i et nyt vindue";
	$('html[lang|="en"]').each(function() {
		msg = "Opens in a New Window";
	});	
	$('a[href^="http://"]')
		.attr({
		target: "_blank", 
		title: msg
	});
//	$('#content-main div.pagepart:nth-child(2n)').addClass('even');

	$('.case_billeder div:first-child').each(function(){
		var image = $(this).children('img').attr('src');
		$(this).parent().css('background-image','url('+image+')');
	});
	$('.case_billeder div img').css('visibility','hidden');
	$('.case_billeder div').each(function(){
		$(this).css('width','145px');
	});
	$('.case_billeder div:nth-child(2)').css('margin-left','145px');
	$('.case_billeder div:nth-child(3)').css('margin-left','290px');
	$('.case_billeder div:nth-child(4)').css('margin-left','435px');
	$('.case_billeder div').hover(function(){
		var image = $(this).children('img').attr('src');
		$(this).parent().css('background-image','url('+image+')');
	});
	$('.case_billeder').mouseout(function(){
		var image = $(this).find('div:first-child img').attr('src');
		$(this).css('background-image','url('+image+')');
	});
});


$(document).ready(function() {
	$(".various").fancybox({
		maxWidth	: 800,
		maxHeight	: 600,
		fitToView	: false,
		width		: '640',
		height		: '290',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
	});
});
