jQuery(document).ready(function($) {
	
	var lang = $('html').attr('lang') || 'de',
		dic = {
			current: {
				de: "Bild {current} von {total}",
				en: "Image {current} of {total}"
			},
			previous: {
				de: "Zurück",
				en: "Previous"
			},
			next: {
				de: "Weiter",
				en: "Next"
			},
			close: {
				de: "Schließen",
				en: "Close"
			},
			more: {
				de: '&#92;mehr',
				en: '&#92;more'
			},
			less: {
				de: '&#92;weniger',
				en: '&#92;less'
			}
		},
		__ = function (string) {
			if (string) {
				if (dic[string] && dic[string][lang]) {
					return dic[string][lang];
				} else {
					return string;
				};
			};
			return '__No String given!__';
		};
		
	// image lightbox
	$('.images a').colorbox({
		rel: 'project_images',
		current: __("current"),
		previous: __("previous"),
		next: __("next"),
		close: __("close")
	});
	
	// toggle button contents
	$('.body hr').each(function(index) {
		var $separator = $(this),
			$toggles = $separator.nextAll(),
			$body = $separator.closest('.body');
			$link = $('<a href="#toggle" class="toggle">'+__("more")+'</a>');
		
		// add toggle link
		$body.append($link);
		
		// initial hiding
		$toggles.hide();
		
		// toggle link events
		$link.toggle(function() {
			$toggles.show();
			$link.html(__("less"));
			return false;
		}, function() {
			$toggles.hide();
			$link.html(__("more"));
			return false;
		});
		
	});
	
});

