var MyTNAccess = {
  webroot: '',
  message: 'Save to MY Favorites',
  addContent: function(title, url, small, message, returnUrl)
  {
    MyTNAccess.add('Content', title, url, small, message, returnUrl, null);
  },
  addVideo: function(videoID, url, small, message, returnUrl)
  {
    MyTNAccess.add('Video', videoID, url, small, message, returnUrl, null);
  },
  addProduct: function(productID, url, small, message, returnUrl, quoteID)
  {
    MyTNAccess.add('Product', productID, url, small, message, returnUrl, quoteID);
  },
  add: function(category, content, url, small, message, returnUrl, quoteID)
  {
    if (!url)
      url = window.location.href;      

    if (!message)
      message = MyTNAccess.message;

    if (!returnUrl)
      returnUrl = window.location.href;
  
    var href = MyTNAccess.webroot + '/MyTNAccess/AddBookmark.aspx?Category=' + escape(category) + '&Content=' + escape(content) + '&Url=' + escape(url);
    if (quoteID != null)
       href += '&QuoteID=' + escape(quoteID);
    if (url != returnUrl)
       href += '&Return=' + escape(returnUrl);
    
    if (small)
    {
      document.write('<a href="' + href + '" style="cursor:pointer;" target="_top" title="' + message + '">' + message + '</a>');
    }
    else
    {
      document.write('<a href="' + href + '" style="cursor:pointer;" target="_top" class="' + message + '"><div></div></a>');
    }
  }
};

var t;
function showFly(visible,flyid){
  clearTimeout(t);
  fly = document.getElementById(flyid);
  if(fly){
    if(visible)
      fly.style.visibility= 'visible';
    else
      t = setTimeout("hideFly('"+flyid+"')",600);
  }
}

function hideFly(flyid){ document.getElementById(flyid).style.visibility = 'hidden'; }

var m
function showLoginForm(visible){
  clearTimeout(m);
  fly = document.getElementById('MyTNAccessForm');
  if(fly){
    if(visible)
      fly.style.visibility= 'visible';
    else
      m = setTimeout("hideFly('MyTNAccessForm')",600);
  }
}
