function _(id) {
	return document.getElementById(id);
}


function show_submenu(id) {
	if (_('submenu' + id))
		_('submenu' + id).style.display = 'block';
}

function hide_submenu(id) {
	if (_('submenu' + id))
		_('submenu' + id).style.display = 'none';
}


function externalLinks() {
	if (!document.getElementsByTagName) return;
	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";
		}
	}
}

function toggle_contact() {
	if (_('contact'))
		_('contact').style.display = (_('contact').style.display == 'block' ? 'none' : 'block');
}

function center_images() {
	var imgs = document.getElementsByTagName('IMG');
	for (var i = 0; i < imgs.length; i ++) {
		var img = imgs[i];
		var parent = img.parentNode;
		if (img.width > parent.offsetWidth && parent.offsetWidth > 0) {
			img.style.position = 'relative';
			img.style.left = (Math.round((img.width - parent.offsetWidth) / 2) * (-1)) + 'px';
		}
	}
}
window.onload = center_images;

var out = null;