	function onld(e) {
		var doc = window.document;
		var hElements = getElementsByClass(doc.body, tagTxt, sClass)

		for(var i=0; i<hElements.length; i++) {
			if(hElements[i] != null) {
				var bOk = validateMenu(hElements[i]);
	            if(bOk) {
	            	var sXML = getXImage(hElements[i]);

	                sXML = makeReadble(sXML);
	                var w = hElements[i].offsetWidth;
                    var h = hElements[i].offsetHeight;

	            	removeTxt(hElements[i], sXML, w, h);
	            }
			}
		}
	}

	function validateMenu(hObj) {
		if(isA(hObj, tagTxt)) {
			return true;
		}

		return false;
	}

    function getXImage(hObj) {
    	if(hObj != null) {
	    	var period = hObj.attributes["period"] ? hObj.attributes["period"].nodeValue : 1;
	    	var times = hObj.attributes["times"] ? hObj.attributes["times"].nodeValue : 5;

			var ft = getElementComputedStyle(hObj, "fontFamily");
			var fc = getElementComputedStyle(hObj, "color");
			if(fc.charAt(0) != '#') fc = getHexRGBColor(fc);
            else fc = fc.substr(1);

			fc = "0x" + fc;

			var fz = getElementComputedStyle(hObj, "fontSize").substr(0, getElementComputedStyle(hObj, "fontSize").length-2);
			var fw = getElementComputedStyle(hObj, "fontWeight") >= 700 ? 1 : 0;
			var txt = hObj.firstChild.nodeValue;

	    	var sOut = 	"<txt pr=\"" + period + "\" tm=\"" + times + "\" ft=\"" + ft + "\" fz=\"" + fz +
	    				"\" fw=\"" + fw + "\" fc=\"" + fc + "\">";
            sOut += txt;
	     	sOut += "</txt>";
            // document.write(sOut);
	     	return sOut;
     	}
    }

	function isA(hNode, sName) {
		if(typeof(hNode) == 'object' && hNode != null)
			if(hNode.nodeName.toLowerCase() == sName.toLowerCase())
				return true;

		return false;
	}

	function removeTxt(hDiv, sXML, nWidth, nHeight) {
		var n = flCounter++;
    	var so = new SWFObject(sFlashPath, '__flash' + (flCounter+1), nWidth, nHeight+4, nVersion);
		so.addParam('wmode','transparent');
		so.addParam('menu','false');
	    so.addParam('flashvars', 'x=0&s=' + sXML);
	    so.write(hDiv.id);
    }
    function makeReadble(sString) {
    	return sString.replace(/\"/g, "'" );
    }
    function getElementsByClass(el, tagName, className) {
    	var aFound = Array();
		var els = el.getElementsByTagName(tagName);
		for (var i = 0; i < els.length; i++) {
	    	if ((new RegExp(className)).test(els[i].className)) {
				aFound[aFound.length] = els[i];
			}
		}

		return aFound;
	}
	function addEventHandler(hHtml, sEvent, pfnHandler) {
		try {
			hHtml.addEventListener(sEvent, pfnHandler, false);
		} catch (e) {
			try {
				hHtml.detachEvent("on" + sEvent, pfnHandler);
				hHtml.attachEvent("on" + sEvent, pfnHandler);
			} catch (e) {
				hHtml["on" + sEvent] = pfnHandler;
			}
		}
	}
	function getElementComputedStyle(elem, prop) {
  		if (typeof elem!="object") elem = document.getElementById(elem);

  		if (document.defaultView && document.defaultView.getComputedStyle) {
    		if (prop.match(/[A-Z]/)) prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
    		return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);
  		}

  		if (elem.currentStyle) {
    		var i;
    		while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2);
    		return elem.currentStyle[prop];
  		}

  		return "";
	}
	function getHexRGBColor(color) {
		color = color.replace(/\s/g,"");
		var aRGB = color.match(/^rgb\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i);
		if(aRGB)  {
			color = '';
			for (var i=1;  i<=3; i++)
				color += Math.round((aRGB[i][aRGB[i].length-1]=="%"?2.55:1)*parseInt(aRGB[i])).toString(16).replace(/^(.)$/,'0$1');
		}
		else color = color.replace(/^#?([\da-f])([\da-f])([\da-f])$/i, '$1$1$2$2$3$3');

		return color;
	}

	var sClass = "theBlock";
	var tagTxt = "div";
	var sFlashPath = "/files/flash/txt.swf";
	var nVersion = 7;
	var flCounter = 0;

	addEventHandler(window, "load", onld)
