/*	(c) Copyright 2005 Studio Prima Inc.
	1108 19th Ave. East
	Seattle, WA 98112
	206 325-9037
	info@studioprima.com
	http://studioprima.com/
*/

var dot_hover, dot_static;

function load_nav() {
	var page = document.body.id;
	var nav = document.getElementById('nav');
	for (var i = 0; i < nav.childNodes.length; i++) {
		if (nav.childNodes[i].firstChild && nav.childNodes[i].firstChild.nodeName == 'A') {
			nav.childNodes[i].firstChild.onmouseover = function() { nav_over(this.parentNode); };
			nav.childNodes[i].firstChild.onmouseout = function() { nav_out(this.parentNode); };
		}
	}
	
	dot_hover = document.createElement('img');
	dot_hover.setAttribute('id', 'dot_hover');
	dot_hover.setAttribute('src', '/images/global/dot.gif');
	nav.appendChild(dot_hover);
	dot_hover = document.getElementById('dot_hover');
	dot_hover.style.position
	dot_hover.style.left = page == 'home' ? '6px' : '19px';
	
	dot_static = document.createElement('img');
	dot_static.setAttribute('id', 'dot_static');
	dot_static.setAttribute('src', '/images/global/dot.gif');
	nav.appendChild(dot_static);
	dot_static = document.getElementById('dot_static');
	dot_static.style.left = page == 'home' ? '6px' : '19px';
	
	if (document.getElementById('current')) {
		var cur_nav = document.getElementById('current').parentNode;
		set_dot_pos(dot_static, cur_nav);
		dot_static.style.display = 'block';
	}
}

function nav_over(elm) {
	if (elm.id != 'current') {
		set_dot_pos(dot_hover, elm);
		dot_hover.style.display = 'block';
	}
}

function nav_out(elm) {
	if (elm.id != 'current') {
		dot_hover.style.display = 'none';
	}
}

function set_dot_pos(dot, elm) {
	if (elm.currentStyle) {
		// Internet Explorer Win/Mac
		var style = elm.currentStyle;
		dot.style.top = parseInt(style.top) + 10 + 'px';
//		indi.style.left = '58px'; // (parseInt(style.left) - 21) + 'px';
	}
	else if (document.defaultView.getComputedStyle) {
		// Gecko, Opera, Safari 1.3+, everything standards-compliant
		var style = document.defaultView.getComputedStyle(elm, '');
		dot.style.top = parseInt(style.getPropertyValue('top')) + 10 + 'px';
//		indi.style.left = '58px'; // (parseInt(style.getPropertyValue('left')) - 21) + 'px';
	}
	else if (elm.offsetTop && elm.offsetLeft) {
		// Safari 1.2
		var style = elm.style;
		dot.style.top = elm.offsetTop + 10 + 'px';
//		indi.style.left = '58px'; // (elm.offsetLeft - 21) + 'px';
	}
}

window.onload = load_nav;
