/**
 * Nella
 *
 * @copyright  Copyright (c) 2006, 2010 Patrik Votoček
 * @license    http://nellacms.com/license  New BSD license
 * @link       http://nellacms.com
 * @category   Nella
 * @package    Nella
 */
var nella = nella || { };

nella.validateInput = function(el) {
    var form = $(el).parents('form');
    if (nette.forms[form.attr('id')]) {
        if (nette.forms[form.attr('id')].validators[$(el).attr('name')]){
            var message = nette.forms[form.attr('id')].validators[$(el).attr('name')](form[0])
            if (message) {
                $(el).before('<p class="error">'+message+'</p>');
            }
        }
    }
}
$(function() {
    $('form input').blur(function() {
        $(this).prevAll('.error').remove();
        nella.validateInput(this);
    });
    $('form .error').live('click', function() {
      $(this).remove();
    });
    $('form').attr('onSubmit', null);
    $('form').submit(function() {
        $(this).find('.error').remove();
        $(this).find('input').each(function() {
            nella.validateInput(this);
        });
        if ($(this).find('.error')[0] == null) {
            return true;
        } else {
            return false;
        }
    });
});

/* /Nella */

$(function(){  
  if($('#twitter').length) $('#twitter li').append('<span></span>');
  if(!$.browser.msie) {
    // czech chars replaced by image
    var h1 = $('h1');
    h1.html(h1.html().replace(/ě/g,"<span>e<span></span></span>"));
    h1.html(h1.html().replace(/š/g,"<span>s<span></span></span>"));
  } 
});