var enableThumbnailsView = true;
var clickToEnlargeText = '';
var frameIsRelativeToImageDimensions = true;
var displayImageCaption = true;

function CreateGalleryJs(GalleryID, GalleryStyle)
{
	var gallery = $get(GalleryID);
	var gallerystyle = GalleryStyle;
	var rootclassname = 'ImageGalleryJs ';
	var items = gallery.getElementsByTagName('li');
	var captioncss;

	if(displayImageCaption)
	{
		captioncss = 'block';
	}
	else
	{
		captioncss = 'none';
	}
	
	//gallery.className = rootclassname + GalleryStyle;
	
	if(GalleryStyle == 'DropShadow')
	{
		for(i = 0; i < items.length; i ++)
		{
			var itemimages = items[i].getElementsByTagName('img');
			var image_src = itemimages[0].getAttribute('src');
			var image_alt = itemimages[0].getAttribute('title');
			
			items[i].getElementsByTagName('img')[0].className = 'RealImage';
			
			if(frameIsRelativeToImageDimensions)
			{
				image_width = itemimages[0].getAttribute('width') - '12';
				image_height = itemimages[0].getAttribute('height') - '12';
				image_height_fix = itemimages[0].getAttribute('height') - '24';
				image_width_fix = itemimages[0].getAttribute('width') - '18';
				image_width_fix_wrapper = itemimages[0].getAttribute('width');
				img_width_fix = itemimages[0].getAttribute('width') - '16';
				
			}
			else
			{
				image_height = itemimages[0].getAttribute('height') - '12';
				image_height_fix = itemimages[0].getAttribute('height');
				image_width_fix = itemimages[0].getAttribute('width');
				image_width_fix_wrapper = itemimages[0].getAttribute('width');
				img_width_fix = itemimages[0].getAttribute('width');
			}

			items[i].innerHTML += [
				'<div title="' + image_alt + '" style="width: ' + image_width_fix_wrapper + 'px;">' +
					'<div class="ImageWrapper">' +
						'<div class="Image"><img src="' + image_src + '" height="' + image_height + '" width="' + img_width_fix + '" title="' + image_alt + '" /></div>' +
						'<div class="RightShadow" style="height: ' + image_height + 'px;">' + 
							'<div class="TopRight">&nbsp;</div>' +
							'<div class="MiddleRight" style="height: ' + image_height_fix + 'px">&nbsp;</div>' +
						'</div>' +
					'</div>' +
					'<div class="BottomShadow">' + 
						'<div class="BottomLeft">&nbsp;</div>' +
						'<div class="BottomRight" style="width: ' + image_width_fix + 'px;">&nbsp;</div>' +
					'</div>' +
					'<div class="ImageCaption" style="display: ' + captioncss + ';">' + image_alt + '</div>' +
				'</div>'
			];
			if(enableThumbnailsView)
			{
				items[i].className = 'EnableEnlarge';
				items[i].childNodes[0].title += clickToEnlargeText;
			}
		}
		$get(GalleryID).style.visibility = 'visible';
	}
}

function $get(stringId)
{
	return document.getElementById(stringId);
}

function $create(element)
{
	return document.createElement(element);
}

function $tag(tagName)
{
	return document.getElementsByTagName(tagName);
}