var Overlay = {

	docX: 0,
	docY: 0,

	init: function(){
	
		Overlay.docX = $(document).width();
		Overlay.docY = $(document).height();	
	
	},
	
	close: function(){
	
		$("#overlay").fadeOut(500);
	
	},
	
	closeListen: function(){
	
		$("#overlay").click(Overlay.close);
	
	},
	
	show: function(){
	
		Overlay.init();
	
		$("body").append('<div id="overlay">&nbsp;</div>');
	
		$("#overlay").css("width",Overlay.docX);
		$("#overlay").css("height",Overlay.docY);
		$("#overlay").fadeTo(10,0.65);
		$("#overlay").show();
		
		// Overlay.closeListen();
	
	}

}


var CornersTest = {

	init: function(){
	
		var CornerDiv = $(".CornerDiv");
		
		for(var x = 0; x < CornerDiv.length; x++){
		
			$(CornerDiv[x]).corners();
		
		}
		
		var CornerDivText = $(".CornerDivText");
		
		for(var x = 0; x < CornerDivText.length; x++){
		
			$(CornerDivText[x]).corners();
		
		}
	
	}

}

//$(document).ready(CornersTest.init);

var CornersTest2 = {

	init: function(){
	
		var CornerDiv = $(".CornerDiv");
		
		for(var x = 0; x < CornerDiv.length; x++){
		
			$(CornerDiv[x]).corner("keep");
		
		}
		
		var CornerDivText = $(".CornerDivText");
		
		for(var x = 0; x < CornerDivText.length; x++){
		
			$(CornerDivText[x]).corner("keep");
		
		}
	
	}

}

// $(document).ready(CornersTest2.init);

var CornersTable = {

	init: function(){
	
		if($.browser.msie){
		
			var CornerDiv = $(".NewCornerDiv");
			
			for(var x = 0; x < CornerDiv.length; x++){
			
				var cdw = $(CornerDiv[x]).width();
				var cdh = $(CornerDiv[x]).height();
				
				var tw = cdw + 22;
				var th = cdh + 20;
			
				if( CornerDiv[x].parentNode.innerHTML.indexOf( 'CornerTopLeft' ) == -1 )
					$(CornerDiv[x]).before('<table style="margin: 0 0 -10px 0; width: ' + tw + 'px; height: 10px;" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td class="CornerTopLeft">&nbsp;</td><td class="BorderTop">&nbsp;</td><td class="CornerTopRight">&nbsp;</td></tr></table>').after('<table style="margin: -10px 0 0 0; width: ' + tw + 'px; height: 10px;" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td class="CornerBottomLeft">&nbsp;</td><td class="BorderBottom" style="border-bottom: 1px solid #fff;">&nbsp;</td><td class="CornerBottomRight">&nbsp;</td></tr></tbody></table>');
			
			}
			
			var CornerDivText = $(".NewCornerDivText");
			
			for(var x = 0; x < CornerDivText.length; x++){
			
				var cdw = $(CornerDivText[x]).width();
				var cdh = $(CornerDivText[x]).height();
				
				var tw = cdw + 2;
				var th = cdh + 20;
			
				$(CornerDivText[x]).before('<table style="margin: -10px 0 0 0; width: ' + tw + 'px; height: 10px;" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td class="CornerTopLeft">&nbsp;</td><td class="BorderTop">&nbsp;</td><td class="CornerTopRight">&nbsp;</td></tr></table>').after('<table style="margin: 0; width: ' + tw + 'px; height: 10px;" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td class="CornerBottomLeft">&nbsp;</td><td class="BorderBottom" style="border-bottom: 1px solid #fff;">&nbsp;</td><td class="CornerBottomRight">&nbsp;</td></tr></tbody></table>');
			
			}
		
		}else{
		
			var CornerDiv = $(".CornerDiv");
		
			for(var x = 0; x < CornerDiv.length; x++){
			
				$(CornerDiv[x]).corners();
			
			}
			
			var CornerDivText = $(".CornerDivText");
			
			for(var x = 0; x < CornerDivText.length; x++){
			
				$(CornerDivText[x]).corners();
			
			}
		
		}
	
	}

}

$(document).ready(CornersTable.init);

var SiteNavigation = {

	current_subnav: '',

	init: function(){
	
		$(".SiteNav").mouseover(SiteNavigation.buttonOn);
		
		SiteNavigation.defaultNav();
	
	},
	
	defaultNav: function(){
	
		var page = document.URL;
	
		switch(page){
		
			case Base.base_path + 'members/index.php':
			case Base.base_path + 'members/ProfilePage.php':
			case Base.base_path + 'members/JournalDiary.php':
			case Base.base_path + 'members/Groups.php':
			case Base.base_path + 'members-interface.php':
			case Base.base_path + 'members/Logout.php':
				SiteNavigation.current_subnav = 'members';
				SiteNavigation.moveSubNav();
				SiteNavigation.defaultButtonOn();
				$("#SubNav").load(Base.base_path + 'scripts/sub_nav_options.php?section=members',SiteNavigation.showSubNav);
				break;
				
			case Base.base_path + 'businessArea/FeedbackTestimonials.php':
			case Base.base_path + 'businessArea/CaseStudies.php':
			case Base.base_path + 'business.php':
				SiteNavigation.current_subnav = 'business';
				SiteNavigation.moveSubNav();
				SiteNavigation.defaultButtonOn();
				$("#SubNav").load(Base.base_path + 'scripts/sub_nav_options.php?section=business',SiteNavigation.showSubNav);
				break;
		
		}
	
	},
	
	buttonOn: function(){
	
		SiteNavigation.buttonsOff();
	
		// get button name
		var name = this.title;
		
		// find image node
		var img = this.childNodes[0].childNodes[0];
		
		img.src = Base.base_path + 'media/images/nav_' + name + '_on.gif';
		
		SiteNavigation.loadSubNav(name);
	
	},
	
	defaultButtonOn: function(){
	
		SiteNavigation.buttonsOff();
		
		var img = document.getElementById('NavButton-' + SiteNavigation.current_subnav);
		
		img.src = Base.base_path + 'media/images/nav_' + SiteNavigation.current_subnav + '_on.gif';
	
	},
	
	buttonOff: function(element){
	
		// get button name
		var name = element.title;
		
		// find image node
		var img = element.childNodes[0].childNodes[0];
		
		img.src = Base.base_path + 'media/images/nav_' + name + '.gif';
	
	},
	
	buttonsOff: function(){
	
		var SiteNavs = $(".SiteNav");
		
		for(var x = 0; x < SiteNavs.length; x++){
		
			SiteNavigation.buttonOff(SiteNavs[x]);
		
		}
	
	},
	
	loadSubNav: function(name){
	
		//if(SiteNavigation.current_subnav != name){
		//SiteNavigation.hideSubNav();
		//}
	
		SiteNavigation.current_subnav = name;
		
		//$("#SubNav").slideUp(500);
	
		//$("#SubNav").html('');
		
		SiteNavigation.moveSubNav();
		
		$("#SubNav").load(Base.base_path + 'scripts/sub_nav_options.php?section=' + name,SiteNavigation.showSubNav);
	
	},
	
	showSubNav: function(){
	
		$("#SubNav").slideDown(500);
	
	},
	
	hideSubNav: function(){
	
		$("#SubNav").fadeOut(200);
	
	},
	
	moveSubNav: function(){
	
		var position = 0;
	
		switch(SiteNavigation.current_subnav){
		
			case 'members':
			  position = 44;
			  break;
			case 'business':
			  position = 132;
			  break;
			case 'news':
			  position = 218;
			  break;
			case 'team':
			  position = 354;
			  break;
			case 'about':
			  position = 478;
			  break;
			case 'contact':
			  position = 546;
			  break;
		  
		}
		
		$("#SubNav").animate( { marginLeft: position + "px" }, 500 );
	
	}

}

$(document).ready(SiteNavigation.init);



var HomeProfiles = {

	current_profile: 1,
	timer: 0,

	init: function(){
	
		if(document.URL == Base.base_path + 'index.php' || document.URL == Base.base_path)	
		HomeProfiles.timer = setTimeout(function(){ HomeProfiles.nextProfile() },10000);
	
	},
	
	nextProfile: function(){
	
		if(HomeProfiles.current_profile == 4){
		
			HomeProfiles.current_profile = 1;
		
		}else{
		
			HomeProfiles.current_profile++;
		
		}
		
		HomeProfiles.moveArrow();
		
		$("#HomeProfileInner").hide();
	
		$("#HomeProfileInner").load(Base.base_path + 'scripts/home_profiles.php?profileID=' + HomeProfiles.current_profile);
		
		$("#HomeProfileInner").fadeIn(2000);
		
		
		
		HomeProfiles.timer = setTimeout(function(){ HomeProfiles.nextProfile() },10000);	
	
	},
	
	changeProfile: function(){
	
		
	
	},
	
	moveArrow: function(){
	
		var position = 0;
	
		switch(HomeProfiles.current_profile){
		
			case 1:
			  position = 55;
			  break;
			case 2:
			  position = 180;
			  break;
			case 3:
			  position = 320;
			  break;
			case 4:
			  position = 470;
			  break;
		  
		}
		
		$("#HomeProfileArrow").animate( { marginLeft: position + "px" }, 1000 );
	
	}
	

}

$(document).ready(HomeProfiles.init);



var PhotoReel = {

	timer: '',

	frames: '',
	
	current: '',

	init: function(){
	
		if(document.getElementById("PhotoReel")){
		
			var slides = document.getElementById("PhotoReel").childNodes;
	
			for(var x = 0; x < slides.length; x++){
			
				if(x==0)
				PhotoReel.current = slides[x];
	
			}
			
			$("#PhotoReelPrevious").click(PhotoReel.previousSlideClick);
			$("#PhotoReelNext").click(PhotoReel.nextSlideClick);
			
			PhotoReel.timer = setTimeout(function(){ PhotoReel.nextSlide() },8000);
		
		}
	
	},
	
	nextSlideClick: function(){
	
		PhotoReel.nextSlide();
		clearTimeout(PhotoReel.timer);
	
	},
	
	previousSlideClick: function(){
		
		PhotoReel.previousSlide();
		clearTimeout(PhotoReel.timer);
	
	},
	
	nextSlide: function(){
	
		var currentSlide = PhotoReel.current;
		
		if(currentSlide.nextSibling){
		var nextSlide = currentSlide.nextSibling;
		}else{
		var nextSlide = document.getElementById("PhotoReel").firstChild;
		}
	
		PhotoReel.current = nextSlide;
		
		$(currentSlide).hide();
		$(nextSlide).fadeIn(500);
		
		PhotoReel.timer = setTimeout(function(){ PhotoReel.nextSlide() },8000);
	
	},
	
	previousSlide: function(){
	
		var currentSlide = PhotoReel.current;
		
		if(currentSlide.previousSibling){
		var nextSlide = currentSlide.previousSibling;
		}else{
		var nextSlide = document.getElementById("PhotoReel").lastChild;
		}
	
		PhotoReel.current = nextSlide;
		
		$(currentSlide).hide();
		$(nextSlide).fadeIn(500);
		
		PhotoReel.timer = setTimeout(function(){ PhotoReel.nextSlide() },8000);
	
	}

}

$(document).ready(PhotoReel.init);


var YourPictures = {

	start: 0,

	init: function(){
	
		$("#YourPicturesUp").click(YourPictures.previousPics);
		$("#YourPicturesDown").click(YourPictures.nextPics);
	
	},
	
	previousPics: function(){
	
		if(YourPictures.start != 0)
		YourPictures.start -= 8;
		
		$("#YourPicturesRight").hide();
	
		$("#YourPicturesRight").load(Base.base_path + 'scripts/your_pictures.php?start=' + YourPictures.start,YourPictures.show);
	
	},
	
	nextPics: function(){
	
		YourPictures.start += 8;
		
		$("#YourPicturesRight").hide();
	
		$("#YourPicturesRight").load(Base.base_path + 'scripts/your_pictures.php?start=' + YourPictures.start,YourPictures.show);
	
	},
	
	show: function(){
	
		$("#YourPicturesRight").fadeIn(1000);
	
	}

}

$(document).ready(YourPictures.init);


var MeetTheTeam = {

	start: 0,

	init: function(){
	
		$("#MeetTheTeamUp").click(MeetTheTeam.previousPics);
		$("#MeetTheTeamDown").click(MeetTheTeam.nextPics);
	
	},
	
	previousPics: function(){
	
		if(MeetTheTeam.start != 0)
		MeetTheTeam.start -= 8;
		
		$("#MeetTheTeamLoadArea").hide();
	
		$("#MeetTheTeamLoadArea").load(Base.base_path + 'scripts/meet_the_team.php?start=' + MeetTheTeam.start,MeetTheTeam.show);
	
	},
	
	nextPics: function(){
	
		MeetTheTeam.start += 8;
		
		$("#MeetTheTeamLoadArea").hide();
	
		$("#MeetTheTeamLoadArea").load(Base.base_path + 'scripts/meet_the_team.php?start=' + MeetTheTeam.start,MeetTheTeam.show);
	
	},
	
	show: function(){
	
		$("#MeetTheTeamLoadArea").fadeIn(1000);
	
	}

}

$(document).ready(MeetTheTeam.init);

/* lightboxes */

var JournalLightBox = {

	boxWidth: "322",
	boxHeight: "452",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".JournalLightBox").click(JournalLightBox.show);
	
	},
	
	setMessageId: function( messageId ){
		JournalLightBox.messageId = messageId;
		JournalLightBox.show();
	},
	
	show: function(){
	
		JournalLightBox.docX = $(document).width();
		JournalLightBox.docY = $(document).height();
		JournalLightBox.winY = $(window).height();
		JournalLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="JournalLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		$("#JournalLightbox").load( Base.base_path + 'members/AddToPrivateJournal.php?reply_message_id=' + JournalLightBox.messageId );
		
		var alertTop = (JournalLightBox.winY - JournalLightBox.boxHeight) / 2;
		var alertLeft = (JournalLightBox.winX - JournalLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = JournalLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = JournalLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#JournalLightbox").css("width",JournalLightBox.boxWidth + 'px');
		$("#JournalLightbox").css("height",JournalLightBox.boxHeight + 'px');
		$("#JournalLightbox").css("top",alertTop);
		$("#JournalLightbox").css("left",alertLeft);
		$("#JournalLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(JournalLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#JournalLightbox").fadeOut(500);
		$("#JournalLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(JournalLightBox.init);


var JournalLightBoxBlue = {

	boxWidth: "322",
	boxHeight: "452",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".JournalLightBoxBlue").click(JournalLightBoxBlue.show);
	
	},
	
	show: function(){
	
		JournalLightBoxBlue.docX = $(document).width();
		JournalLightBoxBlue.docY = $(document).height();
		JournalLightBoxBlue.winY = $(window).height();
		JournalLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="JournalLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#JournalLightboxBlue").load(Base.base_path + 'includes/journal-form.inc');
		
		var alertTop = (JournalLightBoxBlue.winY - JournalLightBoxBlue.boxHeight) / 2;
		var alertLeft = (JournalLightBoxBlue.winX - JournalLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = JournalLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = JournalLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#JournalLightboxBlue").css("width",JournalLightBoxBlue.boxWidth + 'px');
		$("#JournalLightboxBlue").css("height",JournalLightBoxBlue.boxHeight + 'px');
		$("#JournalLightboxBlue").css("top",alertTop);
		$("#JournalLightboxBlue").css("left",alertLeft);
		$("#JournalLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(JournalLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#JournalLightboxBlue").fadeOut(500);
		$("#JournalLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(JournalLightBoxBlue.init);



var CaseStudyLightBox = {

	boxWidth: "602",
	boxHeight: "502",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".CaseStudyLightBox").click(CaseStudyLightBox.show);
	
	},
	
	setCaseStudyId: function( caseStudyId ){
		CaseStudyLightBox.caseStudyId = caseStudyId;
		CaseStudyLightBox.show();
	},
	
	show: function(){
	
		CaseStudyLightBox.docX = $(document).width();
		CaseStudyLightBox.docY = $(document).height();
		CaseStudyLightBox.winY = $(window).height();
		CaseStudyLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="CaseStudyLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#CaseStudyLightbox").load(Base.base_path + 'businessArea/CaseStudyDetail.php?case_study_id=' + CaseStudyLightBox.caseStudyId);
		
		var alertTop = (CaseStudyLightBox.winY - CaseStudyLightBox.boxHeight) / 2;
		var alertLeft = (CaseStudyLightBox.winX - CaseStudyLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = CaseStudyLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = CaseStudyLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#CaseStudyLightbox").css("width",CaseStudyLightBox.boxWidth + 'px');
		$("#CaseStudyLightbox").css("height",CaseStudyLightBox.boxHeight + 'px');
		$("#CaseStudyLightbox").css("top",alertTop + 'px');
		$("#CaseStudyLightbox").css("left",alertLeft + 'px');
		$("#CaseStudyLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(CaseStudyLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#CaseStudyLightbox").fadeOut(500);
		$("#CaseStudyLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(CaseStudyLightBox.init);

var PhotoLightBox = {

	boxWidth: "504",
	boxHeight: "384",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,
	photoId: 0,

	init: function(){
	
		$(".PhotoLightBox").click(PhotoLightBox.show);
	
	},
	
	setPhotoId: function( rowNum, colNum ){
		PhotoLightBox.photoId = parseInt( rowNum ) + parseInt( colNum );
		PhotoLightBox.show();
	},
	
	show: function(){
	
		LightboxPhotoReel.setRotate( '0' );
		
		PhotoLightBox.docX = $(document).width();
		PhotoLightBox.docY = $(document).height();
		PhotoLightBox.winY = $(window).height();
		PhotoLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="PhotoVideoLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		$("#PhotoVideoLightbox").load(Base.base_path + 'members/PhotoView.php?start=' + PhotoLightBox.photoId,LightboxPhotoReel.init);
		
		var alertTop = (PhotoLightBox.winY - PhotoLightBox.boxHeight) / 2;
		var alertLeft = (PhotoLightBox.winX - PhotoLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = PhotoLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = PhotoLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#PhotoVideoLightbox").css("width",PhotoLightBox.boxWidth + 'px');
		$("#PhotoVideoLightbox").css("height",PhotoLightBox.boxHeight + 'px');
		$("#PhotoVideoLightbox").css("top",alertTop + 'px');
		$("#PhotoVideoLightbox").css("left",alertLeft + 'px');
		$("#PhotoVideoLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(PhotoLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#PhotoVideoLightbox").fadeOut(500);
		$("#PhotoVideoLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(PhotoLightBox.init);

var PhotoLightBoxBlue = {

	boxWidth: "504",
	boxHeight: "384",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,
	photoId: 0,

	init: function(){
	
		$(".PhotoLightBox").click(PhotoLightBoxBlue.show);
	
	},
	
	setPhotoId: function( rowNum, colNum ){
		PhotoLightBoxBlue.photoId = parseInt( rowNum ) + parseInt( colNum );
		PhotoLightBoxBlue.show();
	},
	
	show: function(){
	
		LightboxPhotoReel.setRotate( '0' );
		
		PhotoLightBoxBlue.docX = $(document).width();
		PhotoLightBoxBlue.docY = $(document).height();
		PhotoLightBoxBlue.winY = $(window).height();
		PhotoLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="PhotoVideoLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		$("#PhotoVideoLightboxBlue").load(Base.base_path + 'members/PhotoView.php?start=' + PhotoLightBoxBlue.photoId,LightboxPhotoReel.init);
		
		var alertTop = (PhotoLightBoxBlue.winY - PhotoLightBoxBlue.boxHeight) / 2;
		var alertLeft = (PhotoLightBoxBlue.winX - PhotoLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = PhotoLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = PhotoLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#PhotoVideoLightboxBlue").css("width",PhotoLightBoxBlue.boxWidth + 'px');
		$("#PhotoVideoLightboxBlue").css("height",PhotoLightBoxBlue.boxHeight + 'px');
		$("#PhotoVideoLightboxBlue").css("top",alertTop + 'px');
		$("#PhotoVideoLightboxBlue").css("left",alertLeft + 'px');
		$("#PhotoVideoLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(PhotoLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#PhotoVideoLightboxBlue").fadeOut(500);
		$("#PhotoVideoLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(PhotoLightBoxBlue.init);


var VideoLightBox = {

	boxWidth: "504",
	boxHeight: "384",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,
	videoId: 0,

	init: function(){
	
		$(".VideoLightBox").click(VideoLightBox.show);
	
	},
	
	setVideoId: function( videoId ){
		VideoLightBox.videoId = videoId;
		VideoLightBox.show();
	},
	
	show: function(){
	
		VideoLightBox.docX = $(document).width();
		VideoLightBox.docY = $(document).height();
		VideoLightBox.winY = $(window).height();
		VideoLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="PhotoVideoLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#PhotoVideoLightbox").load(Base.base_path + 'members/VideoView.php?person_video_id=' + VideoLightBox.videoId );
		
		var alertTop = (VideoLightBox.winY - VideoLightBox.boxHeight) / 2;
		var alertLeft = (VideoLightBox.winX - VideoLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = VideoLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = VideoLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#PhotoVideoLightbox").css("width",VideoLightBox.boxWidth + 'px');
		$("#PhotoVideoLightbox").css("height",VideoLightBox.boxHeight + 'px');
		$("#PhotoVideoLightbox").css("top",alertTop + 'px');
		$("#PhotoVideoLightbox").css("left",alertLeft + 'px');
		$("#PhotoVideoLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(VideoLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#PhotoVideoLightbox").fadeOut(500);
		$("#PhotoVideoLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(VideoLightBox.init);


var RecipientsLightBox = {

	boxWidth: "402",
	boxHeight: "502",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".RecipientsLightBox").click(RecipientsLightBox.show);
	
	},
	
	showRecipientBoxStudentList: function(){
	
		$("#RecipientBoxStudentList").slideDown(500);
		
		$("#RecipientBoxStaffList").slideUp(500);
		$("#RecipientBoxGroupList").slideUp(500);
	
	},
	
	showRecipientBoxStaffList: function(){
	
		$("#RecipientBoxStaffList").slideDown(500);
		
		$("#RecipientBoxStudentList").slideUp(500);
		$("#RecipientBoxGroupList").slideUp(500);
	
	},
	
	showRecipientBoxGroupList: function(){
	
		$("#RecipientBoxGroupList").slideDown(500);
		
		$("#RecipientBoxStaffList").slideUp(500);
		$("#RecipientBoxStudentList").slideUp(500);
	
	},
	
	show: function(){
	
		RecipientsLightBox.docX = $(document).width();
		RecipientsLightBox.docY = $(document).height();
		RecipientsLightBox.winY = $(window).height();
		RecipientsLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="RecipientsLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		$("#RecipientsLightbox").load(Base.base_path + 'members/AddToStaffJournal.php',RecipientsLightBox.groupListen);
		
		var alertTop = (RecipientsLightBox.winY - RecipientsLightBox.boxHeight) / 2;
		var alertLeft = (RecipientsLightBox.winX - RecipientsLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = RecipientsLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = RecipientsLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#RecipientsLightbox").css("width",RecipientsLightBox.boxWidth + 'px');
		$("#RecipientsLightbox").css("height",RecipientsLightBox.boxHeight + 'px');
		$("#RecipientsLightbox").css("top",alertTop + 'px');
		$("#RecipientsLightbox").css("left",alertLeft + 'px');
		$("#RecipientsLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(RecipientsLightBox.hide);
	
	},
	
	groupListen: function(){
	
		$("#ShowRecipientBoxStudentList").click(RecipientsLightBox.showRecipientBoxStudentList);
		$("#ShowRecipientBoxStaffList").click(RecipientsLightBox.showRecipientBoxStaffList);
		$("#ShowRecipientBoxGroupList").click(RecipientsLightBox.showRecipientBoxGroupList);
	
	},
	
	hide: function(){
	
		$("#RecipientsLightbox").fadeOut(500);
		$("#RecipientsLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(RecipientsLightBox.init);

var YourPhotoLightBox = {

	boxWidth: "600",
	boxHeight: "560",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".YourPhotoLightBox").click(YourPhotoLightBox.show);
	
	},
	
	show: function(){
	
		YourPhotoLightBox.docX = $(document).width();
		YourPhotoLightBox.docY = $(document).height();
		YourPhotoLightBox.winY = $(window).height();
		YourPhotoLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="PhotoCropLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#PhotoCropLightbox").load(Base.base_path + 'members/PhotoCrop.php?type=' + YourPhotoLightBox.type);
		
		var alertTop = (YourPhotoLightBox.winY - YourPhotoLightBox.boxHeight) / 2;
		var alertLeft = (YourPhotoLightBox.winX - YourPhotoLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourPhotoLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourPhotoLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#PhotoCropLightbox").css("width",YourPhotoLightBox.boxWidth + 'px');
		$("#PhotoCropLightbox").css("height",YourPhotoLightBox.boxHeight + 'px');
		$("#PhotoCropLightbox").css("top",alertTop + 'px');
		$("#PhotoCropLightbox").css("left",alertLeft + 'px');
		$("#PhotoCropLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourPhotoLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#PhotoCropLightbox").fadeOut(500);
		$("#PhotoCropLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourPhotoLightBox.init);

var YourPhotoLightBoxBlue = {

	boxWidth: "600",
	boxHeight: "560",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".YourPhotoLightBox").click(YourPhotoLightBoxBlue.show);
	
	},
	
	show: function(){
	
		YourPhotoLightBoxBlue.docX = $(document).width();
		YourPhotoLightBoxBlue.docY = $(document).height();
		YourPhotoLightBoxBlue.winY = $(window).height();
		YourPhotoLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="PhotoCropLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#PhotoCropLightboxBlue").load(Base.base_path + 'members/PhotoCrop.php?type=' + YourPhotoLightBox.type);
		
		var alertTop = (YourPhotoLightBoxBlue.winY - YourPhotoLightBoxBlue.boxHeight) / 2;
		var alertLeft = (YourPhotoLightBoxBlue.winX - YourPhotoLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourPhotoLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourPhotoLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#PhotoCropLightboxBlue").css("width",YourPhotoLightBoxBlue.boxWidth + 'px');
		$("#PhotoCropLightboxBlue").css("height",YourPhotoLightBoxBlue.boxHeight + 'px');
		$("#PhotoCropLightboxBlue").css("top",alertTop + 'px');
		$("#PhotoCropLightboxBlue").css("left",alertLeft + 'px');
		$("#PhotoCropLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourPhotoLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#PhotoCropLightboxBlue").fadeOut(500);
		$("#PhotoCropLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourPhotoLightBoxBlue.init);

var LightboxPhotoReel = {

	timer: '',

	frames: '',
	
	current: '',
	
	caption: '',

	rotate: '1',
	
	init: function(){
	
		if(document.getElementById("LightboxPhotoReel")){
		
			var slides = document.getElementById("LightboxPhotoReel").childNodes;
	
			for(var x = 0; x < slides.length; x++){
			
				if(x==0)
				LightboxPhotoReel.current = slides[x];
	
			}
			
			var captions = document.getElementById("LightboxPhotoInfo").childNodes;
	
			for(var x = 0; x < captions.length; x++){
			
				if(x==0)
				LightboxPhotoReel.caption = captions[x];
	
			}
			
			$("#PhotoReelPrevious").click(LightboxPhotoReel.previousSlideClick);
			$("#PhotoReelNext").click(LightboxPhotoReel.nextSlideClick);
			
			if( LightboxPhotoReel.rotate == '1' )
				LightboxPhotoReel.timer = setTimeout(function(){ LightboxPhotoReel.nextSlide() },4000);
		
		}
	
	},
	
	setRotate: function(){
		LightboxPhotoReel.rotate = '0';
	},
	
	nextSlideClick: function(){
	
		LightboxPhotoReel.nextSlide();
		clearTimeout(LightboxPhotoReel.timer);
	
	},
	
	previousSlideClick: function(){
		
		LightboxPhotoReel.previousSlide();
		clearTimeout(LightboxPhotoReel.timer);
	
	},
	
	nextSlide: function(){
	
		var currentSlide = LightboxPhotoReel.current;
		
		if(currentSlide.nextSibling){
		var nextSlide = currentSlide.nextSibling;
		}else{
		var nextSlide = document.getElementById("LightboxPhotoReel").firstChild;
		}
	
		LightboxPhotoReel.current = nextSlide;
		
		$(currentSlide).hide();
		$(nextSlide).fadeIn(500);
		
		var currentCaption = LightboxPhotoReel.caption;
		
		if(currentCaption.nextSibling){
		var nextCaption = currentCaption.nextSibling;
		}else{
		var nextCaption = document.getElementById("LightboxPhotoInfo").firstChild;
		}
	
		LightboxPhotoReel.caption = nextCaption;
		
		$(currentCaption).hide();
		$(nextCaption).fadeIn(500);
		
		if( LightboxPhotoReel.rotate == '1' )
			LightboxPhotoReel.timer = setTimeout(function(){ LightboxPhotoReel.nextSlide() },4000);
	
	},
	
	previousSlide: function(){
	
		var currentSlide = LightboxPhotoReel.current;
		
		if(currentSlide.previousSibling){
		var nextSlide = currentSlide.previousSibling;
		}else{
		var nextSlide = document.getElementById("LightboxPhotoReel").lastChild;
		}
	
		LightboxPhotoReel.current = nextSlide;
		
		$(currentSlide).hide();
		$(nextSlide).fadeIn(500);
		
		var currentCaption = LightboxPhotoReel.caption;
		
		if(currentCaption.previousSibling){
		var nextCaption = currentCaption.previousSibling;
		}else{
		var nextCaption = document.getElementById("LightboxPhotoInfo").lastChild;
		}
	
		LightboxPhotoReel.caption = nextCaption;
		
		$(currentCaption).hide();
		$(nextCaption).fadeIn(500);
		
		if( LightboxPhotoReel.timer == '1' )
			LightboxPhotoReel.timer = setTimeout(function(){ LightboxPhotoReel.nextSlide() },4000);
	
	}

}

$(document).ready(LightboxPhotoReel.init);

var CaseStudyLightBoxBlue = {

	boxWidth: "602",
	boxHeight: "502",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".CaseStudyLightBoxBlue").click(CaseStudyLightBoxBlue.show);
	
	},
	
	setNewsId: function( newsId ){
		CaseStudyLightBoxBlue.newsId = newsId;
		CaseStudyLightBoxBlue.show();
	},
	
	show: function(){
	
		CaseStudyLightBoxBlue.docX = $(document).width();
		CaseStudyLightBoxBlue.docY = $(document).height();
		CaseStudyLightBoxBlue.winY = $(window).height();
		CaseStudyLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="LightBoxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#CaseStudyLightboxBlue").load(Base.base_path + 'newsEvents/NewsDetail.php?news_id=' + CaseStudyLightBoxBlue.newsId);
		
		var alertTop = (CaseStudyLightBoxBlue.winY - CaseStudyLightBoxBlue.boxHeight) / 2;
		var alertLeft = (CaseStudyLightBoxBlue.winX - CaseStudyLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = CaseStudyLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = CaseStudyLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#CaseStudyLightboxBlue").css("width",CaseStudyLightBoxBlue.boxWidth + 'px');
		$("#CaseStudyLightboxBlue").css("height",CaseStudyLightBoxBlue.boxHeight + 'px');
		$("#CaseStudyLightboxBlue").css("top",alertTop + 'px');
		$("#CaseStudyLightboxBlue").css("left",alertLeft + 'px');
		$("#CaseStudyLightboxBlue").fadeIn(300);
		
		CornersTable.init();
		
		$("#CloseLightbox").click(CaseStudyLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#CaseStudyLightboxBlue").fadeOut(500);
		$("#CaseStudyLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(CaseStudyLightBoxBlue.init);

var EventsLightBox = {

	boxWidth: "602",
	boxHeight: "502",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".EventsLightBox").click(EventsLightBox.show);
	
	},
	
	setEventId: function( eventId ){
		EventsLightBox.eventId = eventId;
		EventsLightBox.show();
	},
	
	show: function(){
	
		EventsLightBox.docX = $(document).width();
		EventsLightBox.docY = $(document).height();
		EventsLightBox.winY = $(window).height();
		EventsLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="CaseStudyLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#CaseStudyLightboxBlue").load(Base.base_path + 'newsEvents/EventDetail.php?event_id=' + EventsLightBox.eventId);
		
		var alertTop = (EventsLightBox.winY - EventsLightBox.boxHeight) / 2;
		var alertLeft = (EventsLightBox.winX - EventsLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = EventsLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = EventsLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#CaseStudyLightboxBlue").css("width",EventsLightBox.boxWidth + 'px');
		$("#CaseStudyLightboxBlue").css("height",EventsLightBox.boxHeight + 'px');
		$("#CaseStudyLightboxBlue").css("top",alertTop + 'px');
		$("#CaseStudyLightboxBlue").css("left",alertLeft + 'px');
		$("#CaseStudyLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(EventsLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#CaseStudyLightboxBlue").fadeOut(500);
		$("#CaseStudyLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(EventsLightBox.init);

var NewsLightBox = {

	boxWidth: "602",
	boxHeight: "502",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".NewsLightBox").click(NewsLightBox.show);
	
	},
	
	setNewsId: function( newsId ){
		NewsLightBox.newsId = newsId;
		NewsLightBox.show();
	},
	
	show: function(){
	
		NewsLightBox.docX = $(document).width();
		NewsLightBox.docY = $(document).height();
		NewsLightBox.winY = $(window).height();
		NewsLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="CaseStudyLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#CaseStudyLightboxBlue").load(Base.base_path + 'newsEvents/NewsDetail.php?news_id=' + NewsLightBox.newsId);
		
		var alertTop = (NewsLightBox.winY - NewsLightBox.boxHeight) / 2;
		var alertLeft = (NewsLightBox.winX - NewsLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = NewsLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = NewsLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#CaseStudyLightboxBlue").css("width",NewsLightBox.boxWidth + 'px');
		$("#CaseStudyLightboxBlue").css("height",NewsLightBox.boxHeight + 'px');
		$("#CaseStudyLightboxBlue").css("top",alertTop + 'px');
		$("#CaseStudyLightboxBlue").css("left",alertLeft + 'px');
		$("#CaseStudyLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(NewsLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#CaseStudyLightboxBlue").fadeOut(500);
		$("#CaseStudyLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(NewsLightBox.init);

var ChangePasswordLightBox = {

	boxWidth: "272",
	boxHeight: "220",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".JournalLightBoxBlue").click(ChangePasswordLightBox.show);
	
	},
	
	show: function(){
	
		ChangePasswordLightBox.docX = $(document).width();
		ChangePasswordLightBox.docY = $(document).height();
		ChangePasswordLightBox.winY = $(window).height();
		ChangePasswordLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="ChangePasswordLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#ChangePasswordLightbox").load(Base.base_path + 'members/ChangePassword.php?isStudent=1');
		
		var alertTop = (ChangePasswordLightBox.winY - ChangePasswordLightBox.boxHeight) / 2;
		var alertLeft = (ChangePasswordLightBox.winX - ChangePasswordLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = ChangePasswordLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = ChangePasswordLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#ChangePasswordLightbox").css("width",ChangePasswordLightBox.boxWidth + 'px');
		$("#ChangePasswordLightbox").css("height",ChangePasswordLightBox.boxHeight + 'px');
		$("#ChangePasswordLightbox").css("top",alertTop);
		$("#ChangePasswordLightbox").css("left",alertLeft);
		$("#ChangePasswordLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(ChangePasswordLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#ChangePasswordLightbox").fadeOut(500);
		$("#ChangePasswordLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(ChangePasswordLightBox.init);

var ChangePasswordLightBoxBlue = {

	boxWidth: "272",
	boxHeight: "220",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".JournalLightBoxBlue").click(ChangePasswordLightBoxBlue.show);
	
	},
	
	show: function(){
	
		ChangePasswordLightBoxBlue.docX = $(document).width();
		ChangePasswordLightBoxBlue.docY = $(document).height();
		ChangePasswordLightBoxBlue.winY = $(window).height();
		ChangePasswordLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="ChangePasswordLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#ChangePasswordLightboxBlue").load(Base.base_path + 'members/ChangePassword.php?isStudent=0');
		
		var alertTop = (ChangePasswordLightBoxBlue.winY - ChangePasswordLightBoxBlue.boxHeight) / 2;
		var alertLeft = (ChangePasswordLightBoxBlue.winX - ChangePasswordLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = ChangePasswordLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = ChangePasswordLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#ChangePasswordLightboxBlue").css("width",ChangePasswordLightBoxBlue.boxWidth + 'px');
		$("#ChangePasswordLightboxBlue").css("height",ChangePasswordLightBoxBlue.boxHeight + 'px');
		$("#ChangePasswordLightboxBlue").css("top",alertTop);
		$("#ChangePasswordLightboxBlue").css("left",alertLeft);
		$("#ChangePasswordLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(ChangePasswordLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#ChangePasswordLightboxBlue").fadeOut(500);
		$("#ChangePasswordLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(ChangePasswordLightBoxBlue.init);

var YourProfilePhotoLightBox = {

	boxWidth: "350",
	boxHeight: "450",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,
	
	init: function(){
	
		$(".YourPhotoLightBox").click(YourProfilePhotoLightBox.show);
	
	},
	
	show: function(){
	
		YourProfilePhotoLightBox.docX = $(document).width();
		YourProfilePhotoLightBox.docY = $(document).height();
		YourProfilePhotoLightBox.winY = $(window).height();
		YourProfilePhotoLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="ProfilePicLightbox" style="height:450px" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#ProfilePicLightbox").load(Base.base_path + 'members/ProfilePhotoCrop.php');
		
		var alertTop = (YourProfilePhotoLightBox.winY - YourProfilePhotoLightBox.boxHeight) / 2;
		var alertLeft = (YourProfilePhotoLightBox.winX - YourProfilePhotoLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourProfilePhotoLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourProfilePhotoLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#ProfilePicLightbox").css("width",YourProfilePhotoLightBox.boxWidth + 'px');
		$("#ProfilePicLightbox").css("height",YourProfilePhotoLightBox.boxHeight + 'px');
		$("#ProfilePicLightbox").css("top",alertTop + 'px');
		$("#ProfilePicLightbox").css("left",alertLeft + 'px');
		$("#ProfilePicLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourProfilePhotoLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#ProfilePicLightbox").fadeOut(500);
		$("#ProfilePicLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourProfilePhotoLightBox.init);

var YourProfilePhotoLightBoxBlue = {

	boxWidth: "350",
	boxHeight: "450",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,
	
	init: function(){
	
		$(".YourPhotoLightBox").click(YourProfilePhotoLightBoxBlue.show);
	
	},
	
	show: function(){
	
		YourProfilePhotoLightBoxBlue.docX = $(document).width();
		YourProfilePhotoLightBoxBlue.docY = $(document).height();
		YourProfilePhotoLightBoxBlue.winY = $(window).height();
		YourProfilePhotoLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="ProfilePicLightboxBlue" style="height:450px" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#ProfilePicLightboxBlue").load(Base.base_path + 'members/ProfilePhotoCrop.php');
		
		var alertTop = (YourProfilePhotoLightBoxBlue.winY - YourProfilePhotoLightBoxBlue.boxHeight) / 2;
		var alertLeft = (YourProfilePhotoLightBoxBlue.winX - YourProfilePhotoLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourProfilePhotoLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourProfilePhotoLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#ProfilePicLightboxBlue").css("width",YourProfilePhotoLightBoxBlue.boxWidth + 'px');
		$("#ProfilePicLightboxBlue").css("height",YourProfilePhotoLightBoxBlue.boxHeight + 'px');
		$("#ProfilePicLightboxBlue").css("top",alertTop + 'px');
		$("#ProfilePicLightboxBlue").css("left",alertLeft + 'px');
		$("#ProfilePicLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourProfilePhotoLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#ProfilePicLightboxBlue").fadeOut(500);
		$("#ProfilePicLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourProfilePhotoLightBoxBlue.init);

var YourDocumentLightBox = {

	boxWidth: "325",
	boxHeight: "230",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".YourDocumentLightBox").click(YourDocumentLightBox.show);
	
	},
	
	show: function(){
	
		YourDocumentLightBox.docX = $(document).width();
		YourDocumentLightBox.docY = $(document).height();
		YourDocumentLightBox.winY = $(window).height();
		YourDocumentLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="ProfileDocumentLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#ProfileDocumentLightbox").load(Base.base_path + 'members/DocumentUpload.php');
		
		var alertTop = (YourDocumentLightBox.winY - YourDocumentLightBox.boxHeight) / 2;
		var alertLeft = (YourDocumentLightBox.winX - YourDocumentLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourDocumentLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourDocumentLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#ProfileDocumentLightbox").css("width",YourDocumentLightBox.boxWidth + 'px');
		$("#ProfileDocumentLightbox").css("height",YourDocumentLightBox.boxHeight + 'px');
		$("#ProfileDocumentLightbox").css("top",alertTop + 'px');
		$("#ProfileDocumentLightbox").css("left",alertLeft + 'px');
		$("#ProfileDocumentLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourDocumentLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#ProfileDocumentLightbox").fadeOut(500);
		$("#ProfileDocumentLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourDocumentLightBox.init);

var YourDocumentLightBoxBlue = {

	boxWidth: "325",
	boxHeight: "230",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".YourDocumentLightBox").click(YourDocumentLightBoxBlue.show);
	
	},
	
	show: function(){
	
		YourDocumentLightBoxBlue.docX = $(document).width();
		YourDocumentLightBoxBlue.docY = $(document).height();
		YourDocumentLightBoxBlue.winY = $(window).height();
		YourDocumentLightBoxBlue.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="ProfileDocumentLightboxBlue" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#ProfileDocumentLightboxBlue").load(Base.base_path + 'members/DocumentUpload.php');
		
		var alertTop = (YourDocumentLightBoxBlue.winY - YourDocumentLightBoxBlue.boxHeight) / 2;
		var alertLeft = (YourDocumentLightBoxBlue.winX - YourDocumentLightBoxBlue.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourDocumentLightBoxBlue.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourDocumentLightBoxBlue.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#ProfileDocumentLightboxBlue").css("width",YourDocumentLightBoxBlue.boxWidth + 'px');
		$("#ProfileDocumentLightboxBlue").css("height",YourDocumentLightBoxBlue.boxHeight + 'px');
		$("#ProfileDocumentLightboxBlue").css("top",alertTop + 'px');
		$("#ProfileDocumentLightboxBlue").css("left",alertLeft + 'px');
		$("#ProfileDocumentLightboxBlue").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourDocumentLightBoxBlue.hide);
	
	},
	
	hide: function(){
	
		$("#ProfileDocumentLightboxBlue").fadeOut(500);
		$("#ProfileDocumentLightboxBlue").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourDocumentLightBoxBlue.init);

var YourVideoLightBox = {

	boxWidth: "600",
	boxHeight: "560",
	docX: 0,
	docY: 0,
	winX: 0,
	winY: 0,

	init: function(){
	
		$(".YourPhotoLightBox").click(YourPhotoLightBox.show);
	
	},
	
	show: function(){
	
		YourVideoLightBox.docX = $(document).width();
		YourVideoLightBox.docY = $(document).height();
		YourVideoLightBox.winY = $(window).height();
		YourVideoLightBox.winX = $(window).width();
	
		Overlay.show();
		
		$("body").append('<div id="PhotoCropLightbox" class="CornerDiv"></div><div id="LightboxAfter"><img src="' + Base.base_path + 'media/images/cross-small-outline.png" alt="close" id="CloseLightbox" /></div>');
		// /Users/DT/Sites/FlyingColours/
		$("#PhotoCropLightbox").load(Base.base_path + 'members/VideoUpload.php');
		
		var alertTop = (YourVideoLightBox.winY - YourVideoLightBox.boxHeight) / 2;
		var alertLeft = (YourVideoLightBox.winX - YourVideoLightBox.boxWidth) / 2;
		
		/* after box positioning - worked out based on the position and height of the box */
		var x1 = YourVideoLightBox.boxWidth;
		x1 = Number(x1);
		var afterWidth = 15 + x1;
		
		var x2 = YourVideoLightBox.boxHeight;
		x2 = Number(x2);
		var afterTop = alertTop + x2;
		
		$("#LightboxAfter").css("width",afterWidth + 'px');
		$("#LightboxAfter").css("top",afterTop + 'px');
		$("#LightboxAfter").css("left",alertLeft + 'px');
		
		$("#PhotoCropLightbox").css("width",YourVideoLightBox.boxWidth + 'px');
		$("#PhotoCropLightbox").css("height",YourVideoLightBox.boxHeight + 'px');
		$("#PhotoCropLightbox").css("top",alertTop + 'px');
		$("#PhotoCropLightbox").css("left",alertLeft + 'px');
		$("#PhotoCropLightbox").fadeIn(300);
		
		if(!$.browser.msie)
			CornersTable.init();
		
		$("#CloseLightbox").click(YourVideoLightBox.hide);
	
	},
	
	hide: function(){
	
		$("#PhotoCropLightbox").fadeOut(500);
		$("#PhotoCropLightbox").remove();
		$("#LightboxAfter").remove();
		
		Overlay.close();
	}

}

$(document).ready(YourPhotoLightBox.init);
