
// version 1.0

// Alert text

var global_FloatingTextArray;
var global_FloatingTextDefaultSpeed;

var global_FloatingTextObjects;

// message bars and lightboxes

var messageBoxes;
//define universal reference to "staticcontent"
var topMessageBox; 
//define reference to the body object in IE
var iebody;

var global_darkBox;
var global_lightBox;
var global_lightboxContent;

//opacity
var darkBoxOpacity = 0;
var darkBoxInterval = null;
var lightBoxOpacity = 0;
var lightBoxInterval = null;
var lightBoxXInterval = null;
var lightBoxYInterval = null;

var lightBoxContentOpacity = 0;
var lightBoxContentInterval = null;

//speed of fading in/out
var opacitySpeed = 10;
var growSpeed = 10;

//size the box
var lightboxTargetWidth;
var lightboxTargetHeight;

//content
var lightboxContentPage="";
var lightboxScript="";

//Replace javascript's alert and confirm boxes
function ShowModal(title,message,buttons)
{
	var height = (Math.floor(message.length/40) +1) *14;	

	ShowDarkBox();
	ShowLightBoxWithScript(300,(height+84),title,'','turnOnLightboxContent();');
	var e = $('lightBoxDefaultInnerContent');
	var html = "<div style=\"margin-left:8px;margin-right:8px;font-size:12px\">"+message+"</div>";
	html +="<div style=\"margin-top:14px;\">";
	var buttoncount = buttons.length;	
	for(var i=0;i<buttoncount;i++)
		html += "<button style=\"width:100px;height:25px;font-size:14px;margin-right:8px;float:right;\" onclick=\""+buttons[i]["script"]+"HideDarkBox();HideLightBox();\">"+buttons[i]["label"]+"</button>";	
	html += "<div style=\"clear:both;\"></div></div>";
	e.innerHTML = html;
}

function ShowAlert(title,message)
{
	var height = (Math.floor(message.length/40) +1) *14;	

	ShowDarkBox();
	ShowLightBoxWithScript(300,(height+84),title,'','turnOnLightboxContent();');
	var e = $('lightBoxDefaultInnerContent');
	var html = "<div style=\"margin-left:8px;margin-right:8px;font-size:12px\">"+message+"</div>";
	html +="<div style=\"margin-top:14px;margin-left:100px;\"><button style=\"width:100px;height:25px;font-size:14px\" onclick=\"HideDarkBox();HideLightBox();redirect(window.location.href);\">OK</button></div>";
	e.innerHTML = html;
	//alert(message);
}

function floatingText(element,hostElementID,positionElementID,fadeIn,fadeOut,lifeSpan,xVelocity,yVelocity,speed,arrayIndex,opacity)
{
	this.element = element;
	this.hostElement = $(hostElementID);
	this.positionElement = $(positionElementID);	
	this.fadeIn = fadeIn;
	this.fadeOut = fadeOut;
	this.lifeSpan = lifeSpan;
	this.xVelocity = xVelocity;
	this.yVelocity = yVelocity;
	this.speed = speed;
	this.age =0;
	this.opacity = opacity;
	this.interval = setInterval('AnimateFloatingTextObject('+ arrayIndex +');',speed);
}

//animate and/or remove floating text element from the page.
function AnimateFloatingTextObject(arrayIndex)
{
	var floatObject = global_FloatingTextObjects[arrayIndex];	
	var element = floatObject.element;
	
	if(element && floatObject.age < floatObject.lifeSpan)
	{			
		// fade
		if(floatObject.fadeIn && floatObject.fadeIn > 0)
		{			
			floatObject.opacity += floatObject.fadeIn;
			element.style.opacity = floatObject.opacity;
			element.style.filter = 'alpha(opacity='+(floatObject.opacity*100)+')';
		}
		else if(floatObject.fadeOut && floatObject.fadeOut > 0)
		{
			floatObject.opacity -= floatObject.fadeOut;
			element.style.opacity = floatObject.opacity;
			element.style.filter = 'alpha(opacity='+(floatObject.opacity*100)+')';
		}
		
		//move
		if(floatObject.xVelocity && floatObject.xVelocity != 0)
		{
			element.style.left = (parseInt(element.style.left) + floatObject.xVelocity) + "px";
		}
		if(floatObject.yVelocity && floatObject.yVelocity != 0)
		{
			element.style.top = (parseInt(element.style.top) + floatObject.yVelocity) + "px";
		}
	
		//alert("recursing");
		floatObject.age += floatObject.speed;		
	}
	else
	{
		//alert("culling "+index);		
		if(floatObject.hostElement)		
			floatObject.hostElement.removeChild(element);
			
		if(element)
			element = null;
		
		clearInterval(floatObject.interval);
	}
}

function InitFloatingTexts()
{
	global_FloatingTextArray = new Array();
	global_FloatingTextDefaultSpeed = 2;
	global_FloatingTextObjects = new Array();
}

function FloatingText_AddObjectAtElement(hostElementID,positionElementID,x,y,textClass,htmlString,zIndex,fadeIn,fadeOut,lifeSpan,xVelocity,yVelocity,speed)
{
	if($("BrowserFlags_msie") || $("BrowserFlags_trident"))
	{
		if(!$("BrowserFlags_chrome"))	
			return false; // This won't work on IE! Install Google Chrome Frame!!!
	}

	var newText = document.createElement("div");
	var divPosition = getPos($(positionElementID));
	var startX = divPosition.x + x;
	var startY = divPosition.y + y;
	var arraySize = global_FloatingTextObjects.length;
	
	newText.style.left = startX + "px";
	newText.style.top = startY + "px";
	newText.className = textClass;
	newText.innerHTML = htmlString;
	newText.style.zIndex = zIndex;	
	newText.Id = "floatingText_"+arraySize;
	
	if(!speed)
		speed = global_FloatingTextDefaultSpeed;		
		
	var opacity =0;
	if(fadeIn && fadeIn > 0)
	{
		newText.style.opacity = "0.0";
		newText.style.filter = 'alpha(opacity=0)';	
		opacity =0;
	}
	else if(fadeOut && fadeOut > 0)
	{
		newText.style.opacity = "1.0";
		newText.style.filter = 'alpha(opacity=100)';	
		opacity =1;		
	}
	
	$(hostElementID).appendChild(newText);
	
	if(!arraySize )
		arraySize = 0;
	
	global_FloatingTextObjects[arraySize] = new floatingText(newText,hostElementID,positionElementID,fadeIn,fadeOut,lifeSpan,xVelocity,yVelocity,speed,arraySize,opacity);
}


//Add a floating text element to the page
function FloatingText_AddAtElement(hostElementID,positionElementID,x,y,textClass,htmlString,zIndex,fadeIn,fadeOut,lifeSpan,xVelocity,yVelocity,speed)
{
	var newText = document.createElement("div");
	var divPosition = getPos($(positionElementID));
	var startX = divPosition.x + x;
	var startY = divPosition.y + y;
	var arraySize = global_FloatingTextArray.length;	
	
	newText.style.left = startX + "px";
	newText.style.top = startY + "px";
	newText.className = textClass;
	newText.innerHTML = htmlString;
	newText.style.zIndex = zIndex;	
	newText.Id = "floatingText_"+arraySize;
	
	if(!speed)
		speed = global_FloatingTextDefaultSpeed;		
	
	var opacity =0;
	if(fadeIn && fadeIn > 0)
	{
		newText.style.opacity = "0.0";
		newText.style.filter = 'alpha(opacity=0)';	
		opacity =0;
	}
	else if(fadeOut && fadeOut > 0)
	{
		newText.style.opacity = "1.0";
		newText.style.filter = 'alpha(opacity=100)';	
		opacity =1;		
	}
	
	$(hostElementID).appendChild(newText);
		
	global_FloatingTextArray[arraySize] = new Array();
	global_FloatingTextArray[arraySize]["element"] = newText;
	global_FloatingTextArray[arraySize]["timeout"] = setTimeout('AnimateFloatingText(\''+hostElementID+'\','+arraySize+','+fadeIn+','+fadeOut+','+lifeSpan+','+xVelocity+','+yVelocity+',0,'+speed+','+opacity+');',speed);
	
	//alert("added "+arraySize);
}

//animate and/or remove floating text element from the page.
function AnimateFloatingText(hostElementID,index,fadeIn,fadeOut,lifeSpan,xVelocity,yVelocity,age,speed,opacity)
{
	//alert("moving");
	var element = global_FloatingTextArray[index]["element"];
	
	if(element && age < lifeSpan)
	{			
		// fade
		if(fadeIn && fadeIn > 0)
		{			
			opacity += fadeIn;
			element.style.opacity = opacity;
			element.style.filter = 'alpha(opacity='+(opacity*100)+')';
		}
		else if(fadeOut && fadeOut > 0)
		{
			opacity -= fadeOut;
			element.style.opacity = opacity;
			element.style.filter = 'alpha(opacity='+(opacity*100)+')';
		}
		
		//move
		if(xVelocity && xVelocity != 0)
		{
			element.style.left = (parseInt(element.style.left) + xVelocity) + "px";
		}
		if(yVelocity && yVelocity != 0)
		{
			element.style.top = (parseInt(element.style.top) + yVelocity) + "px";
		}
	
		//alert("recursing");
		age += speed;
		//alert('AnimateFloatingText(\''+hostElementID+'\','+index+','+fadeIn+','+fadeOut+','+lifeSpan+','+xVelocity+','+yVelocity+','+age+','+speed+','+opacity+');');
		global_FloatingTextArray[index]["timeout"] = setTimeout('AnimateFloatingText(\''+hostElementID+'\','+index+','+fadeIn+','+fadeOut+','+lifeSpan+','+xVelocity+','+yVelocity+','+age+','+speed+','+opacity+');',speed);
		//alert("at end");
	}
	else
	{
		//alert("culling "+index);
		var host = $(hostElementID);
		if(host)		
			host.removeChild(element);
			
		if(element)
			element = null;
		
		global_FloatingTextArray[index]["timeout"] = null;
	}
}

function turnOnLightboxContent()
{
	//lightBoxContentInterval = setInterval('LightBoxContent_ON();',1);
	LightBoxContent_ON();
}

function clearIntervals()
{
	window.clearInterval(lightBoxContentInterval);
	window.clearInterval(lightBoxXInterval);
	window.clearInterval(lightBoxYInterval);
	window.clearInterval(darkBoxInterval);
	window.clearInterval(lightBoxInterval);
}

function LightBoxContent_ON()
{
	//if(lightBoxContentOpacity <100)
	//{
//		global_lightboxContent.style.opacity = lightBoxContentOpacity/100;
		//if(global_lightboxContent.style.filter)		
			//global_lightboxContent.style.filter = 'alpha(opacity=' + lightBoxContentOpacity + ')';
		
	//	lightBoxContentOpacity = lightBoxContentOpacity +opacitySpeed;
		//alert(lightBoxOpacity);
	//}
	//else
	//{
		lightBoxContentOpacity = 100;
		//alert("clear interval");
	//	window.clearInterval(lightBoxContentInterval);

		//make sure everything is opaque
		global_lightboxContent.style.opacity = 1.0;
		//if(global_lightboxContent.style.filter)			
		global_lightboxContent.style.filter = 'alpha(opacity=' + 100 + ')';
		//global_lightboxContent.style.backgroundImage="url(img/parchment_cream.jpg)";
		//global_lightboxContent.style.backgroundRepeat="repeat";
		
		//make sure all intervals are cleaed
//		clearIntervals();
		
	//}
	//alert("hideloader?");
	HideLoader();
}

function lightboxExpandX() // also shrinks if neccessary
{
	/*
	if(parseInt(global_lightBox.style.width) != lightboxTargetWidth)
	{
		if(parseInt(global_lightBox.style.width) < lightboxTargetWidth)
		{
			global_lightBox.style.width = (parseInt(global_lightBox.style.width) + growSpeed) + "px";
			if (parseInt(global_lightBox.style.width) > lightboxTargetWidth)
			{
				global_lightBox.style.width = lightboxTargetWidth + "px";
			}
		}
		else
		{
			global_lightBox.style.width = (parseInt(global_lightBox.style.width) - growSpeed) + "px";
			if (parseInt(global_lightBox.style.width) < lightboxTargetWidth)
			{
				global_lightBox.style.width = lightboxTargetWidth + "px";
			}
		}
		centerLightbox();
		AlignLoader();
	}
	else
	{
		window.clearInterval(lightBoxXInterval);
		global_lightBox.style.border="2px solid black";
		centerLightbox();
		AlignLoader();
				
		//load lightbox content by page
		if(lightboxContentPage != "" && lightboxScript == "")
		{
			var postData = new Array();
			postData["divID"] = "lightBoxDefaultInnerContent";
			postData["pageURL"] = lightboxContentPage;
			//alert("lbcont: "+lightboxContentPage);		
			postData["postCallbackScript"] = "lightBoxContentInterval = setInterval('LightBoxContent_ON();',1);"
			doCallbackPost(serverScriptUrl,"RefreshDivFromPage",postData,null);
		}
		//load lightbox content by script
		if(lightboxScript != "" && lightboxContentPage == "")
		{
			//alert("script: "+lightboxScript);
			eval(lightboxScript);
		}
	} */
		
	global_lightBox.style.width = lightboxTargetWidth + "px";
	centerLightbox();
	//ShowLightboxLoader("lightBoxDIV",null);
	//AlignLoader();
	
	//load lightbox content by page
	if(lightboxContentPage != "" && lightboxScript == "")
	{
		var postData = new Array();
		postData["divID"] = "lightBoxDefaultInnerContent";
		postData["pageURL"] = lightboxContentPage;
		//alert("lbcont: "+lightboxContentPage);		
		postData["postCallbackScript"] = "LightBoxContent_ON();"
		doCallbackPost(serverScriptUrl,"RefreshDivFromPage",postData,null);
	}
	//load lightbox content by script
	if(lightboxScript != "" && lightboxContentPage == "")
	{
		//alert("script: "+lightboxScript);
		eval(lightboxScript);
	}
}

function lightboxExpandY() // also shrinks if neccessary
{
	//if(parseInt(global_lightBox.style.height) != lightboxTargetHeight)
	//{
		//if(parseInt(global_lightBox.style.height) < lightboxTargetHeight)
		//{
			//global_lightBox.style.height = (parseInt(global_lightBox.style.height) + growSpeed) + "px";
			//if (parseInt(global_lightBox.style.height) > lightboxTargetHeight)
			//{
				//global_lightBox.style.height = lightboxTargetHeight + "px";
//			}
		//}
		//else
		//{
			//global_lightBox.style.height = (parseInt(global_lightBox.style.height) - growSpeed) + "px";
			//if (parseInt(global_lightBox.style.height) < lightboxTargetHeight)
			//{
				//global_lightBox.style.height = lightboxTargetHeight + "px";
//			}
		//}
		//centerLightbox();
//		AlignLoader();
	//}
	//else
	//{
		//window.clearInterval(lightBoxYInterval);
//		lightBoxXInterval = setInterval("lightboxExpandX();",10);
	//}
	
	centerLightbox();
	//AlignLoader();
	global_lightBox.style.height = lightboxTargetHeight + "px";
	lightboxExpandX();
}

function centerLightbox()
{
	var viewportwidth = window.innerWidth? window.innerWidth : document.body.clientWidth;
	if(!($("HTMLNODE")) || !($("HTMLNODE").clientHeight))
		var viewportheight = 600;
	else
		var viewportheight = $("HTMLNODE").clientHeight;
		
	var boxheight = global_lightBox.offsetHeight;
	var boxwidth = global_lightBox.offsetWidth;
	
	//alert(boxwidth);
	//alert(viewportheight);
	
	global_lightBox.style.left = ((viewportwidth/2) - (boxwidth/2)) + "px";
	var ypos = ((viewportheight/2) - (boxheight/2));	
	var dsoctop=document.all? iebody.scrollTop : pageYOffset
	global_lightBox.style.top = (ypos + dsoctop) + "px";
	
	//If the IE map is showing - move the IE map to follow the lightbox
	if($('IeMapWrapperDIV') && $('IeMapWrapperDIV').style.display == "block")
	{
		$('IeMapWrapperDIV').style.left = ((viewportwidth/2) - (boxwidth/2) + 310 ) + "px";
		$('IeMapWrapperDIV').style.top = (ypos + dsoctop + 38) + "px";
	}
	
	//alert(global_lightBox.style.left);
	//alert(global_lightBox.style.top);
	//alert("OI! "+global_lightBox.left+", "+global_lightBox.top);
	//alert((viewportwidth/2) - (boxwidth/2));
	//alert((viewportheight/2) - (boxheight/2));
}

function ShowLightBoxWithScript(width,height,title,page,script)
{
	if(!global_darkBox || !global_lightBox)
		messageBoxesInit();

	if(global_darkBox != null && !global_darkBox.style)
		global_darkBox.setAttribute=("style","display:none;");
	if(global_lightBox != null && !global_lightBox.style)
		global_lightBox.setAttribute=("style","display:none;");

	ShowDarkBox();
	//If lightbox is off, turn it on
	//If lightbox is wrong size, resize it
	//Otherwise leave it
	if(global_lightBox.style.display == "none" || !global_lightBox.style.width || !global_lightBox.style.height)
	{
		//alert("defaulting");
		global_lightBox.style.display="block";
		global_lightBox.style.width="100px";
		global_lightBox.style.height="100px";			
	}
	
	//Make lightbox content completely transparent
	global_lightboxContent.style.opacity = 0;
	global_lightboxContent.style.filter = 'alpha(opacity=' + 0 + ')';
	
	lightboxTargetWidth = width;
	lightboxTargetHeight = height;
	centerLightbox();
	//lightBoxInterval = setInterval("setLightBoxOpacity_ON();",10);
	
	$("lightBoxDefaultHeader").innerHTML = title;
	lightboxContentPage = page;
	lightboxScript = script;
	
	setLightBoxOpacity_ON();
	
	//IE compat - if lightbox was under ie google map fix, hide the map
	if($('IeMapWrapperDIV'))
		$('IeMapWrapperDIV').style.display = 'none';
}

function ShowLightBox(width,height,title,page)
{
	if(!global_darkBox || !global_lightBox)
		messageBoxesInit();

	if(global_darkBox != null && !global_darkBox.style)
		global_darkBox.setAttribute=("style","display:none;");
	if(global_lightBox != null && !global_lightBox.style)
		global_lightBox.setAttribute=("style","display:none;");

	global_lightBox.style.display="block";
	global_lightBox.style.width="100px";
	global_lightBox.style.height="100px";
	//Make lightbox content completely transparent
	global_lightboxContent.style.opacity = 0;		
	global_lightboxContent.style.filter = 'alpha(opacity=' + 0 + ')';
	centerLightbox();
	//lightBoxInterval = setInterval("setLightBoxOpacity_ON();",10);
	lightboxTargetWidth = width;
	lightboxTargetHeight = height;
	$("lightBoxDefaultHeader").innerHTML = title;
	lightboxContentPage = page;
	lightboxScript="";
	
	setLightBoxOpacity_ON();	
	
	//IE compat - if lightbox was under ie google map fix, hide the map
	if($('IeMapWrapperDIV'))
		$('IeMapWrapperDIV').style.display = 'none';
}

function HideLightBox()
{
	//lightBoxInterval = setInterval("setLightBoxOpacity_OFF();",10);
	//IE compat - if lightbox was under ie google map fix, hide the map
	setLightBoxOpacity_OFF();
	if($('IeMapWrapperDIV'))
		$('IeMapWrapperDIV').style.display = 'none';
}

function ShowDarkBox()
{
	global_darkBox.style.display="block";
	//darkBoxInterval = setInterval("setDarkBoxOpacity_ON();",10);
	setDarkBoxOpacity_ON();
}

function HideDarkBox()
{
	//darkBoxInterval = setInterval("setDarkBoxOpacity_OFF();",10);
	setDarkBoxOpacity_OFF();
}

function setLightBoxOpacity_OFF()
{
	//if(lightBoxOpacity >0)
	//{
		//global_lightBox.style.opacity = lightBoxOpacity/100;
		//if(global_lightBox.style.filter)
			//global_lightBox.style.filter = 'alpha(opacity=' + lightBoxOpacity + ')';
		
//		lightBoxOpacity = lightBoxOpacity -opacitySpeed;
	//}
	//else
	//{
		//window.clearInterval(lightBoxInterval);
//		global_lightBox.style.display="none";
	//}
	
	global_lightBox.style.opacity = 0.0;
	global_lightBox.style.filter = 'alpha(opacity=' + 00 + ')';
	global_lightBox.style.display="none";
}

function setLightBoxOpacity_ON()
{
//	if(lightBoxOpacity <100)
//	{
//		global_lightBox.style.opacity = lightBoxOpacity/100;
		//if(global_lightBox.style.filter)
	//		global_lightBox.style.filter = 'alpha(opacity=' + lightBoxOpacity + ')';
		
//		lightBoxOpacity = lightBoxOpacity +opacitySpeed;
		//alert(lightBoxOpacity);
	//}
	//else
	//{
		//alert("clear interval");
		//window.clearInterval(lightBoxInterval);
		//lightBoxYInterval = setInterval("lightboxExpandY();",10);
		//global_lightBox.style.opacity = 1.0;
		//if(global_lightBox.style.filter)
//			global_lightBox.style.filter = 'alpha(opacity=' + 100 + ')';
		
	//}
	
	
	global_lightBox.style.opacity = 1.0;
	global_lightBox.style.filter = 'alpha(opacity=' + 100 + ')';
	lightboxExpandY();
}

function setDarkBoxOpacity_OFF()
{
	//alert(darkBoxOpacity);
	//alert(darkBoxOpacity/100);
	//if(darkBoxOpacity >0)
//	{		
//		global_darkBox.style.opacity = darkBoxOpacity/100;
		//if(global_darkBox.style.filter)
	//		global_darkBox.style.filter = 'alpha(opacity=' + darkBoxOpacity + ')';
		
//		darkBoxOpacity = darkBoxOpacity -opacitySpeed;		
	//}
	//else
	//{
		//window.clearInterval(darkBoxInterval);
		//global_darkBox.style.display="none";
		//global_lightBox.style.opacity = 0.0;
		//if(global_lightboxContent.style.filter)
//			global_lightBox.style.filter = 'alpha(opacity=' + 000 + ')';
		//global_lightboxContent.style.opacity = 0.0;
		
		//if(global_lightboxContent.style.filter)
			//global_lightboxContent.style.filter = 'alpha(opacity=' + 000 + ')';
	//}
	
	global_darkBox.style.opacity = 0.0;		
	global_darkBox.style.filter = 'alpha(opacity=' + 00 + ')';
	global_darkBox.style.display="none";
}

function setDarkBoxOpacity_ON()
{
	//alert(darkBoxOpacity);
	//alert(darkBoxOpacity/100);
	//if(darkBoxOpacity <90)
	//{		
		//global_darkBox.style.opacity = darkBoxOpacity/100;
		//if(global_darkBox.style.filter)
			//global_darkBox.style.filter = 'alpha(opacity=' + darkBoxOpacity + ')';
		
		//darkBoxOpacity = darkBoxOpacity +opacitySpeed;		
//	}
//	else
//	{
		//alert("clear interval");
//		window.clearInterval(darkBoxInterval);
	//}
	
	global_darkBox.style.opacity = 0.7;		
	global_darkBox.style.filter = 'alpha(opacity=' + 70 + ')';
}

function positionMessageBox()
{
	//define universal dsoc left point
	var dsocleft=document.all? iebody.scrollLeft : pageXOffset
	//define universal dsoc top point
	var dsoctop=document.all? iebody.scrollTop : pageYOffset

	//if the user is using IE 4+ or Firefox/ NS6+
	if (document.all||document.getElementById)
	{
		//crossobj.style.left=parseInt(dsocleft)+5+"px"
		if(topMessageBox != null)
			topMessageBox.style.top=dsoctop+5+"px"
	}
}

function messageBoxesInit()
{
	//alert("boxinit");
	window.onresize = scrollAlerts;
	window.onscroll = scrollAlerts;
	topMessageBox = document.getElementById("MessageBoxTop");
	iebody =(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
	messageBoxes = new Array();
	global_darkBox = $("darkBoxDIV");
	global_lightBox = $("lightBoxDIV");
	global_lightboxContent = $("lightboxContent");
	
	if(global_darkBox != null && !global_darkBox.style)
		global_darkBox.setAttribute=("style","display:none;");
	if(global_lightBox != null && !global_lightBox.style)
		global_lightBox.setAttribute=("style","display:none;");
	
	//test darkbox
	//ShowDarkBox();
	//test lightbox
	//ShowLightBox(400,200);
}

//attach to window.onscroll and use to reposition messages and dialogs
function scrollAlerts()
{
	//alert("scroll event detected! "+window.pageXOffset+" "+window.pageYOffset);
	//setInterval("positionit()",100)
	positionMessageBox();
	centerLightbox();
	AlignLoader();
}

