MAX_PICTERS=4 <!--max picters to show  in gallery -->
MAX_IMG_VIEW=1 <!--max picters to show in one row-->
var NAMES_OF_IMAGES=new Array("Saab","Volvo","BMW", "Benz");<!--names of images-->
<!--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('gallery').innerHTML+='<img align="left" src="images/img_gallery_'+i+'.jpg"  alt="" style="cursor:pointer"  width="898" height="298" onclick="right()"/>';
	}
	pages(count);
}								
function gallery(){	
	if (MAX_IMG_VIEW>MAX_PICTERS){MAX_IMG_VIEW=MAX_PICTERS}	
	document.getElementById('gallery').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('gallery').innerHTML+='<img align="left" src="images/img_gallery_'+number_of_img+'.jpg"  alt="" style="cursor:pointer"  width="898" height="298" onclick="right()"/>';
	}
	pages(count);
}
function pages(numb){
	var p=numb;
	for(var i=1;i<=MAX_PICTERS;i++){
		if(i==p){
			document.getElementById('p'+i).className="active";
		}
		else{
			document.getElementById('p'+i).className="page";
		}
	}
}
function right(){	
	count++;
	if (count>MAX_PICTERS){count=MIN_PICTERS}	
	gallery();	
}	
