// JavaScript Document
//checks if value is integer    
function isInt(n){        var reInt = new RegExp(/^-?\d+$/);        if (!reInt.test(n)) {            return false;        }        return true;    } 
updated = 0;
einmal = 0;

// Tauscht das kleinere Hintergrundbild gegen das hochaufgelöste aus wenn geladen
$(window).load(function() {
		src = $('#supersize').find('img').attr('src');
		src = src.replace('-small','');
		$('#klapper').append('<img src="'+src+'" onLoad="replaceBgImages(this.src)" style="display:none">');
});

function replaceBgImages(src) {
	if (!updated) {
		$('#supersize').find('img').attr('src',src);
		$('#supersize').resizenow(); 	
		updated = 1;
	}
	$('#klapper img').remove();
	preloadGalleryImages();
}

function preloadGalleryImages() {
	if (einmal==0)
	{
		var Container = $('a.lightbox-enabled').attr('href');
		$('a.lightbox-enabled').each(function(index) 
		{
			$('div.gallery :last-child').after('<img src="'+$(this).attr('href')+'">');
		});
		einmal = 1;
	}
}




/*
// Lightbox for jQuery Balupton Edition = Config
$(function(){
	$.Lightbox.construct({
		"show_extended_info": true,
		"speed": 40,
		"opacity": 0.7
	});
});
*/

$(document).ready
	(
	 	function ()
		{
			
			// Supersized: Hintergrundbild Auto-skalierend bei resize
			// werte holen aus attribut name des div id=supersize
			var bildProps = $('#supersize').attr('name');
			var startbreite = bildProps.substr(0, 3);
			var starthoehe = bildProps.substr(3, 3);
			//alert(startbreite+" "+starthoehe);
			
			// supersized einbinden
			$.fn.supersized.options = {  
				startwidth: startbreite,  
				startheight: starthoehe,
				vertical_center: 0,
				horizontal_center: 1,
				slideshow: 0,
				navigation: 1,
				transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
				pause_hover: 0,
				slide_counter: 5000000,
				slide_captions: 0,
				slide_interval: 3000
			};
			$('#supersize').supersized();
			
			
			
			
		} // ende function

); // ende document.ready
