// gallery scroll
var strip_pos = 0;
var strip_limit = 6-2;
var autoScrollEnabled = true;
var autoScrollTimer = null;

function removeSubstring(myStr, mySubstr) {
  myStr = myStr.substring(0, myStr.length-2);
  return myStr;
}

function scroll(dir) {
	if (dir == -1) {
               if (strip_pos > 0) {
		      strip_pos += dir;
	       } else {
                        strip_pos = strip_limit+2;
                        $("#gal-strip").css('left', (-191*strip_pos)+'px');
                        strip_pos = strip_limit+1;
                }
        }
	if (dir == 1) {
               if (strip_pos <= strip_limit+1) {
		      strip_pos += dir;
	       } else {
                        strip_pos = 0;
                        $("#gal-strip").css('left', (-191*strip_pos)+'px');
                        strip_pos = 1;
                }
	}

//	$("#debug").html(strip_pos+" ["+(-191*strip_pos)+'px]');

	$("#gal-strip").animate({
		left: (-191*strip_pos)+'px'
	}, 1500 );

//	check_first_last();
}
/*
function zoom_in() {
	$("#newfaze").css('width', '30px');
	$("#newfaze").css('height', '30px');
	$("#newfaze").css('top', '-50px');
	$("#newfaze").css('left', '298px');
}

function zoom_out() {
	$("#newfaze").css('width', '18px');
	$("#newfaze").css('height', '18px');
	$("#newfaze").css('top', '-44px');
	$("#newfaze").css('left', '304px');
}
*/
function AutoScroll() {
        if (autoScrollEnabled)
                scroll(1);
}

function startAutoScroll() {
	autoScrollTimer = window.setInterval("AutoScroll()", 5000);
	autoScrollEnabled = true;
}

$(document).ready(function(){
        startAutoScroll();
});

function manualScroll(dir) {
	window.clearInterval(autoScrollTimer);
	autoScrollEnabled = false;
	window.setTimeout("startAutoScroll()", 10000);
	scroll(dir);
}
