// VLAD. ONLOAD LIGHTBOX
// showLightbox()
// Preloads images. Pleaces new image in lightbox then centers and displays.
//

loadingImage = "";

function showLightboxOnload(src_img,title_img)
{
		// prep objects
		var objOverlay = document.getElementById('overlay');
		var objLightbox = document.getElementById('lightbox');
		var objCaption = document.getElementById('lightboxCaption');
		var objImage = document.getElementById('lightboxImage');
		var objLightboxDetails = document.getElementById('lightboxDetails');
	
		
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
	
		// set height of Overlay to take up whole page and show
		objOverlay.style.height = (arrayPageSize[1] + 'px');
		objOverlay.style.display = 'block';
	
		// preload image
		imgPreload = new Image();
		
		imgPreload.onload=function(){
			
	
			// center lightbox and make sure that the top and left values are not negative
			// and the image placed outside the viewport
			var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2);
			var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2);
			
			objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
			objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
	
	
			objLightboxDetails.style.width = imgPreload.width + 'px';
			
			
				objCaption.style.display = 'block';
				//objCaption.style.width = imgPreload.width + 'px';
				
	
			
			// A small pause between the image loading and displaying is required with IE,
			// this prevents the previous image displaying for a short burst causing flicker.
			if (navigator.appVersion.indexOf("MSIE")!=-1){
				pause(250);
			} 
	

	
			// Hide select boxes as they will 'peek' through the image in IE
			selects = document.getElementsByTagName("select");
			for (i = 0; i != selects.length; i++) {
					selects[i].style.visibility = "hidden";
			}
	
		
			objLightbox.style.display = 'block';
	
			// After image is loaded, update the overlay height as the new image might have
			// increased the overall page height.
			arrayPageSize = getPageSize();
			objOverlay.style.height = (arrayPageSize[1] + 'px');
			
			// Check for 'x' keypress
			listenKey();

		}
		
			objCaption.innerHTML = 'The "Rosie Pope" Store Views';
			objImage.src = 'http://www.rosiepopematernity.com/RosiePopeOpening.swf';
	        imgPreload.src = 'http://www.rosiepopematernity.com/RosiePopeOpening.swf';
			setTimeout ("hideLightbox()", 10);

			
			
			
			
			
		
		
}//end of displayLightboxOnload function

//addLoadEvent(showLightboxOnload); //run initLightbox onLoad