/*var lightboxIds = new Array();
function changeImagesRel() {
	try {
	var contentblocks = getElementsByClassName("content_blok");
	
	for(var i=0; i < contentblocks.length; i++) {
		var groupID = 0;
		var firstPhoto = true;
		var hidden = false;
		var childNodes = contentblocks[i].childNodes;
		for(var j=0; j < childNodes.length; j++) {
			if(childNodes[j].tagName && childNodes[j].tagName.toLowerCase() == "a") {
				groupID = parseInt(childNodes[j].id.substring(1));
			}
			if(childNodes[j].tagName && childNodes[j].tagName.toLowerCase() == "div") {
				var childChildNodes = childNodes[j].childNodes;
				
				for(var k=0; k < childChildNodes.length; k++) {//alert("DEBUG IE");
					if(
			   				childChildNodes[k].tagName &&
							childChildNodes[k].tagName.toLowerCase() == "div" &&
							childChildNodes[k].className == "photoBook_picture"
						) {
						var childChildChildNodes = childChildNodes[k].childNodes;
						
						for(var ki=0; ki < childChildChildNodes.length; ki++) {
							if(
						   			childChildChildNodes[ki].tagName &&
									childChildChildNodes[ki].tagName.toLowerCase() == "div" &&
									childChildChildNodes[ki].className == "photoBook_picture_img"
								)
							{
								var srcString = "";
								var titleString = "";
								var childChildChildChildNodes = childChildChildNodes[ki].childNodes;
								for(var kj=0; kj < childChildChildChildNodes.length; kj++) {
									if(
									   		childChildChildChildNodes[kj].tagName &&
											childChildChildChildNodes[kj].tagName.toLowerCase() == "img") {
										srcString = childChildChildChildNodes[kj].src.replace("thumb_", "");
										titleString = childChildChildChildNodes[kj].title;
									}
								}
								
								if(firstPhoto) {
									if(changeLinkToPhotobook(groupID, srcString, titleString)) {
										lightboxIds[lightboxIds.length] = groupID;
										hidden = true;	
									}
									firstPhoto = false;
								} else {
									if(hidden) {
										var tmpString = childChildChildNodes[ki].innerHTML;
										childChildChildNodes[ki].innerHTML = '<a class="textLightbox" href="' + srcString + '" rel="lightbox[fotogroep' + groupID + ']" title="' + titleString + '" alt="' + titleString + '" >' + titleString + '</a>';
									}
								}
							}
						}
						if(hidden) {
							childChildNodes[k].style.display = "none";
							childChildNodes[k].parentNode.parentNode.style.display = "none";
							//childChildNodes[k].className = "content_blok" + groupID;
						}
					}
				}
			}
		}
		hidden = false;
	}
//	var lightbox = new Array();
	
	$(function() {
		var lightbox = $("body").ariaLightbox({
			imageArray: "a.textLightbox",
			altText: function() {
				// $(this) is the triggered element (in this case the link)
				//return "Picture opened by link: " + $(this).text();
				return $(this).attr("title");
			},
			descText: function() {
				return $(this).attr("title");
			},
			useDimmer: false,
			titleText: function() {
				return pictureGallery;
			},
			em: false,
			makeHover: false
		});
	});
		
	} catch(err) {
		alert(err);
	}
}
window.addEvent("domready", changeImagesRel);

function getElementsByClassName(cl) {
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = document.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes))
			retnode.push(elem[i]);
	}
	return retnode;
};

var explainText = 'Browse through the illustrations using the arrows on your keyboard. Use the Esc key to exit.';
var altLeft = 'Previous';
var altRight = 'Next';
var figuur = 'Picture';
var altClose = 'Close picture gallery';
var of = 'of';
var pictureGallery = 'Picture gallery';

if( language.toLowerCase() == 'nl' ) {
	explainText = "Blader door de afbeeldingen met de pijltjes op je toetsenbord. Sluit af met de esc-toets.";
	altLeft = 'Vorige';
	altRight = 'Volgende';
	altClose = 'Sluit fotogallerij';
	figuur = 'Afbeelding';
	of = 'van';
	var pictureGallery = 'Fotogalerij';
}
if( language.toLowerCase() == 'fr' ) {
	explainText = "Feuilletez les illustrations à l'aide des flèches sur votre clavier. Fermez en utilisant la touche esc.";
	altLeft = 'Dernier';
	altRight = 'Suivant';
	altClose = 'Fermez le livre des photos';
	figuur = 'Photo';
	of = 'de';
	pictureGallery = 'Livre des photos';
}
if( language.toLowerCase() == 'en' || language == 'eng'  ) {
	explainText = "Browse through the illustrations using the arrows on your keyboard. Use the Esc key to exit.";
	altLeft = 'Previous';
	altRight = 'Next';
	altClose = 'Please close the picture gallery';
	figuur = 'Picture';
	of = 'of';
	pictureGallery = 'Picture gallery';
}
if( language.toLowerCase() == 'de' ) {
	explainText = 'Blättern Sie mit Hilfe der Pfeiltasten durch die Abbildungen und beenden Sie die Sitzung mit der Esc-Taste.';
	altLeft = 'Voriges';
	altRight = 'Nächstes';
	altClose = 'Schiessen Sie den Fotoband';
	figuur = 'Bild';
	of = 'des';
	pictureGallery = 'Fotoband';
}

var focusElement = null;

function changeLinkToPhotobook(id, src, title)
{
	var element = "a";
	var links = document.getElementsByTagName('a');
	for(var i = 0; i < links.length; i++)
	{
		var compareString = "lightbox[fotogroep" + id + "]";
		if(links[i].getAttribute('rel') == compareString)
		{
			links[i].href = src;
			links[i].title = title;
			links[i].setAttribute('alt',title);
			links[i].setAttribute('class', 'textLightbox');
			//links[i].parentNode.setAttribute('class', 'content_blok' + id);
			if( 	links[i].parentNode.parentNode.parentNode.tagName.toLowerCase() == "div"
			   		&& links[i].parentNode.parentNode.parentNode.className == 'content_blok') {
				links[i].parentNode.parentNode.parentNode.style.marginBottom = "0px";
				links[i].parentNode.parentNode.parentNode.style.paddingBottom = "0px";
			}
			return(true);
		}
		if(		links[i] == compareString
		   		|| links[i].getAttribute('href',2) == compareString
				|| links[i].getAttribute('href') == compareString
				|| links[i].href == compareString
				|| String(unescape(links[i])).substring(String(unescape(links[i])).lastIndexOf("/")+1) == compareString )
		{
			//alert(links[i].substring(links[i].lastIndexOf("/")))
			links[i].rel = compareString;
			links[i].href = src;
			links[i].title = title;
			links[i].alt = title;
			links[i].className = 'textLightbox';
			//links[i].parentNode.className = 'content_blok' + id;
			if( 	links[i].parentNode.parentNode.parentNode.tagName.toLowerCase() == "div"
			   		&& links[i].parentNode.parentNode.parentNode.className == 'content_blok') {
				links[i].parentNode.parentNode.parentNode.style.marginBottom = "0px";
				links[i].parentNode.parentNode.parentNode.style.paddingBottom = "0px";
			}
			return(true);
		}
	}
	return(false);
}*/

function clicklink(id)
{
	$("#foto" + id).click();
}
