function ctlightbox(boxId) {
	window.scrollTo(0,0);
	//backToTop();
	var bgbox = document.getElementById('ctlighboxOverlay');
	if(bgbox) {
		new Effect.Appear('ctlighboxOverlay', {duration: 0.5, to: 0.8, afterFinish: function(o) { openCtlightbox(boxId,o); } });
	}
}

function openCtlightbox(boxId) {
	var ctlightbox = document.getElementById('ctlightbox');
	var lighboxcontent = document.getElementById(boxId);
	
	if(ctlightbox) {
		ctlightbox.innerHTML = '<div id="activeLighboxCt" style="display:none"></div>';
		ctlightboxContainer = document.getElementById('activeLighboxCt');
		ctcopy = lighboxcontent.cloneNode(true);
		ctlightboxContainer.appendChild(ctcopy);
		
		//new Effect.Appear('activeLighboxCt', {duration: 0.5, from: 0.0, to: 1.0});
		new Effect.BlindDown('activeLighboxCt', {from: 0.5, to: 1});
	}
}

function closeCtlightbox() {
	new Effect.Fade('ctlighboxOverlay', {duration: 0, afterFinish: cleanUpLightbox, from: 0.8});
	
	// use this code for animated closing of the lighbox
	/* new Effect.Fade('activeLighboxCt', {duration: 0.5});
	new Effect.Fade('ctlighboxOverlay', {duration: 0.5, afterFinish: cleanUpLightbox, from: 0.8}); */
}

function cleanUpLightbox() {
	var ctlightbox = document.getElementById('ctlightbox');
	var container = document.getElementById('activeLighboxCt');
	ctlightbox.removeChild(container);
}

function backToTop() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
	if (document.documentElement) {
			x1 = document.documentElement.scrollLeft || 0;
			y1 = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
			x2 = document.body.scrollLeft || 0;
			y2 = document.body.scrollTop || 0;
	}
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 100), Math.floor(y / 100));
	if (x > 0 || y > 0) {
			window.setTimeout("backToTop()", 25);
	}
}
