/*
JavaScript Document
--------------------------------------------------*/

// POPUP FUNCTION
function popUp(winURL) {
	window.open(winURL, "popup");
}

// ADD LOAD EVENT FUNCTION
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// JQUERY
$(document).ready ( 
	function() {
		
		// PREPARE POPUPS
		var links = document.getElementsByTagName("a");
		for (var i=0; i<links.length; i++) {
			if (links[i].getAttribute("class") == "popup") {
				
				$(links[i]).attr({ title: "Open "+links[i].getAttribute("href")+" in a new window" });
				
				//links[i].onclick = function () {
					//popUp(this.getAttribute("href"));
					//return false;
				//}
			}
		}
	}
)

// PREPARE POPUPS
function preparePopups() {
	if (!document.getElementsByTagName) return false;
		var lnks = document.getElementsByTagName("a");
		for (var i=0; i<lnks.length; i++) {
			if (lnks[i].className == "popup") {
				lnks[i].onclick = function() {
				popUp(this.getAttribute("href"));
				return false;
			}
		}
	}
}

// DROP-DOWN MENUS
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("menu");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

addLoadEvent(startList);
addLoadEvent(preparePopups);

// PNG FIX FOR IE
if (document.all && document.styleSheets && document.styleSheets[0] && document.styleSheets[0].addRule) {
	// Feel free to add rules for specific tags only, you just have to call it several times.
	document.styleSheets[0].addRule('#home #home_statement span', 'behavior: url(/_inc/iepngfix.htc)');
	document.styleSheets[0].addRule('#contentBanner span', 'behavior: url(/_inc/iepngfix.htc)');
}