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" );

		// create flash object
		var FO = { movie:"/system/modules/ch.corner.card.frontend/resources/flash/titlegenerator.swf", width:$(this).width(), height:$(this).height(), majorversion:"8", build:"0", wmode:"opaque",
			flashvars:"text="+ html +"&id="+i+"&text_transform="+$(this).css( "text-transform" )+"&font_size="+$(this).css( "font-size" ) };
		$(this).attr("id","flashtxt" + i );
		UFO.create(FO, "flashtxt" + i );
	});
};
$(document).ready(function(){
	CCFlashTitle.replaceTitles();
});

