d = document;

window.onload = function(){
	prepareDropDowns();
	preparePopUps();
}

function prepareDropDowns(){
	var nav = d.getElementById('nav');
	var navLi = nav.getElementsByTagName('li');
	for (i=0; i<navLi.length; i++){
	if(navLi[i].lastChild.nodeName=='UL'){
		liUL = navLi[i].lastChild;
		navLi[i].onmouseover=function(){this.className='hover';}
		navLi[i].onmouseout=function(){this.className=' ';}	
		}
	}
}


function preparePopUps() {
	content = d.getElementById('contentContainer');
	a = content.getElementsByTagName('a');
	
	for (i=0; i < a.length; i++) {
	
		if (a[i].rel == 'popUp'){
		var link = a[i].getAttribute('href');
		a[i].onclick = function() {popUp(this.getAttribute('href')); return false;};
		}
	
	}
}

function popUp(link) {
	
	width = screen.availWidth;	
	width = width/2;
	width = width-375;
	
	height = screen.availHeight;
	height = height/2;
	height = height-285;

	newWin = window.open(link,"","width = 750, height = 570, resizable=1, scrollbars=0");
	newWin.moveTo(width,height);
}