$(document).ready(function() {
	
	// Lightbox Initialisierung
	if(lang=='de') { var txtImageString='Bild'; var txtOfString='von'; }
	else { txtImageString='Image'; txtOfString='of'; }
	$('a[rel*=lightbox]').lightBox({
		fixedNavigation: true,
		overlayBgColor: '#000',
		overlayOpacity: 0.8,
		imageLoading: '/js/jquery-lightbox/images/loading.gif',
		imageBtnClose: '/js/jquery-lightbox/images/closelabel.gif',
		imageBtnPrev: '/js/jquery-lightbox/images/prevlabel.gif',
		imageBtnNext: '/js/jquery-lightbox/images/nextlabel.gif',
		containerResizeSpeed: 350,
		txtImage: txtImageString,
		txtOf: txtOfString,
		currentLocation: '#'
	});
	
	
	// jQuery SmoothScroll
	$('a[href*=#]').click(function() {
		
		// duration in ms
		var duration=1500;
		
		// easing values: swing | linear
		var easing='swing';

		// make sure it's the same location		
		if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'') && location.hostname==this.hostname && this.hash.replace(/#/,''))
		{
			// get parameters
			var hash=this.hash;
			var target=$(hash).offset().top;

			// animate to target and set the hash to the window.location after the animation
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: target }, duration, easing, function() { location.hash=hash; });

			// cancel default click action
			return false;
		}

	});

});


// Funktionen Popups

function openPagePopup(file, sizeX, sizeY)
{
	var openImagePopup=window.open(file, 'pagePopup', 'width='+sizeX+',height='+sizeY+',status=no,scrollbars=yes,resizable=yes');
	openImagePopup.focus();
}

function openImagePopup(file, sizeX, sizeY)
{
	var openImagePopup=window.open('/templateImagePopup.php?imgLocation=<?=$REQUEST_URI?>images/'+file, 'pagePopup', 'width='+sizeX+',height='+sizeY+',status=no,scrollbars=no,resizable=no');
	openImagePopup.focus();
}

function openSendSitePopup()
{
	var sendSitePopup=window.open('/context/seite_versenden/index.php?URI=<?=$REQUEST_URI?>', 'sendSitePopup', 'width=460,height=550,status=no,scrollbars=no,resizable=no');
	sendSitePopup.focus();
}

function openPrintSitePopup()
{
	var sendSitePopup=window.open('<?=$PHP_SELF?>?display=print', 'sendSitePopup', 'width=700,height=550,status=no,scrollbars=yes,resizable=yes');
	sendSitePopup.focus();
}