
var int_start_position = 0;
var int_gallery_item_pos = 0;
var int_shift_amount = 89;
var int_visible_images = 4;
var bln_vertical_scroll = true;
var position1 = "";

if (str_gallery_type == "vertical") {
	var position1 = "left";
}
else {
	var position1 = "top";
}

function initGallery() {
	
	if (e("gallery_left_content1")) {
		e("gallery_left_content1").className='gallery-' + position1 + '-content-on';
	}
	if (e(str_last_thumb_item)) {
		e(str_last_thumb_item).src='Images/gallery-bg-' + str_gallery_type + '-border-on.gif';
	}
}

function displayGalleryItem(large_image_id, id) {
	if (e(large_image_id)) {
		
		if (e(str_last_gallery_item)) {
			e(str_last_gallery_item).className='gallery-' + position1 + '-content-off';	
		}
		
		if (e(str_last_thumb_item)) {
			e(str_last_thumb_item).src='Images/gallery-bg-' + str_gallery_type + '-border.gif';
		}
		
		e(large_image_id).className='gallery-' + position1 + '-content-on';
		
		if (e("gallery_thumb_bg" + id)) {
			e("gallery_thumb_bg" + id).src='Images/gallery-bg-' + str_gallery_type + '-border-on.gif';
		}
		
		str_last_gallery_item = large_image_id;
		str_last_thumb_item = "gallery_thumb_bg" + id;
		
	}
}

function goToNextItem() {
	if (e(str_gallery_type + "-gallery-thumbs")) {
		if (int_gallery_item_pos < (int_total_item_count - int_visible_images)) {
			int_start_position = int_start_position - int_shift_amount;
			
			if (bln_vertical_scroll) {
				e(str_gallery_type + "-gallery-thumbs").style.top = int_start_position + 'px';
			}
			else {
				e(str_gallery_type + "-gallery-thumbs").style.left = int_start_position + 'px';
			}

			int_gallery_item_pos++;
			
			displayGalleryItem("gallery_left_content" + (int_gallery_item_pos + 1), (int_gallery_item_pos + 1));
		}
	}	
}

function goToPreviousItem() {
	if (e(str_gallery_type + "-gallery-thumbs")) {
		if (int_gallery_item_pos != 0) {
			int_start_position = int_start_position + int_shift_amount;
			
			if (bln_vertical_scroll) {
				e(str_gallery_type + "-gallery-thumbs").style.top = int_start_position + 'px';
			}
			else {
				e(str_gallery_type + "-gallery-thumbs").style.left = int_start_position + 'px';	
			}
			
			displayGalleryItem("gallery_left_content" + int_gallery_item_pos, int_gallery_item_pos);
			
			int_gallery_item_pos--;	
		}
	}		
}