//Common Settings
var LightboxHTMLWidth = 550;
var LightboxHTMLHeight = 450;


//Create Lightbox
document.write('<div id="xi-fader"></div>');
document.write('<div id="xi-lightbox"><table border="0" cellspacing="0" cellpadding="0" align="center" id="xi-lightbox-window"><tr><td>');
document.write('<a href="javascript:CloseLightbox();" style="position:relative; float:left; margin-left:-5px; margin-top:-5px; margin-bottom: -40px;"><img src="js/images/closecircle.png" width="30" height="30" border="0"></a></td></tr><tr><td>');
document.write('<div id="xi-lightbox-frame" style="height:'+LightboxHTMLHeight+'; width: '+LightboxHTMLWidth+'"></div>');
document.write('</td></tr></table></div>');
$("#xi-fader").animate({opacity: 0}, 1);
$("#xi-lightbox").animate({opacity: 0}, 1);


//Framework Functions
$(document).ready(function(){

xiTimer();

//HTML Lightbox
$(".lightbox-html").click(function () {
	LightBoxAlign();
	document.getElementById('xi-fader').style.display="block";
	document.getElementById('xi-lightbox').style.display="block";
	$("#xi-lightbox-frame").load(this.href);
	$("#xi-fader").animate({opacity: 0.7}, 200, function(){
	$("#xi-lightbox").animate({opacity: 1}, 500)});	
	return false;
});

});

//Show/Hide Divs
function display_div(div_id)
{
	$("#"+div_id).fadeIn(200);
}
function hide_div(div_id)
{
	$("#"+div_id).fadeOut(200);
}
//=====================Static Funcitons
//Align Lightbox
function LightBoxAlign()
{
	var CurrentPosH=document.body.scrollTop;
	document.getElementById('xi-fader').style.top = document.body.scrollTop;
	document.getElementById('xi-lightbox').style.top = document.body.clientHeight/2+document.body.scrollTop;
	document.getElementById('xi-lightbox').style.marginTop=((LightboxHTMLHeight+20)/2)*(-1);
}
//CloseLightbox
function CloseLightbox()
{
	$("#xi-lightbox").animate({opacity: 0}, 500, function(){
	$("#xi-fader").animate({opacity: 0}, 500, function(){
			document.getElementById('xi-fader').style.display="none";
			document.getElementById('xi-lightbox').style.display="none";
		});
	})
}
//Timed Ecents (miliseconds)
function xiTimer()
{
	LightBoxAlign()
	Timer=setTimeout("xiTimer()",10);
}
