// JavaScript Document

<!--
//opens and centers comment window
function CommentWindow(theid) {
	var width = '500';
	var height = '350';
	var left   = (screen.width  - width)/2;
 	var top    = (screen.height - height)/2;
 	var params = 'width='+width+', height='+height;
 	params += ', top='+top+', left='+left;
  	var theURL = 'reflections.comment.php?id=' + theid;
	var title = ''; // ?? only seems to work if blank ??
	window.open(theURL,title,params);
}

//refreshes parent page after comment window is closed
function refreshParent() {
  window.opener.location.href = window.opener.location.href;
  if (window.opener.progressWindow) {
    window.opener.progressWindow.close()
  }
  window.close();
}

function slideShow() {
    var $active = $('#slideshow img.active');
    if ( $active.length == 0 ) $active = $('#slideshow img:last');
    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next() : $('#slideshow img:first');

    // uncomment the 3 lines below to pull the images in random order
    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

// -->
