var __bs_xmlHttp = false;
var __bs_a;
var __bs_b;
var __bs_c;
var __bs_d;
var __bs_e;
var __bs_f;

try {
  __bs_xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    __bs_xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    __bs_xmlHttp = false;
  }
}

if (!__bs_xmlHttp && typeof XMLHttpRequest != 'undefined') {
  __bs_xmlHttp = new XMLHttpRequest();
}

function __bs_updateFlickrImg()
{
  var sURL = "http://www.blakeschwendiman.com/flickr/getSearch.php?";


  if ( __bs_a != "" )
    sURL = sURL + "&tags=" + escape( __bs_a );

  if ( __bs_b != "" )
    sURL = sURL + "&usernames=" + escape( __bs_b );

  if ( __bs_c )
    sURL = sURL + "&show_title=1";

  if ( __bs_d )
    sURL = sURL + "&show_owner=1";

  if ( __bs_f != "" )
    sURL = sURL + "&size=" + escape( __bs_f );

  __bs_xmlHttp.open("GET", sURL, true);
  __bs_xmlHttp.onreadystatechange = __bs_updatePage;
  __bs_xmlHttp.send(null);
}

function __bs_updatePage() {
  if (__bs_xmlHttp.readyState == 4) {
    var response = __bs_xmlHttp.responseText;
    document.getElementById("__bs_flickr").innerHTML = response;

    if ( __bs_e )
      setTimeout( '__bs_updateFlickrImg()', Math.max( __bs_e, 10000 ) );
  }
}

function InsertFlickr( sTags, sUserNames, sShowTitle, sShowOwner, sSize, sRefreshRate )
{
  __bs_a = sTags;
  __bs_b = sUserNames;
  __bs_c = sShowTitle;
  __bs_d = sShowOwner;
  __bs_e = sRefreshRate;
  __bs_f = sSize;

  document.write( '<div id="__bs_flickr" align="center">' );
  document.write( '<span syle="font-family:Trebuchet MS, Verdana, Arial, Helvetica, sans-serif; font-size=8pt;">Loading Flickr Image...</span>' );
  document.write( '</div>' );

  __bs_updateFlickrImg();
}


