olga.main = {
    init: function() {
        this.form.init();
        this.polls.init();
	},
	
	form: {
		init: function() {
			$('input').each(function() {
			    var obj = $(this);
			    
			    if(obj.attr("type") == 'submit' || obj.attr("type") == 'button') {
                    $(this).bind('mousedown', function(e) {
                        e.preventDefault();
                        
                        $(this).addClass('active');
                    }).bind('mouseup', function(e) {
                        e.preventDefault();
                        
                        $(this).removeClass('active');
                    }).bind('mouseout', function(e) {
                        e.preventDefault();
                        
                        $(this).removeClass('active');
                    }).each(function() {
                        if ($(this).attr('disabled')) {
                            $(this).addClass('disabled');
                        };
                    });
                }
			});
		}
	},
	
    polls: {
        dom: {},
        
        init: function() {
            $('.content-poll').each(function() {
                var id = this.id.split('-').pop();
                
                $('form', this).ajaxForm({
                    target: '#content-poll-' + id + ' .data'
                }); 
            });
        }
    }
}

jQuery(document).ready(function() {
    olga.main.init();
});
