// ---------------------------------------------------------------------------
// Written by Morgan Davis to replace Flash junk


// ______________________________
//                               |
//   move section triangle       |
// ______________________________|

var tri_tid = null;
var tri = null;
var tri_x = 0;
var tri_stop_x;
var tri_speed;

function slide_tri() {
	dx = Math.round((tri_stop_x - tri_x) / 6);
	tri_x += dx;
	tri.left = tri_x;
	tri_speed += 2;
	if (tri_x != tri_stop_x)
		tri_tid = setTimeout("slide_tri()", tri_speed);
}

function change_section(s, x) {
	if (tri_tid != null)
		clearTimeout(tri_tid);
	if (tri == null)
		tri = getStyleObj('sectiontri');
	setVisibility('sectiontri', true);
	tri_speed = 10;
	tri_stop_x = 68 + x * 58;
	window.open('thumbs.php?s=' + s, 'thumbnailFrame');
	w = window.open(s + '.html', 'photoFrame');
	w.focus();
	slide_tri();
}

function clear_photo_nav() {
	if (tri != null)
		setVisibility('sectiontri', false);
}


// ______________________________
//                               |
//      home icon triangle       |
// ______________________________|


var home_tri = null;
var home_tri_state = 0;
var home_tri_opac = 50;
var home_tri_tid = null;

function home_tri_fade() {
	if ((home_tri_state == 1 && home_tri_opac < 100) ||
	    (home_tri_state == 0 && home_tri_opac > 50)) {
		home_tri_opac += home_tri_state ? 10 : -10;
		setOpacity('hometri', home_tri_opac);
	}
	if (home_tri_opac > 50 && home_tri_opac < 100)	
		home_tri_tid = setTimeout("home_tri_fade()", 50);
	else
		home_tri_tid = null;
}

function home_tri_glow(state) {
	home_tri_state = state;
	if (home_tri_tid == null)
		home_tri_fade();
}


function change_page(p) {
	photoFrame.focus();
	clear_photo_nav();

	n = new Array('bio', 'photo', 'contact');
	for (i = 0; i < 3; i++) {
		obj = getStyleObj(n[i]);
		obj.backgroundColor = (n[i] == p) ? "#214046" : "transparent";
	}

	if (p == "photo")
		setVisibility('flashbottomNavLayer', true);
	else {
		setVisibility('flashbottomNavLayer', false);
		window.open(p + '.html', 'thumbnailFrame');
		w = window.open(p + '_frame.html', 'photoFrame');
	}
}

