function replace(string,text,by) {
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return string;
	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) return string;
	if (i == -1) return string;
	var newstr = string.substring(0,i) + by;
	if (i+txtLength < strLength)
	newstr += replace(string.substring(i+txtLength,strLength),text,by);
	return newstr;
 }
function buildXmlFromDOM(id) {
 	output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"+document.getElementById(id).innerHTML;
		output = replace(output,"\n","");
		output = replace(output,"\r","");
		output = replace(output,"\t","");
		for(var i = 0; i < 100; i++) {
				output = replace(output,"> ",">");
		}
	return output;
 }
function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return document.getElementById(movieName);
 }
function pushMenuToFlash(id) {
	var text = buildXmlFromDOM(id);
	try {
		getFlashMovie("flashUNIQUEID").sendMenuToFlash(text);
	}
	catch (ex) {
		//alert(ex);
	}
 }
function pushXmlToFlash(id) {
	var text = buildXmlFromDOM(id);
	try {
		getFlashMovie("flashUNIQUEID").sendXmlToFlash(text);
	}
	catch (ex) {
		//alert(ex);
	}
 }
function getTextFromFlash(id) {
  var text = buildXmlFromDOM(id);
  return text;
 }
function stopVideoFlash() {
	try {
		getFlashMovie("flashUNIQUEID").stopFlashVideo();
	}
	catch (ex) {
		//alert(ex);
	}
}