var gallery = 1;

function switchGallery(_this, _that) {
		/* hide the gallery shown with _this */
		if ((!document.getElementById(_this)) || (!document.getElementById(_that))) return;
		document.getElementById(_this).style['display'] = "none";
		
		/* hide the gallery shown with _this */
		document.getElementById(_that).style['display'] = "block";
}

function switchGalleries() {

		/* hide the gallery shown with _this */
		if (document.getElementById('navigateGallery1'))
			document.getElementById("navigateGallery1").style['display'] = "none";
		
}

window.onload = switchGalleries;

function hidePerf(){
	
	var e1 = document.getElementById("navigateGallery2");
	
	if (e1) e1.style['display'] = "none";
	
	var e2 = document.getElementById("navigateGallery1");
	
	if (e2)	e2.style['display'] = "";
	
}

function doTheTrick(){

	var b = document.getElementById("background");
	b.style.display = "block";
	
	var g = document.getElementById("allGallery");
	
	g.style.zIndex = 5;
	g.style.position =  "absolute";
	var wi = document.body.clientWidth;
	
	g.style.marginLeft = "100px";

}

function backToNormal() {

	var b = document.getElementById("background");
	b.style.display = "none";
	var g = document.getElementById("allGallery");
	g.style.zIndex = "";
	g.style.position =  "";
	g.style.left = "";
	g.style.marginLeft = "";
	
}

function renderGalleries(elemid, str) {
		
	var el = document.getElementById("gholder" + elemid);
	var arr = str.split("#");
	
	/* create the link for each image */
	for ( var i=1; i < arr.length; i++ ) {
	
		if (!arr[i]) break;
		
		var attr = arr[i].split("$");
		var link = document.createElement('a');
		link.setAttribute('rel', 'lightbox[g'+elemid+']');
		link.setAttribute('href', 'http://balkantravellers.com/images/rsgallery/original/' + attr[0]);
		link.setAttribute('title', attr[1]);
		el.appendChild(link);
		
		var img = document.createElement('img');
		img.setAttribute('src', 'http://balkantravellers.com/images/rsgallery/original/' + arr[i]);
		link.appendChild(img);
	
	}
	
   if (typeof (myLightBox)!='undefined') myLightbox.end();
   myLightbox = new Lightbox();
   
}