MAX_PICTERS=46  <!--max picters to show  in gallery -->
MAX_IMG_VIEW=5 <!--max picters to show in one row-->
<!--don't  touch the code bellow to correct work of the gallery-->
MIN_PICTERS=1 
count=1	
function gallery_load(){
	if (MAX_IMG_VIEW>MAX_PICTERS){MAX_IMG_VIEW=MAX_PICTERS}		
	for (i=1;i<=MAX_IMG_VIEW;i++){
		document.getElementById('list').innerHTML+='<div><img src="images/gallery/img_gallery_'+i+'.jpg"  alt="" id="main_pic'+i+'" onclick="image_big('+i+')" style="cursor:pointer" width="67" height="58"/></div>';						
	}
}								
function gallery(){	
	if (MAX_IMG_VIEW>MAX_PICTERS){MAX_IMG_VIEW=MAX_PICTERS}	
	document.getElementById('list').innerHTML='';
	for (i=count;i<(count+MAX_IMG_VIEW);i++){
		number_of_img=i;
		if (number_of_img>MAX_PICTERS){number_of_img=(i-MAX_PICTERS)}	
		document.getElementById('list').innerHTML+='<div><img src="images/gallery/img_gallery_'+number_of_img+'.jpg"  alt="" id="main_pic'+number_of_img+'" onclick="image_big('+number_of_img+')" style="cursor:pointer" width="67" height="58"/></div>';						
	}			
	
}
function image_big(numb){					
	for (var i = MIN_PICTERS; i < (MAX_PICTERS+1); i++){
	   if ((document.getElementById('main_pic'+numb).src.indexOf('img_gallery_'+i))!=-1){
		document.getElementById('main').src='images/gallery/img_gallery_big_'+i+'.jpg';}				 
	}															
}
function left(){						
	count--;
	if (count<(MIN_PICTERS)){count=MAX_PICTERS}					
	gallery();												
}
function right(){	
	count++;
	if (count>MAX_PICTERS){count=MIN_PICTERS}	
	gallery();	
}	
