/**
 * Typewriter Effect - Based on: http://www.jquery.info/IMG/html/19_typewriter.html
 * Modified: Jeroen Dijkstra | IT-Chemi 2009
 * 
 * Usage example:
 *	 $(document).ready(function() {
 *		$("#id").typewriter(null, function(){
 *			alert("Finished typing!");
 *		});
 * 	});
 */
$.fn.typewriter = function(opt, callback) {
        var i = 0;
        var typeone = function(self, text, content) {
                if (text.length > 0) {
                        i = i + 1;
                        var next = text.match(/(\s*(<[^>]*>)?)*(&.*?;|.?)/)[0];
                        text = text.substr(next.length);
                        $(self).html(content + next);
                        setTimeout(function() {
                                typeone(self, text, content+next);
                        }, opt['delay']);
                        if(text.length == 0) if (callback != null) callback();
                }
        }
        this.each(function() {
                opt = opt || { 'delay': 125 };
                typeone(this, $(this).html(), '');
        });
        return this;
}

// Dots after 'Bezig' effect looped
function typeNow()
{
	//$('#'+id).siblings('span#dots').typewriter(null, function()
	$("span#dots").typewriter(null, function()
	{
		setTimeout(function(){
        	typeNow();
		}, "700");
	});
};

// Execute on document ready
$(document).ready(function(){
		typeNow();
});
