// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function display(category) {
	var whichcategory = document.getElementById(category);
	if (whichcategory.className=="show") {
		whichcategory.className="hide";
	} else {
		whichcategory.className="show";
	}
}

var delay = 1000;
var start_frame = 0;
var end_frame = 0;
var current_frame = 0;

function slideshow_init() {
	var lis = $('new-for-slide-images').getElementsByTagName('li');
	
	for( i=0; i < lis.length; i++){
		if(i!=0){
			lis[i].style.display = 'none';
		}
	}
	end_frame = lis.length -1;	
}


function fadeInOut(direction) {
	lis = $('new-for-slide-images').getElementsByTagName('li');
	Effect.Fade(lis[current_frame]);
	if (direction > 0) {
	  if (current_frame == end_frame) { current_frame = start_frame; } else { current_frame++; }
	}
		
	if (direction < 0) {
	  if (current_frame == 0) { current_frame = end_frame; } else { current_frame--; }
	}
	lisAppear = lis[current_frame];
	setTimeout("Effect.Appear(lisAppear);", 0);
	
}

function fadeRight() {
  fadeInOut(1);
}
function fadeLeft() {
  fadeInOut(-1);
}

function slideshow_cycle(delay) {
  fadeInOut(1)
  setTimeout("slideshow_cycle("+delay+")", delay);
}

