function getFlickrPhotoWall(id, num)
{
  maxwidth = parseInt($('#'+id).css('width')) - 80;
  maxheight = parseInt($('#'+id).css('height')) -80;

  if(num > 0)
  {
    var data = 'action=getFlickrPhotoWall&num='+encodeURIComponent(num)+'&maxwidth='+encodeURIComponent(maxwidth)+'&maxheight='+encodeURIComponent(maxheight);

    $.ajax({
      type: 'POST',
      url: './php/ajaxactions.php',
      data: data,
      async: true,
      dataType: 'html',
      success: function(html)
      {
        $('#'+id).html(html);
      }
    });
  }
}

function getAllFlickrPhotos()
{
  var data = 'action=getAllFlickrPhotos';

  $.ajax({
    type: 'POST',
    url: './php/ajaxactions.php',
    async: true,
    data: data
  });
}

function getFlickrPhotos(id, start, num, method)
{
  viewLocalLoading(id);
  maxwidth = parseInt($('#'+id).css('width')) - 80;
  maxheight = parseInt($('#'+id).css('height')) -80;

  var data = 'action=getFlickrPhotos&start='+encodeURIComponent(start)+'&num='+encodeURIComponent(num)+'&maxwidth='+encodeURIComponent(maxwidth)+'&maxheight='+encodeURIComponent(maxheight)+'&method='+encodeURIComponent(method);

  $.ajax({
    type: 'POST',
    url: './php/ajaxactions.php',
    data: data,
    async: true,
    dataType: 'html',
    success: function(html)
    {
      hideLocalLoading(id);
      $('#'+id).html(html);
    }
  });
}

function viewFlickrPhoto(pid)
{
  size = "medium";

  var currentheight = $(window).height();

  if(currentheight > 1200) size = "original";
  if(currentheight <= 1200) size = "medium";
  if(currentheight <= 450) size = "small";

  var data = 'action=getFlickrPhotoSizes&pid='+encodeURIComponent(pid)+'&size='+encodeURIComponent(size);

  $.ajax({
    type: 'POST',
    url: './php/ajaxactions.php',
    data: data,
    dataType: 'text',
    success: function(url)
    {
      viewPicture(url, true, true, 'flickr'+pid+'header', 'flickr'+pid+'footer', 'flickr'+pid+'tags', 'flickr'+pid+'autor');
    }
  });
}
