function ShrinkEffect(element){
	new Effect.Shrink(element, {duration:1, direction:"bottom-left"});
}

function GrowEffect(element){
	new Effect.Grow(element, {duration:1, direction:"top-right"});
}

var topic = 1;

function showbody(from, to) {
	document.getElementById(from).style.display = 'none';
	document.getElementById(to).style.display = 'inline';
}

function undoit(t) {
	if (t == topic) {
		new Effect.Shake('t'+ t, {queue:"end" });
		return;
	}

	new Effect.Morph('t'+topic, {duration:1, style: 'background:#bfc7e1'}),
	new Effect.Morph('t'+t, {duration:1, style: 'background:#6699cc'}),
	/*
	new Effect.Shrink('d'+topic, {sync: true, direction:'top-right'}),
	new Effect.Grow('d'+t, {sync: true, direction:'bottom-left'})
	*/

	// shrink current img, show current's tab, hide w1, grow w1 img
	//GrowEffect('t'+ topic);
	ShrinkEffect('d'+ topic);
	GrowEffect('d'+ t);
	//setTimeout("showblinder('t"+t+"');", 1000);

	/*
	new Effect.Fade('b'+topic, {duration:1});
	new Effect.Appear('b'+t, {duration:1});
	*/
	setTimeout("showbody('b"+topic+"','b"+t+"');", 1000);
	topic = t;
}

function start_slideshow(prefix, start_frame, end_frame, delay) {
	setTimeout(switch_slides(prefix, start_frame,start_frame,end_frame, delay), delay);
}
						
function switch_slides(prefix, frame, start_frame, end_frame, delay) {
	return (function() {
		Effect.Fade(prefix + frame);
		if (frame == end_frame) { frame = start_frame; delay += 1000; } else { frame = frame + 1; }
		setTimeout("Effect.Appear('" + prefix + frame + "', {duration:3, from:0, to:1.0});", 850);
		setTimeout(switch_slides(prefix, frame, start_frame, end_frame, delay), delay + 850);
	})
}

function updateObjectIframe(url, divID){
    e = document.getElementById(divID);
	if (e.innerHTML.match('data="empty.html"'))
		e.innerHTML = '<'+'object type="text/html" data="'+url+'"><\/object>';
}
