
// Requires cm_std_005.js

var streamTimer;
var streamSpeed = 60;
var streamRate = 1;
var streamBackgroundWidth = 2240;

function start_stream () {

	do_stream(0);
}

function stop_stream () {

	// not sure

}

function do_stream (bgp) {


	var Time = streamSpeed;

	bgp -= streamRate;
	if (bgp < -streamBackgroundWidth) bgp = 0;
	
	Elt("photostream").style.backgroundPosition = bgp + "px 0px";
	//Xelt("streamspeedreadout").innerHTML = "spd:"+ streamSpeed + ", rate:"+streamRate + ", pos:"+bgp;


		var fn = "do_stream(" + bgp + ")";
		streamTimer = setTimeout(fn, Time);
}

function stream_speed (s) {
		streamSpeed += s;
}

function stream_rate (r) {
	streamRate += r;
}

/////////////////////////////

var contentMax = 3;


function toggle_content (cnum) {

	if (cnum == 0 || Elt("content" + cnum).style.display == "block") {
		Elt("bodyarea").style.width = "240px";
		EltClose("contentarea");
		EltClose("pageshadow");
		//close all contents
		for (var i = 1; i <= contentMax; i++) {
			Elt("content" + i).style.display = "none";
		}
		
	} else {
		Elt("bodyarea").style.width = "85%";
		EltOpen("contentarea");
		EltOpen("pageshadow");
		//close all contents except selected
		for (var i = 1; i <= contentMax; i++) {
			Elt("content" + i).style.display = (i==cnum) ? "block" : "none";
		}
	}

}


//////////////////////

function splash_click () {
	EltClose('splash');
	//start_stream();

}

AddOnLoad(start_stream);

/*
window.onload = function () {

	start_stream();
	
}
*/

