/* 
Adapted by:	Vladimir Komarov | Владимир Комаров, Вовата s. Hamaelleon™ (Feb 2009)
Author URI:	http://www.vlkomarov.info/
*/

var imgCount = 2;
var imgDir = 'http://www.date-dreaming.com/with-mila-kunis/wp-content/themes/nishita/i/';
var imgPrefix = 'header-slide-0';
var imgAlt = 'Mila Kunis &middot; Мила Кунис';

var keys = new Array();
for (i = 0; i < imgCount; i++) { keys[i] = i + 1; }

var list = '';

for (i = 0; i < imgCount; i++) {
	list += '<img src="' + imgDir + imgPrefix + keys[i] + '.jpg" alt="' +  imgAlt + '" class="active" />';
}

/*	
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 = $('#header-slideshow img.active');

    if ( $active.length == 0 ) $active = $('#header-slideshow img:last');

    var $next =  $active.next().length ? $active.next() : $('#header-slideshow img:first');

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

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

$(function() {
    setInterval( "slideSwitch()", 15000 );
});