function Picture(updateHtmlElement, variableGalleryName)
{
    this.updateHtmlElement			= updateHtmlElement;
    this.variableGalleryName	= variableGalleryName;
    this.request					= BASE_URL + 'indexajax.php?action=GALPicture&variable_gallery_name=' + variableGalleryName;
}

Picture.prototype.get = function(galgId,startGalpId)
{
	var ajaxResponseHtml 	= null;
	var ajaxResponseErrors 	= null;
	var ajaxResponseResult 	= 0;
	var updateHtmlElement 	= this.updateHtmlElement;
	
	var request = this.request + '&start=search' + '&galgId=' + galgId + '&startGalpId=' + startGalpId;

	$.ajax({
		type: "get",
		url: request,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
		$("response > items > html", xml).each (
		function()
		{
			ajaxResponseHtml = ($(this).text());
		}
		);

		$("response > result", xml).each (
		function()
		{
			ajaxResponseResult = ($(this).text());
		}
		);

		$("response > error", xml).each (
		function()
		{
			ajaxResponseErrors = ($(this).text());
		}
		);

		$("response > message", xml).each (
		function()
		{
			ajaxResponseMessage = ($(this).text());
		}
		);

		if(ajaxResponseResult == 1)
		{
			$('#' + updateHtmlElement).html(ajaxResponseHtml);
		}
		}
		});
}

Picture.prototype.setGalgId = function(galgId)
{
	this.galgId = galgId;
}

Picture.prototype.getWithPaging = function(offset)
{
	var ajaxResponseHtml 	= null;
	var ajaxResponseErrors 	= null;
	var ajaxResponseResult 	= 0;
	var updateHtmlElement 	= this.updateHtmlElement;
	
	var request = this.request + '&start=searchWithPaging' + '&galgId=' + this.galgId + '&offset=' + offset;

	$.ajax({
		type: "get",
		url: request,
		dataType: "xml",
		global: false,
		success: function(xml)
		{
		$("response > html", xml).each (
		function()
		{
			ajaxResponseHtml = ($(this).text());
			$('#' + updateHtmlElement).html(ajaxResponseHtml);
		}
		);

		}
		});
}


