(function($){
	$(document).ready(function(){
		$('#projectMoreLinksA').mouseover(function(){
			//if($('#projectLinks').css('display')=='none'){
				$('#projectMoreLinksDiv').slideDown('slow',function(){})	
			//}
		})
		$('#projectMoreLinksA, #projectMoreLinksDiv').mouseleave(function(){
			t=setTimeout(hideObj, 1000)
		})
		function hideObj(){
			$('#projectMoreLinksDiv').slideUp('slow')
		}
		$('#projectMoreLinksA, #projectMoreLinksDiv').mouseover(function(){
			clearTimeout(t)
		})
		
		
		
		//$('.navigation li').dropDownMenus();
		//$('.scrollerOuter').scroller();
		
	})
	
	
	
	
	
	$.fn.dropDownMenus=function(){
		$(this).hover(
			function(){
				$('ul:first', this).fadeIn('slow')
				$('ul:first a', this).hover(
					function(){$(this).addClass('on')},
					function(){$(this).removeClass('on')}
				)
			},
			function(){
				$('ul:first', this).hide()
				$(this).removeClass('over');
			}
		)
	}
	
	
	
	
	$.fn.scroller=function(w,id){
		var counter=0;
		var scrollerLength=$('.scroller',$('.'+id)).length;
		
		function auto(){
			counter++;
			if(counter==scrollerLength){
				counter=0;	
			}
			
			$('.counters a',$('.'+id)).removeClass('on')
			$('.counters a:eq('+counter+')',$('.'+id)).addClass('on')
			
			var leftPosition=w*counter;
			$('.pa',$('.'+id)).animate({'left':-leftPosition},'slow')
			
		}
		
		var intervel=setInterval(auto,5000);
		
		
		$('.counters a', this).each(function(index){
			$(this).click(function(){
				counter=index;
				$('.counters a',$('.'+id)).removeClass('on')
				$('.counters a:eq('+counter+')',$('.'+id)).addClass('on')
				
				var leftPosition=w*counter;
				$('.pa',$('.'+id)).animate({'left':-leftPosition},'slow')
			})
		})
		
		
		$('.next', this).click(function(){
			if(counter<scrollerLength-1){
				counter++;
			}
			else counter=0;
			
			$('.counters a',$('.'+id)).removeClass('on')
			$('.counters a:eq('+counter+')',$('.'+id)).addClass('on')
			
			var leftPosition=w*counter
			$('.pa',$('.'+id)).animate({'left':-leftPosition},'slow')
		})
		
		$('.prev', this).click(function(){
			if(counter==0){
				counter=scrollerLength-1;
			}
			else {
				counter--;
			}
			
			$('.counters a',$('.'+id)).removeClass('on')
			$('.counters a:eq('+counter+')',$('.'+id)).addClass('on')
			
			var leftPosition=w*counter
			$('.pa',$('.'+id)).animate({'left':-leftPosition},'slow')
		})
	}
	
	
	
	
})(jQuery)


function imgDisplay(img,n) {
	document.getElementById('imgZoomThumb').src=img;
	document.getElementById('imgZoom').href=img;
	as=document.getElementById('imgCounter').getElementsByTagName('a');
	for (i=0; i<as.length; i++) {
		if(i==n) {
			as[i].className='on';
		}
		else as[i].className='';
	}
}
