jQuery(function() {
	var galleries = jQuery('.ad-gallery').adGallery({
		slideshow: {
			autostart: false,
			effect: 'fade',
			speed: 5000,
			thumb_opacity: 1,
			next_link: true,
			prev_link: true
		}
		/*,
		callbacks: {
			afterImageVisible: function() {
				var update_location = true;
				//var anchor_base = "ad-image";
				var anchor_base = this.wrapper.attr("id")+'_image';
				var new_location = window.location;

				var new_anchor = "#" + anchor_base + this.current_index;
				var cur_anchor = new_location.hash;
				cur_anchor = cur_anchor.replace("#", ""); // for IE with empty anchor && to make anchor clear

				new_location = new_location.href;
				var re = new RegExp(anchor_base + "\\d+");
				if (this.current_index == 0 && !re.test(cur_anchor)) {
					update_location = false;
				}

				if (update_location) {
					if (cur_anchor.length > 0) {
						new_location = new_location.replace("#" + cur_anchor, new_anchor);
					} else {
						new_location = new_location.replace("#", ""); // for empty anchor
						new_location += new_anchor;
					}

					window.location = new_location;
				}
			}
		}*/
	});
});
