// JavaScript Document

function enableClientButtons(id)
{
	if(id)
	{
		document.forms['cal_manager'].editCalendar.disabled=false;
		document.forms['cal_manager'].delCalendar.disabled=false;
	}
	else{
		document.forms['cal_manager'].editCalendar.disabled=true;
		document.forms['cal_manager'].delCalendar.disabled=true;
	}
}


// Begin Light Box Functions

function showLB(){

	LBoxContainer = '#lightBoxContainer';
	LBox = '#lightBox';

	documentHeight = ($(document).height());
	documentWidth = ($(document).width());
	windowHeight = ($(window).height());
	windowWidth = ($(window).width());

	$(LBox).css('opacity',0);
	$(LBoxContainer).css('opacity',0);


	$(LBox).css('display','block');
	$(LBoxContainer).css('display','block');

	$(LBoxContainer).css('width',documentWidth);
	$(LBoxContainer).css('height',documentHeight);

	nlcLeftPos = (windowWidth - 300) / 2;
	nlcTopPos = 200;
	// nlcTopPos = ((windowHeight - 100) / 2);
	$(LBox).css('left',nlcLeftPos);
	$(LBox).css('top',nlcTopPos);

	$(LBoxContainer).fadeTo(100,.5);
	$(LBox).fadeTo(300,1);
}

function hideLB(){
	LBoxContainer = '#lightBoxContainer';
	LBox = '#lightBox';
	
	$(LBox).css('display','none');
	$(LBoxContainer).css('display','none');
}

function openLightBox(element, id)
{
	switch(element)
	{
		case 'addCalEvent':
			$('#lightBox').load('requests/event_form.php');
			break;
		case 'eventEdit':
			$('#lightBox').load('requests/event_form.php?event_id=' + id);
			break;
		case 'addCal':
			$('#lightBox').load('requests/calendar_add.php');
			break;
		case 'editCal':
			$('#lightBox').load('requests/calendar_edit.php?cal_id=' + id);
			break;		
		case 'delCal':
			$('#lightBox').load('requests/calendar_delete_confirm.php?cal_id=' + id);
			break;	
		case 'manCal':
			$('#lightBox').load('requests/calendar_manage.php');
			break;							
		case 'eventDelete':
			$('#lightBox').load('requests/event_delete_confirm.php?id=' + id);
			break;
		case 'newsDelete':
			$('#lightBox').load('requests/news_delete_confirm.php?id=' + id);
			break;
		default:
			$('#lightBox').load('requests/error.php');
			break;
	}
	showLB();
}

