$(document).ready(function(){
		
//  IE setInterval FIX
/*@cc_on
(function(f){
window.setTimeout = f(window.setTimeout);
window.setInterval = f(window.setInterval);
})(function(f){
return function(c,t){
var a = Array.prototype.slice.call(arguments,2);
if(typeof c != "function")
c = new Function(c);
return f(function(){
c.apply(this, a)
}, t)
}
});
@*/
//	function log(o){if(console.log) console.log(o)};
	
	
	
/*                            Sliding stuff	*/
	/*if( '/' == window.document.location.pathname || '/index.php' == window.document.location.pathname )
	{*/
		var currentPic = 1;
		var prevPic = 1;
		var timer = false;
		
		var moving = false;
		
		//--------------- move left
		function moveLeft(prevPic,interval){
			if(timer){
				clearInterval(timer);
				timer = false;
			}
			$('#'+currentPic).show();
			$('#'+currentPic).animate({
					marginLeft: [32,'swing']
				},
				500,
				function(){}
			);
			$('#'+prevPic).animate({
						marginLeft: [-1000,'swing']
					},
					500,
					function(){
						$('#'+prevPic).css('margin-left',990);
						moving=false;
					}
			);
		}
		//--------------- move right
		function moveRight(prevPic,interval){
			if(timer){
				clearInterval(timer);
				timer = false;
			}
			$('#'+currentPic).show();
			$('#'+currentPic).animate({
					marginLeft: [32,'swing']
				},
				500,
				function(){}
			);
			$('#'+prevPic).animate({
						marginLeft: [990,'swing']
					},
					500,
					function(){
						$('#'+prevPic).css('margin-left',990);
						moving=false;
					}
			);
		}
	
		$('.arr_next').live('click',function(e){
		
			e.preventDefault();
			if(moving) return false;
			moving=true;
			prevPic = currentPic;
			if(currentPic<4)currentPic ++;
			else
				currentPic = 1;
			$('#'+currentPic).css('margin-left',990);
			timer = setInterval(function(){
				moveLeft(prevPic,this);
			},1);
		});
		$('.arr_prev').live('click',function(e){
					
			e.preventDefault();
			if(moving) return false;
			moving=true;
			prevPic = currentPic;
			if(currentPic>1)currentPic --;
			else
				currentPic = 4;
			$('#'+currentPic).css('margin-left',-990);
			timer = setInterval(function(){moveRight(prevPic,this);},1);
		});
		
		setInterval(function(){$('.arr_next').trigger('click')},30000); 
		
		$('#2').addClass('img2');
		$('#3').addClass('img3');
		$('#4').addClass('img4');
	//}



});

