$(document).ready(function(){

    $("#slider").slider({
        prevButton: "prevB",
        nextButton: "nextB",
        timerSpeed: 3300,
        animationSpeed: 500
    });
    $("#slider").mouseover(function() {
        $('.buttonek').show();
    }).mouseout(function() {
        $('.buttonek').hide();
    });

    $('#frmqueryForm-query').bind('keyup', function() {
        if(this.value.length >= 1500) {
                    alert('Zpráva může obsahovat max. 1500 znaků');
                    this.value = this.value.substring(0, 1500);

                    document.getElementById("usedChars" + 1).innerHTML = this.value.length;
                    return false;
        }
        document.getElementById("usedChars" + 1).innerHTML = 1500 - this.value.length;
    });

    $('#frmqueryForm-query').bind('click', function() {
        if(this.value == 'Váš dotaz...') this.value = '';

    });
    $('#frmqueryForm-query').bind('focusout', function() {
        if(this.value == '') this.value = 'Váš dotaz...';

    });
    $('#frmqueryForm-email').bind('click', function() {
        //alert('dvfdfv');
        if(this.value == 'Váš e-mail') this.value = '';

    });
    $('#frmqueryForm-email').bind('focusout', function() {
        //alert('dvfdfv');
        if(this.value == '') this.value = 'Váš e-mail';

    });
    $('#frmqueryForm-name').bind('click', function() {
        if(this.value == 'Předmět zprávy') this.value = '';

    });
    $('#frmqueryForm-name').bind('focusout', function() {
        if(this.value == '') this.value = 'Předmět zprávy';

    });

    $('#fade').cycle();
    $('#fade2').cycle({
        timeout:20000
    });

});

function showItem(id) {

//alert(id);
    if( $('#item'+id).is(':hidden') ){
        $('#item'+id).show();
  
    }else{
        $('#item'+id).hide();
    }
    

}

function showKandidat(obj, name, id) {

    //alert('asd');
    if( $('#'+name+id).is(':hidden') ){
        $('#'+name+id).show();
        $(obj).html('MÉNĚ INFORMACÍ O KANDIDÁTOVI');
    }else{
        $('#'+name+id).hide();
        $(obj).html('VÍCE INFORMACÍ O KANDIDÁTOVI');
    }


}
