window.onload = function() {
	var a,i,o,x;
	a = document.getElementsByTagName( "a" );
	for (i=0; i<a.length; i++) {
		if ( a[i].rel == "external" ) {
				a[i].onclick = openExternal;
		}
	}
	
	o = document.getElementById( "print_site_link" );
	o.onclick = function() { window.print(); return false; }
	
	//preload
	for (i=0;i<ipx.length;i++) {
		x = ipx[i];
		ipx[i]=new Image();
		ipx[i].src = x;
	}
} 


function openExternal() {
	window.open( this.href, "", "" );
	return false;
}

var ipx= new Array();
function changeNavigation(divID) {
	var a,i,o,x;
	o = document.getElementById( divID );
	a = o.getElementsByTagName( "a" );
	for (i=0; i<a.length; i++) {
		x = a[i].getAttribute('rel');
		if ( x != "" ) {
			if ( a[i].className == 'active' ) {
				a[i].innerHTML = '<img src="/images/navigation/'+x+'_over.gif" alt="'+x+'" title="'+a[i].href+'" />';
			} else {
				a[i].innerHTML = '<img src="/images/navigation/'+x+'.gif" alt="'+x+'" title="'+a[i].href+'" onmouseover="rO(this);" onmouseout="rO(this);"/>';
				ipx[ipx.length] = '/images/navigation/'+x+'_over.gif';
			}
		}
	}
}

function changeContact() {
	var o;
	o = document.getElementById( "contact" );
	o.innerHTML = '';
}

function rO(img) {
	var s = img.src;
	if ( img.src.indexOf( "_over" ) != -1 ) {
		img.src = s.replace(/_over/,"" );
	} else {
		img.src = s.replace(/\.gif/,"_over.gif" );
	}
}

