
var galleryIndexSidebar = {};

galleryIndexSidebar.currResult = 0;

galleryIndexSidebar.load = function () {
	$.ajax({
		type: "get",
		url: "ajax/gallery-index-sidebar.php",
		data: {"currResult": this.currResult},
		success: function (xhtml) {
				document.getElementById('galleryIndexSidebarNotAFrame').innerHTML = xhtml;
				galleryIndexSidebar.bind();
			},
		error: function() {
				document.getElementById('galleryIndexSidebarNotAFrame').innerHTML = '<p>Sorry an error has occured.</p>';
			}
	});
}

galleryIndexSidebar.bind = function () {
	$('#galleryIndexSidebarNotAFrame .pagerControls a').bind('click', function() {
		var href = this.href
		var currResult = href.substring((href.lastIndexOf('#') + 1));
		//alert(currResult);
		galleryIndexSidebar.currResult = currResult;
		galleryIndexSidebar.load();
		return false;
	});
}

