var thumbURL, fullURL;
$(document).ready(function(){
	$.ajax({
		type: "GET",
		url: jQueryThumbGalleryXML,  // gallery xml
		dataType: "xml",
		success: function(xml) {
			$(xml).find('simpleviewergallery ').each(function(){  // retrieve thumb and full images folder
				 thumbURL = $(this).attr("thumbPath");	
				 fullURL = $(this).attr("imagePath");	 
				});	
			$(xml).find('image').each(function(){ // retrieve filename and title
				var filename = $(this).find('filename').text();
				var title = $(this).find('title').text();
				$('<a href="'+fullURL+filename+'" rel="jQueryGallery" class="colorboxgallerythumb" title="'+title+'"><\/a>').html('<img src="'+thumbURL+filename+'" alt="'+filename+'"/>').appendTo('#jQueryColorboxGalleryThumbs');
			});
		$('#jQueryColorboxGallery').pajinate({ // divide list into tabs
					items_per_page : Items,
					item_container_id : '#jQueryColorboxGalleryThumbs',
					nav_panel_id : '.jQueryColorboxGalleryNav'
				});
		$("a[rel='jQueryGallery']").colorbox({transition:"elastic"});  // call colorbox from gallery thumbs
		$('head').append('<link rel="stylesheet" href="http://global-static.brainlane.com/jQuery/plugins/galleries/thumb-gallery/default/thumb-gallery.default.css" type="text/css" />');
		}
	});
});
