/* 
   JavaScript Document
   SlideShow By 7oda or photocad
   contact : mahmoud2.2007@gmail.com
*/

$(function(){   
		   var realWidth= $('.slide').size(); 
		   var realslideWidth = $('.slide').outerWidth();
		   var realslidewidth2 = $('.slide').width();
		   var real_w = realslideWidth - realslidewidth2 ;   
		   var containerWidth= $('.container').width(); 
		   $('.slide').css('width',containerWidth-real_w); 
		   $('.con').width((containerWidth)*realslideWidth);
		   var i=1;  
		   var count = 0;
			function animation(){
				
				if(count != realWidth-1){
				$('.con').fadeOut('slow');
			 	 $('.con').animate({'left':(-containerWidth)*i},500);
				 $('.con').fadeIn(1500);
			   	 i++;	
				 count++;
				 }
				 else {
					   $('.con').fadeOut('slow');
					   $('.con').animate({'left':0},500);
					   $('.con').fadeIn(1500);
					  count=0;
					  i=1;
				 }
			}
			
			 var e = setInterval(animation,7000);
			 
			 $('.stop').click(function(){
					$(this).css({'background':'url("images/stop-clicked.png")'});	
					$(this).next().css({'background':'url("images/start.png")'});
					clearInterval(e);
					return false;
									   
	          });
	 	    $('.start').click(function(){
					$(this).css({'background':'url("images/start-clicked.png")'});	
					$(this).prev().css({'background':'url("images/stop.png")'});				   
					e = setInterval(animation,7000);
					return false;						   
	          });

	  
		$('#top').click(function(){
				var hei =$('html').height();
				$('html , body').animate({'scrollTop':'0'},1000);				 
		});
	
	 
	
});
