window.onload = function() {
	external_links();
	ie_hover();
}

function external_links() {
	if (!document.body.getElementsByTagName) {return false;}
  var anchors = document.getElementsByTagName("a");
  for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external")
      anchor.target = "_blank";
    }
}

/* 
 obsluga LI po nadaniu klasy dla UL
 obsluga INPUT
 troche powielona druga czesc :(
*/
function ie_hover() {
	if (document.all && document.getElementsByTagName) {
		var tags = document.getElementsByTagName("ul");
		for (var i=0; i<tags.length; i++) {
			if (tags[i].className == 'iehover') {
				for (j=0; j<tags[i].childNodes.length; j++) {
					var node = tags[i].childNodes[j];
					if (node.nodeName=="LI") {
						node.onmouseover=function() {	this.className+=" hover"; }
						node.onmouseout=function() { this.className=this.className.replace(" hover", ""); }
					}
				}
			}
		}
		var tags = document.getElementsByTagName("input");
		for (var i=0; i<tags.length; i++) {
			if (tags[i].className == 'iehover') {
				tags[i].onmouseover=function() {	this.className+=" hover"; }
				tags[i].onmouseout=function() { this.className=this.className.replace(" hover", ""); }
			}
		}
		var tags = document.getElementsByTagName("label");
		for (var i=0; i<tags.length; i++) {
			if (tags[i].className == 'iehover') {
				tags[i].onmouseover=function() {	this.className+=" hover"; }
				tags[i].onmouseout=function() { this.className=this.className.replace(" hover", ""); }
			}
		}
	}
}

