var EKMA_PhotoGallery = function(ArrImages, ContainerID, ObjStr){
	this.arr_images = ArrImages; // resim dizisini tutar
	this.container_id = ContainerID;
	this.objStr = ObjStr; //bu class için tanımlanmış olan nesne
	
	this.previous = null; //önceki resim
	this.next = null; //sonraki resim
	this.shown = null; //şu anki resim
	
	
	this.loadBigImage = function(Shown, Key){
		if(!empty(Shown)){
			Shown = parseInt(Shown);
			
			this.shown = Shown;
			this.previous = Shown-1;
			this.next = Shown+1;
		}
		else if(!empty(Key)){
			var i;
			
			for(i in this.arr_images){
				i = parseInt(i);
				
				if(this.arr_images[i].spid == Key){
					this.shown = i;
					this.previous = i-1;
					this.next = i+1;
					break;
				}
			}
		}
		else{
			this.shown = 0;
			this.previous = null;
			this.next = 1;
		}
		
		if(this.shown == 0){
            $('.ekma_photogallery_previousbutton_cont').hide();
        }
        else{
            $('.ekma_photogallery_previousbutton_cont').show();
        }
        
        if(this.shown == $(this.arr_images).length-1){
            $('.ekma_photogallery_nextbutton_cont').hide();
        }
        else{
            $('.ekma_photogallery_nextbutton_cont').show();
        }
		
		if(typeof(this.arr_images[this.shown]) == 'object' && !empty(this.arr_images[this.shown])){
			var next_img_html = '<img src="' + this.arr_images[this.shown].img_big + '"';
	
			if(typeof(this.arr_images[this.next]) == 'object' && !empty(this.arr_images[this.next])){//sonraki resim varsa
				var next_click = this.objStr + '.loadBigImage(\'' +this.next+ '\'); document.location.href=document.location.href.replace(/#.*/,\'\') + \'#' +this.arr_images[this.next].spid+ '\';';
				
				next_img_html += ' onclick="' +next_click+ '"';
				
				$('#' + this.container_id + ' .ekma_photogallery_nextbutton').eq(0).unbind('click').click(function(){
					eval(next_click);
					return false;
				});
	
				
			}//end if (sonraki resim varsa)
			
			if(typeof(this.arr_images[this.previous]) == 'object' && !empty(this.arr_images[this.previous])){//sonraki resim varsa
				var prev_click = this.objStr + '.loadBigImage(\'' +this.previous+ '\'); document.location.href=document.location.href.replace(/#.*/,\'\') + \'#' +this.arr_images[this.previous].spid+ '\';';
				
				
				$('#' + this.container_id + ' .ekma_photogallery_previousbutton').eq(0).unbind('click').click(function(){
					eval(prev_click);
					return false;
				});
	
				
			}//end if (sonraki resim varsa)
			
			
			
			next_img_html += '>';
			
			$('#' + this.container_id + ' .ekma_photogallery_big_img_container .ekma_photogallery_big_img').eq(0).html(next_img_html);
			
			$('#' + this.container_id + ' .ekma_photogallery_big_img_container .ekma_photogallery_big_img_title').eq(0).html(this.arr_images[this.shown].title);
			
			$('#' + this.container_id + ' .ekma_photogallery_big_img_container .ekma_photogallery_big_img_note').eq(0).html(this.arr_images[this.shown].note);
		}
		/*
		else{
			$('#' + this.container_id + ' .ekma_photogallery_big_img_container').eq(0).css('display','none');
		}*/
	}//end method loadBigImage()
}//end class EKMA_PhotoGallery

