// VERSION WITHOUT CSS CLASS
function changeTitles(tag,fontSize,fontColor,stageWidth,stageHeight)
{
	var arrTags = document.getElementsByTagName(tag);
	
	for (var i = 0; i < arrTags.length; i++)
	{
		writeTitle(arrTags[i], arrTags[i].innerHTML,fontSize,fontColor,stageWidth,stageHeight);
	}
}

var swfCounter = 0;



function writeTitle(obj,textContent,fontSize,fontColor,stageWidth,stageHeight,textAlign)
{
textContent = replaceComercialE(textContent);

	swfCounter++;

	var charsPerLine = parseInt(stageWidth / (fontSize / 2));
	var lines = parseInt(textContent.length / charsPerLine);

	var lineHeight = parseInt(fontSize + (fontSize / 2));

	if (stageHeight == 0)
	{
		stageHeight = lineHeight + (lineHeight * lines);	
	}
	
	
	var so = new SWFObject("/Data/Resources/JJDI/Corporate/GB/en/images/swf/titleGenerator.swf", "title_" + swfCounter, stageWidth, stageHeight, "3", "#FFFFFF", "", "", "");
    so.addParam("scale", "noscale");
	so.addParam("wmode", "transparent");
	so.addParam("allowScriptAccess", "always");
	so.addParam("swLiveConnect", "true");
	so.addVariable("text_content",textContent);
	so.addVariable("text_size",fontSize);
	so.addVariable("text_color",fontColor);
	so.addVariable("stage_width",stageWidth);
	so.addVariable("stage_height",stageHeight);
	
	so.write(obj);
}

function replaceComercialE(text)
{
	return text.replace("&amp;","*[e]*");
}

