
$(document).ready(function(){

    FlashTitle = new Object();

   	FlashTitle.adjustHeight = function( id, h ) {
		$( "#flashtxt"+id+">embed" ).attr("height",h );
		$( "#flashtxt"+id+">object" ).attr("height",h );
   	};

   	FlashTitle.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( /&amp;/, "%26" );

			// create flash object
   			var FO = { movie:"/system/modules/ch.corner.card.frontend.ptc/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 );
   		});
   	};

	FlashTitle.replaceTitles();
});