// Wenn DOM bereit, k�nnen wir mit der JS-Arbeit beginnen
window.addEvent('domready', function() {
	setTimeout(setOnclickThumbnails, 2000);
	setTimeout(setWidthHeightThumbnails, 300);
});

function swapTextbox(linkObjId, neuid) {

	var textBoxId = 'div_' + linkObjId;
	
	hideAllTextboxesButNotThisOne(textBoxId, neuid);
	if ($(textBoxId).getStyle('display') == 'none') {
		$(textBoxId).setStyle('display', 'block');
		$(linkObjId).setStyles({
					'color':'black',
					'text-decoration':'underline'
					 });
	}
	else {
		//$(textBoxId).setStyle('display', 'none');
		$(linkObjId).setStyles({
					'color':'#979797',
					'text-decoration':'none'
					});
	}
}

function hideAllTextboxesButNotThisOne(dontHideId, neuid) {
	
	var box_set= 'div.ast_portfolio2_textbox-' + neuid;
	var link_set= 'a.ast_portfolio2_link-' + neuid;
	var aux = $(dontHideId).getStyle('display');
	var allTextBoxes = $$(box_set);
	var allLinks = $$(link_set);
	allTextBoxes.setStyle('display', 'none');
	allLinks.setStyles({'color':'#979797',
			'text-decoration':'none'
		 });

	$(dontHideId).setStyle('display', aux);			
}

function hideAllTextboxes() {
	
	var allTextBoxes = $$('div.ast_portfolio2_textbox-1');
	allTextBoxes.setStyle('display', 'none');	
	

	$('beschreibung-1').setStyles({
					'color':'#979797',
					'text-decoration':'none'
					});	
	$('info-1').setStyles({
					'color':'#979797',
					'text-decoration':'none'
					});	
	$('plaene-1').setStyles({
					'color':'#979797',
					'text-decoration':'none'
					});	
	$('presse-1').setStyles({
					'color':'#979797',
					'text-decoration':'none'
					});	

}

// Event handler 'onclick' für RG Smooth Gallery Thumbnails
function thumbnailsOnclickHandler() {
	hideAllTextboxes.delay(600);
}

// Setzt für alle RG Smoothgallery Thumbnails einen onclick event handler
function setOnclickThumbnails() {
	$$('div.thumbnail').addEvent('click', thumbnailsOnclickHandler);
}

// Setzt Breite und Höhe aller Thumbnails (behebt ein bestehendes Ladeproblem der Galerie)
function setWidthHeightThumbnails() {
	
	$$('div.thumbnail').setStyle('width', '136px');
	$$('div.thumbnail').setStyle('height', '108px');
}
