MAX_PICTERS1=4  <!--max picters to show  in gallery -->
MAX_IMG_VIEW1=1 <!--max picters to show in one row-->
MAX_PICTERS2=12  <!--max picters to show  in gallery -->
MAX_IMG_VIEW2=4 <!--max picters to show in one row-->
<!--don't  touch the code bellow to correct work of the gallery-->
MAX_PAGES1=4;
MAX_PAGES2=3;
MIN_PICTERS=1 
count1=1
count2=1
function gallery1_load(){
	if (MAX_IMG_VIEW1>MAX_PICTERS1){MAX_IMG_VIEW1=MAX_PICTERS1}
	document.getElementById('gallery1').style.backgroundImage='url(images/img_gallery_big_'+count1+'.jpg)';
	pages1(count1);
}
function gallery2_load(){
	if (MAX_IMG_VIEW2>MAX_PICTERS2){MAX_IMG_VIEW2=MAX_PICTERS2}
	document.getElementById('gallery2').innerHTML='';
	for (i=1;i<=MAX_IMG_VIEW2;i++){			
		document.getElementById('gallery2').innerHTML+='<img align="left" src="images/img_gallery_'+i+'.jpg" class="g_img" alt=""/>';
	}
	pages2(count2);
}
function gallery1(){	
	if (MAX_IMG_VIEW1>MAX_PICTERS1){MAX_IMG_VIEW1=MAX_PICTERS1}
	document.getElementById('gallery1').style.backgroundImage='url(images/img_gallery_big_'+count1+'.jpg)';
	pages1(count1);
}
function gallery2(){	
	if (MAX_IMG_VIEW1>MAX_PICTERS1){MAX_IMG_VIEW1=MAX_PICTERS1}
	document.getElementById('gallery2').innerHTML='';
	for (i=count2;i<(count2+MAX_IMG_VIEW2);i++){
		number_of_img=i;
		if (number_of_img>MAX_PICTERS2){number_of_img=(i-MAX_PICTERS2)}		
		document.getElementById('gallery2').innerHTML+='<img align="left" src="images/img_gallery_'+number_of_img+'.jpg" class="g_img"  alt=""/>';						
	}
	pages2(count2);
}
function pages1(numb){
	var p=numb;
	for(var i=1;i<=MAX_PAGES1;i++){
		if(i==p){
			document.getElementById('pg'+i).className="active1";
		}
		else{
			document.getElementById('pg'+i).className="page1";
		}
	}
}
function pages2(numb){
	var p=numb/MAX_IMG_VIEW2;
	p=Math.ceil(p);
	for(var i=1;i<=MAX_PAGES2;i++){
		if(i==p){
			document.getElementById('p'+i).className="active2";
			
		}
		else{
			document.getElementById('p'+i).className="page2";
		}
	}
}
function left1(){						
	count1--;
	if (count1<(MIN_PICTERS)){count1=MAX_PICTERS1}					
	gallery1();												
}
function left2(){						
	count2-=4;
	if (count2<(MIN_PICTERS)){count2=MAX_PICTERS2-3}
	alert(count2);
	gallery2();												
}
function right1(){	
	count1++;
	if (count1>MAX_PICTERS1){count1=MIN_PICTERS}	
	gallery1();	
}	
function right2(){	
	count2+=4;
	if (count2>MAX_PICTERS2){count2=MIN_PICTERS}
	gallery2();	
}
