     /********** Add a custom upload button to the Albums **********/

function getInternetExplorerVersion() 
{    
  var rv = -1; // Return value assumes failure.    
  if (navigator.appName == 'Microsoft Internet Explorer') 
  {        
    var ua = navigator.userAgent;        
    var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");        
    if (re.exec(ua) != null)
    {           
      rv = parseFloat(RegExp.$1);
    }
  }    
  return rv;
}


          var notLoggedIn = document.body.className.indexOf("notLoggedIn");

          // The existance of this button means that we are signed in
          var altViews = document.getElementById("altViews");

          // This code ony executes when we are NOT signed in
          if (altViews.childNodes.length > 0 && notLoggedIn >= 0)
          {

// In IE 8, display a link to upload photos
var uploadButton = document.createElement("span");
var ver = getInternetExplorerVersion(); 
//if (ver >= 8.0)
//{
//      uploadButton.innerHTML = "<SPAN class=\"first-child \">(<b><a //href=\"http://upload.CameraRenter.com?referrer=" + window.location.href + "\">Add Photos</a></b>)</SPAN>";
//document.getElementById("albumDescription").appendChild(uploadButton);
//}
//else
//{
      uploadButton.setAttribute(document.all ? "className" : "class", "sm-button sm-button-small addphotosButton glyphButton yui-button");
      uploadButton.setAttribute("id", "addphotosButton2");
      uploadButton.innerHTML = "<SPAN class=\"first-child \"><BUTTON type=\"button\"  onClick=\"window.location.href='http://upload.CameraRenter.com?referrer=' + window.location.href;\">Add Photos</BUTTON></SPAN>";      
document.getElementById("altViews").appendChild(uploadButton);
//}            
          }       

          // This code ony executes when we are signed in
          if (altViews.childNodes.length > 0 && notLoggedIn < 0)
          {
            var uploadButton = document.createElement("span");
            uploadButton.setAttribute(document.all ? "className" : "class", "sm-button sm-button-small buyButton yui-button");
            uploadButton.setAttribute("id", "unHidePhotosButton");
            uploadButton.innerHTML = "<SPAN class=\"first-child \"><BUTTON type=\"button\"  onClick=\"window.location.href='http://upload.CameraRenter.com/uploadreview.aspx?referrer=' + window.location.href;\">Hidden Photos</BUTTON></SPAN>";
            document.getElementById("altViews").appendChild(uploadButton);

          }


// This code executes regardless of sign in state
// Add the sharing buttons to the album
var styleBar = document.getElementById("stylebar");
var styleBarFirstChild = styleBar.firstChild;
var shareButton = document.createElement("span");
shareButton.innerHTML = "<span class=\"addthis_toolbox addthis_default_style\"><a class=\"addthis_button_facebook\"></a><a class=\"addthis_button_email\"></a><a class=\"addthis_button_twitter\"></a><a class=\"addthis_button_myspace\"></a><span class=\"addthis_separator\">|</span><a href=\"http://www.addthis.com/bookmark.php?v=250\" class=\"addthis_button_expanded\">Share</a></span>";
styleBar.insertBefore(shareButton, styleBarFirstChild);
