/* 
*jQuery jFTR Plugin v1.0.0
* Requires jQuery 1.2.6+
*
* Copyright (c) 2010 Muslum TORUN (MtDesign)
* Homepage: http//ww.muslumtorun.com
* Contact developer email : info@muslumtorun.com or by_muslum@hotmail.com
* Licensed under GPL (GPL-LICENSE.txt) license.
*
* 2010-03-24
*
*/
(function($){
	var $jFTR_standart = {
		version: 7, 
		
		css: [ '* { color: #333333; }',
               'a { color: #0099CC; text-decoration: none; }',
               'a:hover { text-decoration: underline; }'
             ], 
			 
		htmlRender: function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = $alt.height();
            htmlOptions.width = $alt.width();
            $alt
				.addClass('alt')
				.css("display", "none");
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions))
				.css("visibility", "visible");		
        }

	}
	
	function $jFTR_render(self, objFlash) {
		var $this = self;
		$this.flash(objFlash, {version: $jFTR_standart.version}, $jFTR_standart.htmlRender);
	}
	
	$.fn.jFTR = function(settings) {
		var _src = null, _css = null;
		var $this = $(this);
		_src = settings.src != null ? settings.src : null;
		
		if (settings != null)
		_css = settings.css;
		else
		_css = $jFTR_standart.css;
		
		if (_src != null) {
			var $flash = {
				src: _src, menu: false,
				wmode: "transparent",
				flashvars: {
					css: _css.join(' ')
				}
			}
			$jFTR_render($this, $flash);
		}
		
	}
})(jQuery);