function switchVideo(filename, description) {
	var so = new SWFObject("/videoplayer/flvplayer.swf", "movie", "330", "255", "8", "#336699");
	so.addVariable("file","/av/video/" + filename);
	so.addVariable("height","255");
	so.addVariable("width","330");
	so.addVariable("autostart", "true");
	so.addParam("allowfullscreen","true");
	so.addParam("allowscriptaccess","always");
	so.write("video_flash_player");
	$('media_description').innerHTML = "<strong>Description: </strong>" + description;
	$('embed_box').value = '<embed src="http://www.bethjones.org/videoplayer/flvplayer.swf" width="330" height="255" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=http://www.bethjones.org/av/video/' + filename + '&height=255&width=330" />';
	return false;		
}
function switchAudio(filename, title, description) {
	var so = new SWFObject("/audioplayer/mp3player.swf","mpl","320","20","7");
	so.addParam("allowfullscreen","true");
	so.addParam("allowscriptaccess","always");
	so.addVariable("file","/av/audio/" + filename);
	so.addVariable("height","20");
	so.addVariable("width","320");
	so.addVariable("autostart", "true");
	so.write("audio_flash_player");
	$('audio_title').innerHTML = title;
	$('media_description').innerHTML = description;
	$('embed_box').value = '<embed src="http://www.bethjones.org/audioplayer/mp3player.swf" width="320" height="20" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=http://www.bethjones.org/av/audio/' + filename + '&height=20&width=320" />';
	return false;
}
var photoindex;
var numphotos;
function switchPhotoGallery(galleryid) {
	var url = "/actions/switch_gallery.php";
	var params = "id=" + galleryid;
	var aj = new Ajax.Request(
					url,
					{
						method: 'post',
						parameters: params,
						onSuccess: updateGallery
					} );	
	return false;			
}
function updateGallery(response) {
	var fields = response.responseText.split("}|{");
	$('photo_slides').innerHTML = fields[3];
	switchPhoto(fields[1], fields[2], fields[4]);
	photoindex = 0;
	numphotos = fields[0];
	$('photo_slides').style.left = 0;
}
function switchPhoto(filename, description, w) {
	var stl;
	if(w == 1) {
		stl = ' style="width: 375px;"';
	} else {
		stl = ' style="height: 250px;"';
	}
	$('photo').innerHTML = '<img src="/images/photos/' + filename + '" border="0" alt="' + description + '" ' + stl + '/>';
	$('media_description').innerHTML = description;
}
Effect.Transitions.exponential = function(pos) {
  return 1-Math.pow(1-pos,2);
}
function MoveLeft()
{
	if(photoindex != 0 && numphotos > 7) {
	    new Effect.MoveBy('photo_slides', 0, 72 , 
							{
							  duration: 0.4,  
							  transition: Effect.Transitions.exponential,
							  queue: 'end'
							});
		photoindex--;
	}
}

function MoveRight()
{
	if((numphotos - photoindex - 7) > 0) {
	    new Effect.MoveBy('photo_slides', 0, -72 , 
							{
							  duration: 0.4,  
							  transition: Effect.Transitions.exponential,
							  queue: 'end'
							});
		photoindex++;
	}
}
pic = new Image(100,25); 
pic.src="/images/bg_media_item_on.jpg";
function mover(itemid) {
	$(itemid).style.backgroundImage = "url(/images/bg_media_item_on.jpg);"
}
function mout(itemid) {
	$(itemid).style.backgroundImage = "url(/images/bg_media_item.jpg);"
}