var lock=false;
var z;
var lb_width;
var lb_height;
var lb_src;

function CheckIsIE() 
{ 
if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;} 
else { return false; } 
} 


function PrintThisPage() 
{ 

if (CheckIsIE() == true) 
{ 
document.lb_iframe.focus(); 
document.lb_iframe.print(); 
} 
else 
{ 
window.frames['lb_iframe'].focus(); 
window.frames['lb_iframe'].print(); 
} 

} 
function showlightbox(src, width, height, title){

		$('#blackbg').remove();
		$('#lb_tbl').remove();


	if(lock==false){
	jQuery.easing.def = "easeOutExpo";
	lb_width=width;
	lb_height=height;
	lb_src =src;
	
	var left = ($(window).width()-lb_width)/2;
	var top = ($(window).height()-lb_height)/2;

	$("body")
		.append("<div id=\"blackbg\" position:fixed; top:0px; left:0x; z-index:99;\">&nbsp;</div>")
		.append("<table id=\"lb_tbl\" cellpadding=0 cellspacing=0 style=\"position:fixed; z-index:101; display:none; \"><tr><td id=\"lb_td\" align=\"center\"><div align=\"center\" id=\"lb_div\" style=\"background-color:#e9e9e	9; width:1px; height:1px; padding:20px; \"></div></td></tr><tr><td valign=\"top\"><div id=\"bottompanel\" style=\"background-color:#f1f1f1; border-width:1px 0px 0px 0px; border-style:solid; border-color:#999999;  \" width=\"100%\" height=\"0px\"></div></td></tr></table>");
																																																			
	$('#blackbg')
		.animate( {'height':$(document).height()+'px', 'width':$(document).width()+'px', 'opacity':'0'}, 0)
		.css({ 'display':'block' })
		.animate( { 'opacity':'0.9' }, 0)
		.click(function(){
			hidelightbox();
		});
		
	$(document)
		.keypress(function (e) {
			var KeyID = ($(window).event) ? event.keyCode : e.keyCode;
			switch(KeyID)
			{
				case 27:	hidelightbox();
			}
		});
	
	$("#bottompanel")
		.append("<table id=\"bottom_tbl\"  class=\"text_normal\" width=\"100%\" bgcolor=\"#d3d3d3\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\"><tr><td width=\"70%\"></td><td align=\"right\"><a href=\"javascript: hidelightbox();\" class=\"lightbox_link\">close</a><img src=\"img/close_lightbox.gif\" border =\"0\" width=\"13px\" width=\"13px\" align=\"absmiddle\"></td></tr></table>")
		.animate( { 'height':'0px', opacity:'0' }, 0);
	
	$('#lb_tbl')
		.css({ 'display':'block', 'width':lb_width +'px', 'height':lb_height+'px', 'left':left+'px', 'top':top+'px' });
		
	$('#lb_td')
		.css({ 'width':lb_width +'px', 'height':lb_height+'px' });

	$('#lb_div')
		.animate( { 'width':lb_width+'px' , 'height':lb_height+'px' }, 700); 
			
	z = setTimeout(function(){
		$('#lb_div')
			.append('<iframe id=\"lb_iframe\" name=\"myframe\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" width=\"'+lb_width+'\" height=\"'+lb_height+'\" src=\"'+lb_src+'\" style=\"border:solid; border-width:1px; border-color:#d3d3d3\"></iframe>');
		$('#bottompanel').animate({ height:'23px', opacity:'1' },600)
		},700);
	}
}

function hidelightbox(){
	
	if(lock==false){
		clearTimeout(z);
		lock=true;
	$('#lb_iframe').hide();
	$('#blackbg').animate({ opacity:'0' }, 700); 
	$('#lb_tbl').animate({ opacity:'0' }, 700, function(){ 
	
	$('#blackbg').empty();
		$('#lb_tbl').empty();
		$('#blackbg').remove();
		$('#lb_tbl').remove();
		lock=false;
	});
}
}