/* helper function to pop open photo gallery as an overlay */
function initializeGallery(id) {
    var btn = document.createElement('a')
    btn.href = '#';
    btn.className='btn-photos';
    btn.innerHTML = 'Launch Gallery';
    btn._galleryID = id;
    btn.onclick = function() { displayPhotos(this._galleryID); return false;}
    DOM_insertAfter(btn, document.getElementById(id));
    document.getElementById(id).style.display='none';
}
function displayPhotos(id) {
    var scroll = getPageScroll();
    var page = getPageDimensions();
    var overlay = document.getElementById('overlay');
    var photos = document.getElementById('photos-overlay')

    //var photosFlash = document.getElementById('photos-flash');
//    photosFlash.style.height='99%';
//    photosFlash.style.width='99%';
//    photosFlash.innerHTML = document.getElementById(id).innerHTML;
//    photosFlash.innerHTML = 'test';
    //so.write('photos-flash');
    document.getElementById(id).popGallery();
    if (document.body.clientHeight) overlay.style.height=document.body.clientHeight+'px';
    photos.style.top = scroll[1]+'px';

    photos.style.display='block';
    overlay.style.display='block';
    overlay.onclick = function() { hidePhotos() }
}
function hidePhotos(id) {
    var overlay = document.getElementById('overlay');
    var photos = document.getElementById('photos-overlay')
    photos.style.display='none';
    overlay.style.display='none';
    return false;
}
function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
function getPageDimensions() {
    if (self.innerWidth)
    {
    	frameWidth = self.innerWidth;
    	frameHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
    	frameWidth = document.documentElement.clientWidth;
    	frameHeight = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
    	frameWidth = document.body.clientWidth;
    	frameHeight = document.body.clientHeight;
    }
    return [frameWidth, frameHeight];
}