apis = [];

var now = new Date();
var year = now.getYear();
if (year < 1900) {
  year += 1900;
}
var end = new Date("December 31, " + year + " 22:00:00 GMT");
$(function() {

	// Options for SuperBGImage
	$.fn.superbgimage.options = {
		transition: 1, // 0-none, 1-use random transition (0-7)
		slideshow: 1, // 0-none, 1-autostart slideshow
		slide_interval: 5000, // interval for the slideshow
		randomimage: 0, // 0-none, 1-random image
		speed: 3000 // animation speed
	};

	// initialize SuperBGImage
	$('#superbgimage').superbgimage().hide();

});

$(window).resize(function() {
		$('#contentbg').css('height', $(window).height()-80);
		$('#content').css('height', $(window).height()-80);
		$('#content > .inner').css('height', $(window).height()-120);
		$('#content > .inner').data('jsp').reinitialise();
});

function toSt2(n) {
	  s = "";
	  if (n < 10) s += "0";
	  return (s + n).toString();
	}
	function toSt3(n) {
	  s = "";
	  if (n < 10) s += "00";
	  else if (n < 100) s += "0";
	  return (s + n).toString();
	}

	function countdown() {
		  d = new Date();
		  count = Math.floor(( end.getTime() - d.getTime() ) / 1000);
		  if(count > 0) {
		    iseconds = toSt2(count%60); 
		    count = Math.floor(count/60);
		    iminutes = toSt2(count%60); 
		    count = Math.floor(count/60);
		    ihours = toSt2(count%24); 
		    count = Math.floor(count/24);
		    idays = count;
		    $('#days').html(idays + ' TAGE')
			$('#hours').html(ihours + ' STUNDEN');
			$('#minutes').html(iminutes + ' MINUTEN');
			$('#seconds').html(iseconds + ' SEKUNDEN');
		    setTimeout("countdown()", 50);
		  }
		}		
	
$(document).ready(function() {
	$('#contentbg').css({height: $(window).height()-80, opacity: 0.9});
	$('#content').css({height: $(window).height()-80, opacity: 0.9});
	$('#content > .inner').css('height', $(window).height()-120);
	apis[0] = $('#content > .inner').jScrollPane( {verticalGutter: 30}).data().jsp;	
	


	
	countdown();
	
	
});

