SM.PhotoBar.config.position = 'bottom';

/*=========================*/

/*== Album Descr Array    ==*/

/*=========================*/

var dA = new Array(6);
 dA[0] = "TEST TEST TEST";
 dA[1] = "In the Dennis Family galleries/albums, you can rate your favorite photos and add your two cents too; just click on the thumbnail image and then click on the ADD COMMENT link below. Hopefully, the galleries/albums can be a fun place to reminisce!";
 dA[2] = "Add your photos and keepsakes to this gallery/album and help make it a more complete historical record. Send jpg or gif image files to Sandy and let her know (as best as you can) WHO is in the photo, WHAT was the special event, WHERE the photo was taken, and WHEN the photo was taken. If you are guessing at any of those details, use words like PERHAPS, ABOUT and POSSIBLY when describing the photo.";
 dA[3] = " ";
 dA[4] = "In the smugmug.com albums/galleries, space should not be an issue, so pick out several of your favorite photos of yourself and your kids. You don't need to scan at the highest quality, but make it a good quality scan in case someone wants to order a print from smugmug.com. Just as a guide, most of the photos in the Dennis Family galleries/albums are between 100 kb (black and white) and 1000 kb (color). As an example, Jackie's senior portrait is 572 kb and Desta's senior portrait is 1,125 kb. While the size (8x10, 5x7, 3x5, etc.) of the original photo will make a difference in the number of bytes produced, go ahead and scan any size and don't compress the file.";
 dA[5] = "In the summer of 1997 - long before any online albums were created - Sandy tried to return many baby portraits, wedding portraits, and snap shots which Mom gave to her to the individuals featured in the photos. Consequently, many family members are not well-represented in the current galleries/albums. You can change that. E-mail your jpg and gif files to Sandy (SANDYDENNIS + the at sign + COMCAST + a period + NET). If you don't have any way to create jpg or gif files of your photos, you can have Sandy come to your home with a scanner and create the files for you. If you don't believe you received any photos from Sandy, let her know.";




/*=========================*/

/*== Guestbook Text      ==*/

/*=========================*/

function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_3265091")) 
  {
    var objElement = YD.get("comment")
    if (objElement != null) 
    {
      var str = new String(objElement.innerHTML);
      str = str.replace(/\gallery/gi, 'Guestbook');
      objElement.innerHTML = str;
    }
  }
}
YE.onAvailable("comment", ModifyText);
 


/*=========================*/

/*== SLIDE SHOW          ==*/

/*== version 0.58        ==*/

/*== Updated 15 Mar 2007 ==*/

/*=========================*/

var SLIDE_SHOW = 0;

var RANDOM_PHOTO = 1;

var slideshowContainer;

var sSlide;

var sCaption;

var ssSlides;

var ssSlideTotal;

var ssSlideTimer;

var ssOldSlide;

var ssFadeTimer;

var ssFade;

var ssTimerId;

var blank;





function PrepSlideEnvironment() {

  tmpCookie = getCookie("Template");



  blank = new Image();

  blank.src = "/img/spacer.gif";



  if (typeof(slideshowType) == "undefined" || (slideshowType != SLIDE_SHOW && slideshowType != RANDOM_PHOTO)) {

    slideshowType = SLIDE_SHOW;

  }



  if (slideshowType == RANDOM_PHOTO) {

    randomSlides = true;

  }



  if (typeof(slideshowContainerId) == "undefined") {

    return false;

  } else if (typeof(slideshowContainerId) == "string") {

    slideshowContainer = YD.get(slideshowContainerId);

  }



  if (!slideshowContainer) {

    return false;

  }



  if (typeof(slideshowUrl) == "undefined" || typeof(slideshowUrl) != "string") {

    return false;

  } else {

    slideshowUrl =  /(?:http:\/\/[^\/]+)?(\/\S+)/.exec(slideshowUrl)[1];

  }



  if (/\/gallery\/[0-9]+/.test(slideshowUrl)) {

    slideSourceIsGallery = true;

  } else {

    slideSourceIsGallery = false;

  }



  if (typeof(slideHeight) == "undefined" || isNaN(slideHeight)) {

    slideHeight = "200";

  }



  if (typeof(slideWidth) == "undefined" || isNaN(slideWidth)) {

    slideWidth = "300";

  }



  if (typeof(photoHeight) == "undefined" || isNaN(photoHeight)) {

    photoHeight = slideHeight;

  }



  if (typeof(photoWidth) == "undefined" || isNaN(photoWidth)) {

    photoWidth = slideWidth;

  }



  if (typeof(slideDuration) == "undefined" || isNaN(slideDuration)) {

    slideDuration = 3;

  }



  if (typeof(firstSlideUrl) == "undefined" || typeof(firstSlideUrl) != "string") {

    firstSlideUrl = blank.src;

  }



  if (typeof(showSlideTransition) == "undefined" || typeof(showSlideTransition) != "boolean") {

    showSlideTransition = true;

  }

   

  if (typeof(resizeToPhoto) == "undefined" || typeof(resizeToPhoto) != "boolean") {

    resizeToPhoto = true;

  }



  if (typeof(quickStart) == "undefined" || typeof(quickStart) != "boolean") {

    quickStart = true;

  }



  if (typeof(randomSlides) == "undefined" || typeof(randomSlides) != "boolean") {

    randomSlides = false;

  }



  if (typeof(slideControls) == "undefined" || typeof(slideControls) != "boolean") {

    slideControls = false;

  }



  if (typeof(slideCaptions) == "undefined" || typeof(slideCaptions) != "boolean") {

    slideCaptions = false;

  }



  if (typeof(slidesClickable) == "undefined" || typeof(slidesClickable) != "boolean") {

    slidesClickable = false;

  }



  return true;

}





function loadSlideshow() {

  if (!PrepSlideEnvironment()) {

    return false;

  }



  slideshowContainer.innerHTML = '<img src="http://www.smugmug.com/img/spacer.gif" alt="" id="ssSlide" height="' + slideHeight + '" width="' + slideWidth + '" style="opacity: .99; background-image: url(' + firstSlideUrl + '); background-repeat: no-repeat; background-position: center;" />';



  if (slideCaptions) {

    slideshowContainer.innerHTML += '<div id="ssCaption"></div>';

  }



  if (slideControls) {

    slideshowContainer.innerHTML += '<div id="ssControl"><a title="Previous Slide" id="ssPrev" class="ssBtn" href="javascript: void(0);" onclick="prevSlide();"><img src="/img/spacer.gif" border="0" /></a><a title="Next Slide" id="ssNext" class="ssBtn" href="javascript: void(0);" onclick="nextSlide();"><img src="/img/spacer.gif" border="0" /></a><a title="Pause Slideshow" id="ssPause" class="ssBtn" href="javascript: void(0);" onclick="pauseSlideshow();"><img src="/img/spacer.gif" border="0" /></a><a title="Resume Slideshow" id="ssPlay" class="ssBtn" href="javascript: void(0);" onclick="resumeSlideshow();"><img src="/img/spacer.gif" border="0" /></a></div>';

  }



  sSlide = YD.get('ssSlide');

  sCaption = YD.get('ssCaption');



  if (slidesClickable) {

    sSlide.style.cursor = 'pointer';

  

    if (firstSlideUrl != blank.src) {

      ssAddSlideClick(slideshowUrl);

    }

  }



  ssSlides = [];

  ssSlideTotal = 0;

  ssSlideTimer = 0;

  ssOldSlide = 0;

  ssFadeTimer = 100;

  ssFade = "out";  



  if (slideSourceIsGallery) {

    ajax_query(slideshowHandler, '/photos/sspopup.mg?AlbumID=' + /\/gallery\/([0-9]+)/.exec(slideshowUrl)[1], null, true);

  } else {

    var postArray = [];

    postArray['TemplateID'] = '8';

    postArray['origin'] = slideshowUrl;

    ajax_query(slideshowHandler, '/homepage/templatechange.mg', postArray, true);

  }

}





function slideshowHandler(response)

{

  if (!slideSourceIsGallery) {

    if (tmpCookie && tmpCookie != "") {

      setCookie('Template', tmpCookie, 30, '/', /(?:http[s]?:\/\/)?(?:\w+\.)?(\S+[^\/])/.exec(location.href)[1]);

    } else {

      deleteCookie("Template", "/", /(?:http[s]?:\/\/)?(?:\w+\.)?(\S+[^\/])/.exec(location.href)[1]);

    }

  }



  var re = /imageID\[\d+\] = "\d+";/g;

  var re2 = /width\[\d+\] = "\d+";/g;

  var re3 = /height\[\d+\] = "\d+";/g;

  var re4 = /caption\[\d+\] = ".*";/g;



  s = response.match(re); 

  w = response.match(re2);

  h = response.match(re3);

  c = response.match(re4);



  var oSlide;



  for (i = 0; i < s.length; i++) {

    oSlide = {};



    temp = s[i].split(/"/);

    oSlide.ImageId = temp[1];

    oSlide.File = 'http://upload.smugmug.com/photos/toolthumbs.mg?ImageID=' + temp[1] + '&tool=slideshowXL&winHeight=' + photoHeight + '&winWidth=' + photoWidth;

    oSlide.Gallery = slideshowUrl + '/1/' + oSlide.ImageId;



    temp = h[i].split(/"/);

    oSlide.Height = temp[1];



    temp = w[i].split(/"/);

    oSlide.Width = temp[1];



    temp = c[i].split(/"/);

    oSlide.Caption = temp[1];



    oSlide.Loaded = false;

 

    if ((oSlide.Width > photoWidth) || (oSlide.Height > photoHeight)) {

      if (oSlide.Width >= oSlide.Height) {

         oSlide.Height = Math.round((oSlide.Height / oSlide.Width) * photoWidth);

         oSlide.Width = photoWidth;

      } else {

        oSlide.Width = Math.round((oSlide.Width / oSlide.Height) * photoHeight);

        oSlide.Height = photoHeight;

      }

    }



    ssSlideTotal = ssSlides.push(oSlide);

  }



  ssSlideTotal -= 1;



  if (randomSlides) {

    ssSlides.shift();

    ssSlides.shuffle();

    ssSlides.unshift(0);

  }



  if (quickStart) {

    ssSlideTimer = (slideDuration * 1000);

  }



  ssPrepSlide(1);

  window.setTimeout("ssPrepSlide(2);", 0);

  window.setTimeout("ssPrepSlide(ssSlideTotal);", 0);



  if (slideshowType == SLIDE_SHOW) {

    ssPlaySlideshow();

  } else {

    ssSlideSwap(1);

  }

}





function ssPauseSlideshow()

{

  window.clearTimeout(ssTimerId);

  ssTimerId = null;

}





function ssResumeSlideshow()

{

  if (!ssTimerId) {

    ssTimerId = window.setTimeout("ssPlaySlideshow()", 10);

  }

}





function ssPrepSlide(prep)

{

  if (ssSlides[prep].Loaded == false) {

    ssSlides[prep].Image = new Image();

    ssSlides[prep].Image.src = ssSlides[prep].File;

    ssSlides[prep].Loaded = true;

  }   

}





function ssMoveSlide(i) {

  ssSlideTimer = 0;

  ssFadeTimer = 100;

  ssTransition(ssFadeTimer);

  ssFade = "out";

  ssSlideSwap(i);                       

}





function ssPlaySlideshow()

{

  if (ssSlideTimer >= (slideDuration * 1000))

  {                

    if (ssFade == 'out') {

      ssTransition(ssFadeTimer -= 10);

    }

 

    if (ssFadeTimer == 0) {

      ssSlideSwap(1);

      ssFade = 'in';

    }

 

    if (ssFade == 'in') {

      ssTransition(ssFadeTimer += 10);

    }

 

    if (ssFadeTimer == 100) {

      ssSlideTimer = 0;

      ssFade = 'out';

    }

  } else {

    ssSlideTimer += 10;

  }

 

  ssTimerId = window.setTimeout("ssPlaySlideshow()", 10);

}





function ssTransition(opacity)

{

  if (showSlideTransition)

  {

    if (opacity != 100) {

      YD.setStyle(sSlide, 'opacity', (opacity / 100));

    } else {

      YD.setStyle(sSlide, 'opacity', '.99'); // to prevent flashing in mozilla browsers

    }

 

    // only affects Win IE

    YD.setStyle(sSlide, 'filter', 'alpha(opacity=' + opacity + ')');



    if (sCaption) {

      YD.setStyle(sCaption, 'opacity', sSlide.style.opacity);

      YD.setStyle(sCaption, 'filter', sSlide.style.filter);

    }

  }

}





function ssSlideSwap(i)

{

  var newSlide = ssOldSlide + i;

 

  if (newSlide > ssSlideTotal)

    newSlide = 1;

 

  if (newSlide < 1)

    newSlide = ssSlideTotal;

 

  if (ssSlides[newSlide].Loaded != false)

  {

    document.images['ssSlide'].src = blank.src;

    YD.setStyle(sSlide, 'backgroundImage', 'url(' + ssSlides[newSlide].File + ')');



    if (resizeToPhoto)

    {

      document.images['ssSlide'].height = ssSlides[newSlide].Height;

      document.images['ssSlide'].width = ssSlides[newSlide].Width;

    }



    if (slidesClickable) {

      ssAddSlideClick(ssSlides[newSlide].Gallery);

    }

    

    if (slideCaptions) {

      YD.get('ssCaption').innerHTML = ssSlides[newSlide].Caption;

    }



    ssPrepSlide(newSlide < ssSlideTotal ? newSlide + i : 1);

    ssOldSlide = newSlide;

  } else {

    ssPrepSlide(newSlide);

    ssSlideSwap(i);

  }

}





function ssAddSlideClick(sUrl) {

  YE.purgeElement(sSlide, false, 'click');

  YE.addListener(sSlide, 'click', function() {

	location.href = sUrl;

  })

}





Array.prototype.shuffle = function()

{

  var len = this.length;

  var rand, temp, i;



  for (i = 0; i < len; i++)

  {

    rand = Math.floor(Math.random()*len);

    temp = this[i];

    this[i] = this[rand];

    this[rand] = temp;

  }

}





function pauseSlideshow()

{

  YD.setStyle('ssPause', 'display', 'none');

  YD.setStyle('ssPlay', 'display', 'inline');

  ssPauseSlideshow();

}





function resumeSlideshow()

{

  YD.setStyle('ssPause', 'display', 'inline');

  YD.setStyle('ssPlay', 'display', 'none');

  ssResumeSlideshow();

}





function prevSlide()

{

  pauseSlideshow();

  ssMoveSlide(-1);

}





function nextSlide()

{

  pauseSlideshow();

  ssMoveSlide(1);

}





function getCookie(name) {

  var start = document.cookie.indexOf(name + "=");

  var len = start + name.length + 1;

  

  if ((!start) && (name != document.cookie.substring(0, name.length))) {

    return null;

  }



  if (start == -1) {

    return null;

  }



  var end = document.cookie.indexOf(";", len);



  if (end == -1) {

    end = document.cookie.length;

  }



  return unescape(document.cookie.substring(len, end));

}





function setCookie(name, value, expires, path, domain, secure) {

  var today = new Date();

  today.setTime( today.getTime() );



  if (expires) {

    expires = expires * 1000 * 60 * 60 * 24;

  }



  var expires_date = new Date(today.getTime() + (expires));



  document.cookie = name + '='+escape(value) +

    ((expires) ? ';expires=' + expires_date.toGMTString() : '') +

    ((path) ? ';path=' + path : '') +

    ((domain) ? ';domain=' + domain : '') +

    ((secure) ? ';secure' : '');

}





function deleteCookie(name, path, domain) {

  if (getCookie(name)) {

    document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";

  }

}
