if (location.href.match("/sitecore/shell/") == null) {
/**
 * @author Cedric Michaux (Lbi) :: cedric.michaux@lbigroup.be
 */
(function($){
	jQuery.fn.extend({
		customFont: function(options){
			return this.each(function(){
				new jQuery.CustomFont(this, options);
			});
		}
	});
	
	jQuery.CustomFont = function(object, options){
		
		$object = $(object);
		if (($object.children("img")).length == 0) {
			opt = options || {};
			opt.textAlgVert = opt.textAlgVert || "top";
			opt.flashPos = opt.flashPos || "/design/allia/flash/titles.swf";
			opt.expressInstall = opt.expressInstall || 0;
			opt.replacementColor = opt.replacementColor || "#ffffff";
			opt.styleContainer = opt.styleContainer || {};
			width = $object.innerWidth();
			height = $object.innerHeight();
			color = $object.css("color");
			
			if(color.indexOf("#") == -1)
				color = color.substring(4, color.length - 1);
			vars = {
				'txt': encodeURIComponent($object.text()),
				'tWidth': width,
				'tHeight': height,
				'color': encodeURIComponent(color),
				'italic': ($object.css("fontStyle") == "italic") ? true : false,
				'bold': ($object.css("fontWeight") == "bold" || $object.css("fontWeight") == "700") ? true : false,
				'capsOn': ($object.css("textTransform") == "uppercase") ? true : false,
				'size': parseInt($object.css("fontSize")),
				'textAlg': $object.css("textAlign"),
				'textAlgVert' : opt.textAlgVert,
				'url' : ($object.parents("a")) ? encodeURIComponent($object.parents("a").click(function(e){e.preventDefault()}).attr("href")) : undefined
			};
			
			
			itemId = parseInt(Math.random() * 1000000000000);
			if($.browser.msie && $.browser.version < 7)
				$object.css("fontSize", 0).css("color", opt.replacementColor);
			else
				$object.css("text-indent", -99999)
			
			$object.addClass("textReplaced").css({
				"height": height,
				"width": width,
				"position": "relative",
				"padding": 0,
				"zIndex" : 100
			}).append($(document.createElement("span")).attr("id", itemId)).css(opt.styleContainer);
			
			swfobject.embedSWF(opt.flashPos, itemId, width, height, "9.0.0", opt.expressInstall, vars, {
				wmode: 'transparent'
			}, {
				style: "position: absolute; top: 0; left: 0; z-index: 150"
			});
		}
	}
})(jQuery)
}
