/*   
	LIGHTBOX for BPC Secure Website                               

	Created By: 	Nick Voss 6/13/08
	
	Usage:  		call load_lightbox_content(load_url) wherever you need to and it will fade out the page and place the
					contents of the url into the box.  Uses ajax to make the load
	
					call lightbox_off() to close the lightbox from another function, or allow the user to click close
			
	Requirements:  	Absolutely needs the prototype framework and the scriptaculous library for the effects.
			
*/


function load_lightbox_content(load_url,lbTitle){
	if(lbTitle == null) lbTitle = 'Alert';
	$('lbTitle').innerHTML = lbTitle;
	new Ajax.Request(load_url, {   
				method: 'get',   
				onSuccess: function(transport) { 
									$('top_content_data').innerHTML = transport.responseText; 
									lightbox_on();
						    		}
							    }
					);
}
			
function lightbox_on(){
	
	
	var pgSize = getPageSize();
	// prevent the background from scrolling by resizing the page to the size of the windowport
	
	$('wrap').style.height=(parseInt(pgSize[3])) + "px";
	$('wrap').style.overflow="hidden";
	
	
	// resize the obfuscator -- unnnecessary because we resized the page to fit the viewport exactly
	// pgSize = getPageSize();
	
	$('page_obfuscator').style.height = pgSize[3] + 'px';
	//$('page_obfuscator').style.width = pgSize[0] + 'px';
		
	// fade the stuff in 
	new Effect.Appear('page_obfuscator', { duration: 0.5, from: 0, to: .8, queue: 'front' });
	new Effect.SlideDown('top_content_wrapper', { duration: 1, scaleFrom: 0, scaleTo:100, queue: 'end' });
}

function lightbox_off(){
	$('wrap').style.height="";
	$('wrap').style.overflow="";
	
	new Effect.SlideUp('top_content_wrapper', { duration: 1, scaleFrom: 100, scaleTo:0, queue: 'front' });
	new Effect.Fade('page_obfuscator', { duration:.5, queue: 'end'});
}