//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>, MIT Style License.

Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(B,A){this.element=this.subject=$(B);this.parent(A);var D=this.cancel.bind(this,false);
if($type(this.element)!="element"){this.element=$(this.element.getDocument().body);}var C=this.element;if(this.options.wheelStops){this.addEvent("start",function(){C.addEvent("mousewheel",D);
},true);this.addEvent("complete",function(){C.removeEvent("mousewheel",D);},true);}},set:function(){var A=Array.flatten(arguments);this.element.scrollTo(A[0],A[1]);
},compute:function(E,D,C){var B=[];var A=2;A.times(function(F){B.push(Fx.compute(E[F],D[F],C));});return B;},start:function(C,H){if(!this.check(arguments.callee,C,H)){return this;
}var E=this.element.getSize(),F=this.element.getScrollSize();var B=this.element.getScroll(),D={x:C,y:H};for(var G in D){var A=F[G]-E[G];if($chk(D[G])){D[G]=($type(D[G])=="number")?D[G].limit(0,A):A;
}else{D[G]=B[G];}D[G]+=this.options.offset[G];}return this.parent([B.x,B.y],[D.x,D.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);
},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");},toElement:function(B){var A=$(B).getPosition(this.element);
return this.start(A.x,A.y);}});

var scrollObj;

window.addEvent('domready', function(){
	scrollObj = new Fx.Scroll('sliding_ul').toLeft();
});

function slideShow(no, sno){
	$('Layer' + no).setStyle('visibility', 'visible');
	scrollObj.start((no - 1) * 716);
};

/*var slide_num = 1;
var t_num;
/*function auto(){
//alert('hi');
	if(slide_num>=4){slide_num = 1;}else{slide_num++;}
	t_num = setTimeout('slideShow('+slide_num+')', 4000);
	}*
function slideShow(no, sno) {
	slide_num = no;

	/*if(!sno){
		alert('not defined!');
	}else{

		for(var q = 0; q < sno.parentNode.parentNode.childNodes.length; q++) {

			if(sno.parentNode.parentNode.childNodes[q].className) {
				sno.parentNode.parentNode.childNodes[q].className = sno.parentNode.parentNode.childNodes[q].className.replace(/ active/g, "");
				}
			}
		sno.parentNode.className += " active";
	}
	alert(sno);*
	var obj = document.getElementById("photo").getElementsByTagName("ul")[0];
	if(obj.style.marginLeft != 0) {var x = parseInt(obj.style.marginLeft.replace(/px/g, "")); x = -x;}
	else {var x = obj.style.marginLeft;}
	--no;

	var newx = no*572;
	slideIt(x, newx);
	clearTimeout(t_num);
	auto();
}
function slideIt(x, newx) {
	if (newx > x) {x += Math.ceil((newx-x)/4);}
	else if (newx < x) {x += Math.floor((newx-x)/4);}
	else if (newx == x) {return true;}
	var obj = document.getElementById("photo").getElementsByTagName("ul")[0].style.marginLeft = -x + 'px';
	var time = setTimeout('slideIt('+x+', '+newx+')', 40);
}*/