﻿


function DoreplaceText(id, rows, text, fontcolor,fontsize, leading, height, width) {

    if (document.getElementById(id)) {


        if (text == "") { text = trim(document.getElementById(id).innerHTML); }
        if (height == -1) {
            if (rows == 1) { height = 35; }
            else if (rows == 2) { height = 66; }
            else if (rows == 3) { height = 98; }
            else if (rows == 4) { height = 130; }
            else { height = 500; }
        }
        var so = new SWFObject("/js/FlashTextReplace/CastrolTextReplacer.swf", "shell", width, height, "8", "ffffff");
        // Swf file name, 	N/A, 	width, 	Height, 	minimumn flash version, 	background colour

        so.addVariable("extText", text); //Basic HTML copy using <BR/> to control line returns
        so.addVariable("extLeading", leading); // Spacing between line height
        so.addVariable("extLetterSpacing", 0); // Spacing between letters, can be psoitive or negative and decimal
        so.addVariable("extSize", fontsize); // font size in Pixels
        so.addVariable("extFontColour", fontcolor); // font colour
        so.addVariable("extWidth", width); // textBox width
        so.addVariable("extHeight", height); // textBox height

        // Dont edit start #############
        so.addParam("scale", "noscale");
        so.addParam("salign", "TL");
        so.addParam("allowscale", "false");
        so.addParam("wmode", "transparent");
        // Dont edit end ############

        if (text != "") {
            so.write(id);
        }
    }
}

function replaceText(id, rows, text) {

    if (document.getElementById(id)) {
        DoreplaceText(id, rows, text, 0x007B32, 24, 2, 25, 755)
        }
}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

