/*
    Checkbox control created by Michal Matuška (fireball_)
    Version: 1.1
*/
$.fn.sortCheckbox=function(option){option=jQuery.extend({name:'all'},option);$(this).each(function(){var el=$(this);$(':checkbox',this).click(function(){if($(this).attr('class')==option.name){el.find(":checkbox[class="+option.name+"]").attr('checked',true);el.find(":checkbox[class!="+option.name+"]").attr('checked',false)}else if(el.find(":checkbox[class!="+option.name+"]").filter(':checked').size()>0){el.find(":checkbox[class="+option.name+"]").attr('checked',false)}else{el.find(":checkbox[class="+option.name+"]").attr('checked',true)}})})};

var slide_id = 1;
var speed = 0;

function slide()
{
	var nth = slide_id - 1;
	$('#motive .img').fadeOut(speed, function() {
		$('#motive .pager a').removeClass('active');
		$('#motive .img img').attr('src', refs[slide_id]['img']);
		$('#motive .title').html(refs[slide_id]['title']);
		$('#motive .desc').html(refs[slide_id]['desc']);
		$(this).fadeIn(speed, function() {
			$('#motive .pager a:nth(' + nth + ')').addClass('active');
		});
	});	
}

function slideShow()
{
	if (slide_id == slide_count) slide_id = 1;
	else slide_id = slide_id + 1;
	slide();
}

setInterval("slideShow()", 5000);

$(document).ready(function(){
	// CHeckbox control
    $('.checkboxes').sortCheckbox();
    
    $('#motive .pager a').click(function() {
		slide_id = $(this).html() * 1;
		slide();
		return false;
	});
});

