   
    function getAlbumImagesResponse( jsonData )
    {
    var okResponse;

    if( jsonData.stat == "ok")
      {
      document.write( "<table border=0 cellpadding=0 cellspacing=0>" );

      var maxImages = 100;

      var videoCount = 0;
      var album = "";
      var imageCount = 0;

      for ( var imgIndex = 0; imgIndex < jsonData.image_info.length; imgIndex++ ) 
        {
        var imageInfo = jsonData.image_info[imgIndex];
        if( imageInfo.isVideo != "0")
          {
          videoCount++;
          }
        else
          {
          imageCount++;
          }
        }



      if( imageCount!=0 || videoCount!=0)
      {
      document.write("<tr><td colspan=3>");

      if( videoCount==0 )
        {
        document.write( "<div id=\"smallText\">view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_new\">slideshow</a> with " + imageCount + " images</div><br>" );         
        }
      else if( imageCount==0 )
        {
        document.write( "<div id=\"smallText\">view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_new\">slideshow</a> with " + videoCount + " videos</div><br>" );         
        }
      else if(videoCount==1 )
        {
        document.write( "<div id=\"smallText\">view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_blank\">slideshow</a> with " + imageCount + " images and " + videoCount + " video</div><br>" ); 
        }
      else
        {
        document.write( "<div id=\"smallText\">view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_blank\">slideshow</a> with " + imageCount + " images and " + videoCount + " videos</div><br>" ); 
        }
      document.write("</td></tr>");
      }


      imageCount = 0;
      videoCount = 0;
      for ( var imgIndex = 0; imgIndex < jsonData.image_info.length; imgIndex++ ) 
        {
        var imageInfo = jsonData.image_info[imgIndex];
        if (imgIndex == 0 )
          album = jsonData.image_info[imgIndex].album_id;
        if( imageInfo.isVideo != "0")
        {
          videoCount++;
        }
        else
        {
        imageCount++;
        if ( imageCount <= maxImages )
        {
 
        for ( var renIndex = 0; renIndex < jsonData.image_info[imgIndex].image_renditions.length; renIndex++ )
	  { 
	  if ( jsonData.image_info[imgIndex].image_renditions[renIndex].rendition_type == "120px" )
	    {
	    var image = jsonData.image_info[imgIndex].image_renditions[renIndex];
            var anchorTag = "<a href=\"http://faces.phanfare.com/album/" + imageInfo.album_id + "#imageID=" + imageInfo.image_id + "\" target=\"_new\"><img border=0 src=\"" + image.url + "\" alt=\"" +  imageInfo.caption + "\" title=\"" + imageInfo.caption + "\"></a><br><img border=0 src=\"/images/spacer.jpg\"";

            document.write ("<tr><td>");
            document.write ( anchorTag );
            document.write ("</td><td>&nbsp;</td><td align=left width=120><div id=\"smallText\">");
            document.write (imageInfo.caption);
            document.write ("</div></td></tr>");
            break;
	    }    
          }
         }
        }
        }

      if( imageCount!=0 || videoCount!=0)
      {
      document.write("<tr><td colspan=3>");

      if( videoCount==0 )
        {
        document.write( "<div id=\"smallText\"><br>view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_new\">slideshow</a> with " + imageCount + " images</div><br>" );         
        }
      else if( imageCount==0 )
        {
        document.write( "<div id=\"smallText\"><br>view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_new\">slideshow</a> with " + videoCount + " videos</div><br>" );         
        }
      else if(videoCount==1 )
        {
        document.write( "<div id=\"smallText\"><br>view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_blank\">slideshow</a> with " + imageCount + " images and " + videoCount + " video</div><br>" ); 
        }
      else
        {
        document.write( "<div id=\"smallText\"><br>view <a href=\"http://faces.phanfare.com/slideshow.aspx?username=faces&album_id=" + albumId + "\" target=\"_blank\">slideshow</a> with " + imageCount + " images and " + videoCount + " videos</div><br>" ); 
        }

      document.write("</td></tr>");
       }  
    else
      {
      document.write("<tr><td colspan=3>");
      document.write( "<div id=\"smallText\">Unable to load photos and videos from Phanfare, check back later</div><br>" ); 
      document.write("</td></tr>");
       }
 
     document.write( "</table>" );
    }
    else
      {
      document.write( "<table border=0 cellpadding=0 cellspacing=0>" );
      document.write("<tr><td colspan=3>");
      document.write( "<div id=\"smallText\">Unable to load photos and videos from Phanfare, check back later</div><br>" ); 
      document.write("</td></tr>");
      document.write( "</table>" );
      }

  }


    function getAlbumImages( albumId )
    {
      if( albumId == "none" )
      {
      document.write( "<div id=\"smallText\">this journal has no pictures or videos</div>" );
      }
      else
      {
      var getAlbumImagesScript = "<scr" + "ipt type=\"text/javascript\"  src=\"http://api.phanfare.com/rest/?method=image.getAlbumImages&username=faces&album_id=" + albumId + "&api_key=bqloDxcurt6osmngh2Hr&session_id=publiconly&hide_exif=true&response=json&function=getAlbumImagesResponse\"></scr" + "ipt><br>";

      document.write(getAlbumImagesScript );
      }
    }

////////////////////

    function getAlbumListResponse( jsonData )
    {
    var okResponse;
    if( jsonData.stat == "ok")
      {
      document.write( "<select name=\"album\" size=0 onChange=\"createCall();\" >")
      document.write( "<option value=\"none\">none" );
      for( var i=0; i < jsonData.albums.length; i++)
        {
        document.write( "<option value=\"" + jsonData.albums[i].album_id + "\">" + jsonData.albums[i].album_name );
        }
      document.write( "</select>" );
      }
    }



    function getAlbumList()
    {
    var getAlbumListScript = "<scr" + "ipt type=\"text/javascript\"  src=\"http://api.phanfare.com/rest/?method=album.getAlbumList&username=faces&&api_key=bqloDxcurt6osmngh2Hr&session_id=publiconly&response=json&function=getAlbumListResponse\"></scr" + "ipt>";


      document.write(getAlbumListScript);

    }



