CCFlashTitle = new Object();

CCFlashTitle.adjustHeight = function( id, h ) {
	$( "#flashtxt"+id+">embed" ).attr("height",h );
	$( "#flashtxt"+id+">object" ).attr("height",h );
};

CCFlashTitle.replaceTitles = function() {
	$( ".flashtext" ).each( function( i ) {
		// read the html content
		var html = $(this).html();
		html = html.replace( /[\n\t]/g, " " );
		html = html.replace( /\s+/g, " " );
		html = html.replace( /%/g, "%25" );
		html = html.replace( /&amp;/g, "%26" );

		var flashvars = {
			 text: html,
			 id: i,
			 text_transform: $(this).css( "text-transform" ),
			 font_size: $(this).css( "font-size" )
		 };
		var params = {
			wmode: "opaque"
		};

		var attributes = {};

		$(this).attr("id", "flashtxt" + i );
		// create flash object
		swfobject.embedSWF(
			 "/system/modules/ch.corner.card.frontend/resources/flash/titlegenerator.swf",
			 "flashtxt" + i,
			 $(this).width(),
			 $(this).height(),
			 "8.0.0",
			 "/system/modules/ch.corner.card.frontend/resources/js/swfobject/expressInstall.swf",
			 flashvars,
			 params,
			 attributes
		);

	});
};
$(document).ready(function(){
	CCFlashTitle.replaceTitles();
});

