﻿function $BI(v) { return(document.getElementById(v)); }
function $S(v) { return($BI(v).style); }


$(document).ready(function(){
//initLightbox('misc','1');
});

function changeToActiveClass(id)
	{
	ele = $('#link'+id);
	if (ele) { $("#menu a").removeClass() }
	if (ele) { $(ele).addClass("active"); }
	}

// TIMELINE
function initContentChange(name,contentNr,ele)
	{
	if (ele) { $("#menu a").removeClass() }
	if (ele) { $(ele).addClass("active"); }
	if (!contentNr) { contentNr = "001"; }
	aniContent(name,contentNr);
	aniImage(name,contentNr);
	}
function initContentChange_CONTENTONLY(name,contentNr,ele)
	{
	//if (ele) { $("#menu a").removeClass() }
	//if (ele) { $(ele).addClass("active"); }
	//if (!contentNr) { contentNr = "1"; }
	aniContent(name,contentNr);
	}
function aniContent(name,contentNr)
	{
	$("#content").fadeOut("slow",function(){ getContent(name,contentNr); });
	}
function aniImage(name,contentNr)
	{
	$("#thumbs").fadeOut("slow",function(){ getImage(name,contentNr); });
	}
function getContent(cName,contentNr)
	{
	$.ajax
		({
		type: "POST",
		data: "name="+cName+"&contentNr="+contentNr,
		url: "contentLoader.php",
		error: function()   { $BI('content').innerHTML = "Load error."; showNewContent() },
		success: function(c){ $BI('content').innerHTML = c; showNewContent(); } 
		});
	}
function getImage(cName,contentNr)
	{
	$.ajax
		({
		type: "POST",
		data: "name="+cName+"&contentNr="+contentNr,
		url: "imageLoader.php",
		error: function()   { $BI('thumbs').innerHTML = "Load error."; showNewContent() },
		success: function(c){ $BI('thumbs').innerHTML = c; showNewContent(); } 
		});
	}
function showNewContent()
	{
	$("#content").fadeIn("slow",function(){  });
	$("#thumbs").fadeIn("slow",function(){  });
	}
