function UpdateArea(url,container,loading,delaytime) {
	
	if(!loading) loading='loading';
	if(!delaytime) delaytime=0;
	
	container.removeClass(loading);
	container.empty();
	
	if(delaytime>0) {
		container.addClass(loading);	
	}
			
	setTimeout( function() { 
					 
		$.ajax({
			url: url,
			type: "GET",
			dataType: "html",
			error: function (xhr, desc, exceptionobj) {
				alert(xhr.responseText);
			},
			success : function (html) {
				container.removeClass(loading);
				container.html(html);	
			}	
		});			 
	}, delaytime);
}

function ShowSlideShow(slideShowID) {
	$('#slideShowContainer').remove();
	$('body').append('<div id="slideShowContainer" style="display: none"></div>');
	var slideShowContainer = $('#slideShowContainer');
	
	$.getJSON('/slideshows/getslideshowimages.php', {'slideshow_id': slideShowID}, function(images) {
		$(images).each(function(key, image) {
			$(slideShowContainer).append('<a href="'+image.url+'" title="'+image.caption+'"></a>')
		});
		$(slideShowContainer).find('a').lightBox({
			imageLoading:					'/js/jqueryLightbox/images/lightbox-ico-loading.gif',
			imageBtnClose:				'/js/jqueryLightbox/images/lightbox-btn-close-custom.gif',
			imageBtnPrev:					'/js/jqueryLightbox/images/lightbox-btn-prev-custom.gif',
			imageBtnNext:					'/js/jqueryLightbox/images/lightbox-btn-next-custom.gif',
			imageBtnAutoSlideStart:	'/js/jqueryLightbox/images/lightbox-btn-start-slideshow.gif',
			imageBtnAutoSlideStop:	'/js/jqueryLightbox/images/lightbox-btn-stop-slideshow.gif',
			imageBlank:						'/js/jqueryLightbox/images/lightbox-blank.gif',
			txtImage:							'',
			txtOf:									'/'
		});
		$(slideShowContainer).find('a:first').click();
	});
}

$(document).ready(function() {
	$('img[slideshow]').bind('click', function() { ShowSlideShow($(this).attr('slideshow')); }).hover(function() { $(this).css('cursor','pointer'); }, function() { $(this).css('cursor',''); });
});

/*
function UpdateArea(url,container,loading,delaytime) {

	if(!loading==0) {container.addClass(loading)};

	$.ajax({
		url: url,
		type: "GET",
		dataType: "html",
		error: function (xhr, desc, exceptionobj) {
			alert(xhr.responseText);
		},
		success : function (html) {
			container.removeClass(loading);
			container.html(html);	
		}	
	});
}
*/

