// Set CSS
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;
		}
	}
}

// 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">');
}

// Rot 13
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));
    }
}

// Open show ul
function openshow(id) {
	var uls = document.getElementsByTagName("UL");
	var lis = document.getElementsByTagName("LI");
	for (var i = 0;i < uls.length; i++) {
		if (uls[ i ].className == "show") {
			uls[ i ].className = "hidden";
		}
	}
	for (var i = 0;i < lis.length; i++) {
		if (lis[ i ].className == "open") {
			lis[ i ].className = "closed";
		}
	}
	var ul = document.getElementById(id);
	if (ul.className=='hidden') {
		ul.className='show';
		ul.parentNode.className='open';
	} else {
		ul.className='hidden';	
		ul.parentNode.className='closed';
	}
}

function openitem(id) {
	if (document.getElementById(id).className=='hidden') {
		document.getElementById(id).className='show';
		document.getElementById('hidethis').className='hidden';
	}
}

