/* 
   JavaScript Document
   SlideShow By 7oda or photocad
   contact : mahmoud2.2007@gmail.com
*/
$(function(){
		   
		   var realWidth_scroll= $('.slide-scroll').size();
		   var realslideWidth_scroll= $('.slide-scroll').outerWidth();
		   var realslidewidth2_scroll = $('.slide-scroll').width();
		   var real_w_scroll = realslideWidth_scroll - realslidewidth2_scroll ;
		   var containerWidth_scroll= $('.container-scroll').width(); 
		   $('.slide-scroll').css('width',containerWidth_scroll-real_w_scroll);
		   $('.con-scroll').width(containerWidth_scroll*realslideWidth_scroll);
		   var iscroll=1;
		   
		   var countscroll = 0;
			function animationscrolling(){
				
				if(countscroll != realWidth_scroll-1){
				
			 	 $('.con-scroll').animate({'left':(-containerWidth_scroll)*iscroll},500);
				 
			   	 iscroll++;	
				 countscroll++;
				 }
				 else {
					   
					   $('.con-scroll').animate({'left':0},500);
					   
					  countscroll=0;
					  iscroll=1;
					 }
			}
			
			 var s = setInterval(animationscrolling,7000);
			 
			 $('.stop-scroll').click(function(){
				  	$(this).css({'background':'url("images/stop-clicked.png")'});	
					$(this).next().css({'background':'url("images/start.png")'});
					clearInterval(s);
					return false;
									   
	          });
	 		 $('.start-scroll').click(function(){
					$(this).css({'background':'url("images/start-clicked.png")'});	
					$(this).prev().css({'background':'url("images/stop.png")'});
					s = setInterval(animationscrolling,7000);
					return false;						   
	          });
	
	 
	
});
