var isEditMode = false;

function prevDef(e) {
	if (!e) e = window.event;
	(e.preventDefault) ? e.preventDefault() : e.returnValue = false;
	return false;
}   

$(document).ready(function() {

	var menu_timeout = null;

	/*
	** Prepare photo album
	*/
	// $("#gallery a").lightBox();

	/*
	** Other stuff
	*/

	function connect_AlbumList (){
		
		$("#album-list dt *").bind("click",function(e){
			prevDef(e);
		});
	
		$("#album-list dt").bind("click",function(e){
			if($(this).hasClass("open")){
				return false;
			}

			$("#album-list .open").removeClass("open").next().slideUp(350);
			$(this).addClass("open").next().slideDown(300);

		})
		
	}	

    
	// Connect the albums
	connect_AlbumList();

});



function toggleEditModeContainers( toggleButtonId ) {

	if( isEditMode ) 
	{
		// Switch off editor fields
		$("div[id^='editor-container-']").hide();

		// Switch on viewer fields
		$("div[id^='viewer-container-']").show();

		isEditMode = false;
		$("#" + toggleButtonId ).text("switch to edit-mode");
	}
	else
	{
		// Switch on editor fields
		$("div[id^='editor-container-']").show();

		// Switch off viewer fields
		$("div[id^='viewer-container-']").hide();

		isEditMode = true;
		$("#" + toggleButtonId ).text("switch to live-mode");
	}
}
