/*****************************************************
* jQuery typograph
******************************************************
* Author: VladX
*****************************************************/

(function($){
$.fn.extend({
	typograph : function(){/*
		return this.each(function(){
			var txt = $(this).html();
			for (i=0; txt[i]; ++i){
				if (txt[i] == '<')
					var opened = true, pos = i;
				if (txt[i] == '>' && opened){
						var tag = substring(pos, i);
						if (tag.substr(1, 3).toLowerCase() == 'img'){
							var elems[pos]['opener'] = tag;
							txt = txt.substring(0, pos-1) + txt.substr(i+1);
						}
						else {
							var elems[pos]['opener'] = tag;
							var closerPos = txt.indexOf('</' + tag.substr(1, 3));
							var elems[pos]['content'] = 
						}
					}
			}
			txt = txt.replace(/\(c\)/gmi, '&copy;');
			txt = txt.replace(/\(r\)/gmi, '&reg;');
			txt = txt.replace(/\.\.\./gm, '&#8230; ');
			txt = txt.replace(/ - /gm, '&nbsp;&mdash; ');
			txt = txt.replace(/([^ _\*-]+)([\.|,])([^ _\*-]+)/gmi, '$1$2 $3');
			txt = txt.replace(/"([^"]* "[^"]*" [^"]*)"/gm, '&laquo;$1&raquo;');
			txt = txt.replace(/&laquo;([^"]*) "([^"]*)" ([^"]*)&raquo;/gm, '&laquo;$1 &bdquo;$2&ldquo; $3&raquo;'); // Сиськи! :D
			txt = txt.replace(/"([^"]+)"/gm, '&laquo;$1&raquo;');
			txt = txt.replace(/[\t ]+/gm, ' ');
			$(this).html(txt);
		});
	*/}
});
})(jQuery);
