window.onload = function () {
	var x = document.getElementsByTagName('a');
	for (var i=0; i < x.length; i++) {
		if (x[i].className == 'link') {
			x[i].onmouseover = activate;
			x[i].onmouseout = deactivate;
		}
	}
	var x = document.getElementsByTagName('area');
	for (var i=0; i < x.length; i++) {
		x[i].onmouseover = activate;
		x[i].onmouseout = deactivate;
	}

	init();
}

function activate (e) {
	if (!e) var e = window.event;
	if (e.target) {
		var tg = e.target;
	}
	else if (e.srcElement) {
		var tg = e.srcElement;
	}

	var string = tg.id.split('-')[0] + '-' + tg.id.split('-')[1];
	var x = string.substr(5, 7);

	var div_left = document.getElementById(x + '-left');
	var div_right = document.getElementById(x + '-right');
	var a = document.getElementById('link-' + x);

	if (div_left) {
		div_left.style.display = 'block';
	}

	if (div_right) {
		div_right.style.display = 'block';
	}

	a.className = 'link-active';
}

function deactivate (e) {
	if (!e) var e = window.event;
	if (e.target) {
		var tg = e.target;
	}
	else if (e.srcElement) {
		var tg = e.srcElement;
	}

	var string = tg.id.split('-')[0] + '-' + tg.id.split('-')[1];
	var x = string.substr(5, 7);

	var div_left = document.getElementById(x + '-left');
	var div_right = document.getElementById(x + '-right');
	var a = document.getElementById('link-' + x);

	if (div_left) {
		div_left.style.display = 'none';
	}

	if (div_right) {
		div_right.style.display = 'none';
	}

	a.className = 'link';
}

function init () {
	var x = document.getElementsByTagName('div');
	for (var i=0; i < x.length; i++) {
		if (x[i].className == 'flat') {
			x[i].style.display = 'none';
		}
	}
}

var openedWin = null;
function newWin(url, w, h) {
	if (openedWin != null && !openedWin.closed) {
   		openedWin.close();
	}

	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;
	
	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=0,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";

	openedWin = window.open(url, null, features);
	openedWin.focus();
}

var openedWin = null;
function theWin(url, w, h) {
	if (openedWin != null && !openedWin.closed) {
   		openedWin.close();
	}

	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;
	
	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=0,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";

	deactivate();

	openedWin = window.open(url, null, features);
	openedWin.focus();
}

var openedWin = null;
function scrollWin(url, w, h) {
	if (openedWin != null && !openedWin.closed) {
   		openedWin.close();
	}

	l = (screen.availWidth-10 - w) / 2;
	t = (screen.availHeight-20 - h) / 2;
	
	features = "width="+w+",height="+h+",left="+l+",top="+t;
	features += ",screenX="+l+",screenY="+t;
	features += ",scrollbars=1,resizable=0,location=0";
	features += ",menubar=0,toolbar=0,status=0";

	openedWin = window.open(url, null, features);
	openedWin.focus();
}