
	/*
	 * 
	 * 
	 * 
	 * 
	 * 
	 */


		$(function(){
			
			$('a.thumb').fancybox({
				overlayColor:'black',
				overlayOpacity:.9,
				zoomSpeedChange:250
			});
			
			snd.thumbs = [];
			$('a.thumb').each(function(index,item){
				snd.thumbs.push(new snd.Thumb(item));
			});
			
			
		});
		
		
		if (typeof window.snd == 'undefined'){
			throw new Error('snd is undefined, can\'t set up photos');
		};

		//..Thumb
		snd.Thumb = function(item){
			this.domNode = item;
			this.imageNode = $('img',item)[0];
			this.viewNode = $('.view',item)[0]; 
			this.downNode = $('.down',item)[0];
			this.fullImage = $(this.domNode).attr('fullimage');
			this.init();
		},
		snd.Thumb.prototype = {
			
			init:function(){
				if(!this.fullImage){
					$(this.downNode).css({
						background:'url(/img/loading.gif) 0 0 no-repeat'
					}).attr('title','Processing full size image for download, reload the page to check the status. When the image is ready for download, this icon will change.');					
				}else{
					$(this.downNode).bind('click',{that:this},function(e){
						e.data.that.downloadFullImage(e);
					});
				}
				$(this.domNode).bind('mouseenter',{that:this},function(e){
					e.data.that.showIcons();
				});
				$(this.domNode).bind('mouseleave',{that:this},function(e){
					e.data.that.hideIcons();
				});			
			},
			showIcons:function(){
				$(this.downNode).css({
					display:'block'
				});
				$(this.viewNode).css({
					display:'block'
				});
				$(this.imageNode).css({
					opacity:.2
				});
			},
			hideIcons:function(){
				$(this.downNode).css({
					display:'none'
				});
				$(this.viewNode).css({
					display:'none'
				});
				$(this.imageNode).css({
					opacity:1
				});
			},
			downloadFullImage:function(e){
				if(this.fullImage)window.location = this.fullImage;
				e.preventDefault();
				e.stopPropagation();
				return false; 
			},
			method:function(){},
			method:function(){}
			
		}