/*** 
     Simple jQuery Slideshow Script
     Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    
    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1500, function() {
            $active.removeClass('active last-active');
        });
}

// Count down function
function countdown() {
    var date = new Date();
    var time = date.getTime();
    var day = Math.max(0, (15206 - Math.floor((time/(86400000)))));
    var str = day.toString();
    document.write(str);
}

function flagnumbertimofelix() {
    var date = new Date();
    var time = date.getTime();
    var day = (Math.floor((time/(86400000)) - 13040));
    var str = day.toString();
    flagstr(str, 15);
}

function flagnumber() {
    var date = new Date();
    var time = date.getTime();
    var day = (Math.floor((time/(86400000)) - 3379));
    var str = day.toString();
    flagstr(str, 15);
}

function flagstr(str, size) {
    var ergebnis = "";
    str = str.toLowerCase();
    for (var i = 0; i < str.length; i++) {
	if(str.charAt(i) == ' ')  {
	    ergebnis += "&#160;&#160;";
	}
	else {
	    ergebnis += "<img src=flags/" + str.charAt(i) + ".gif border=\"0\" height=\""+ size + "\">";
	}
    }
    document.write(ergebnis);
}

