/*
	QTekst v2.0
	
	/script/jquery/jquery.qtekst.js
	/QTekst.php
	
	$('span.replace').qtekst({ fontSize: 20, fontFile: 'essai.ttf', color: "#FAAD4D", backgroundColor: '#FFFFFF', textShadow: '#444444' });
	
	<span class="replace">Home</span>
    <span class="replace">Contact</span>
	
*/

jQuery.fn.qtekst = function(options) {

	var settings = jQuery.extend({
		fontSize: 14,
		fontFile: 'arial.ttf', 
		color: "#000000", 
		backgroundColor: '#FFFFFF', 
		textShadow: false
	}, options);
	
	return this.each(function(){
		$this = $(this);
		
		tekst = $this.html();
		
		var alt = tekst.replace('"','');
		var color = settings.color;
		var backgroundColor = settings.backgroundColor;
		var textShadow = settings.textShadow;
		
		if(textShadow){ 
			var textShadow = textShadow.replace('#',''); 
		}
		
		var xhtml = '<img src="/qtekst.php?t='+escape(tekst)+'&amp;s='+settings.fontSize+'&amp;c='+color.replace('#','')+'&amp;b='+backgroundColor.replace('#','')+'&amp;f='+settings.fontFile+'&amp;sd='+textShadow+'" alt="'+alt+'" title="'+alt+'" />';
		$this.html(xhtml);
	});

};
