function submitMessage(key, serviceUrl){
	var css = '<head><link rel="stylesheet" type="text/css" href="http://static5.cdn.ubi.com/u/HOMMK/mightandmagicheroeskingdoms.ubi.com/1.5.0.90-2-MTR/css/prod.css" /></head>';
	var messageBoxHeaderElement = getMessageElementByClass('messageBoxFrameMessageHeader');
	var messageBoxContentElement = getMessageElementByClass('messageBoxFrameMessageContent');
	var subjectText = getMessageElementByClass('messageHeaderSubject').textContent;
	var dateText = getMessageElementByClass('messageHeaderSubject').parentNode.textContent.replace(subjectText, '');
	var receiverText = getMessageElementByClass('messageHeaderReceivers').textContent;
	
	var messageCode = outerHTML(messageBoxHeaderElement);
	messageCode += outerHTML(messageBoxContentElement);
	messageCode = removeHiddenChildrenOfNodeInHtml(messageBoxContentElement, messageCode);
	var code = css + messageCode;
	code = code.replace(/"/g, '&quot;');
	var headerText = messageBoxHeaderElement.textContent;
	var contentText = messageBoxContentElement.textContent;
	contentText = removeHiddenChildrenOfNodeInContentText(messageBoxContentElement, contentText);
	
	var newWindow = window.open("", "_blank"); 
	var newSource = '<form id="tmpForm" action="'+serviceUrl+'" method="post">';
	newSource += createHiddenField("source", code); 
	newSource += createHiddenField("key", key); 
	newSource += createHiddenField("subjectText", subjectText); 
	newSource += createHiddenField("dateText", dateText); 
	newSource += createHiddenField("receiverText", receiverText); 
	newSource += createHiddenField("contentText", contentText);
	newSource += createHiddenField("userId", getUserId());
	newSource += '</form>';
	newWindow.document.charset=document.charset;
	newWindow.document.body.innerHTML += newSource;
	newWindow.document.getElementById("tmpForm").submit();
}

function createHiddenField(name, value) {
	return '<input type="hidden" name="' + name + '" value="' + value + '" />';
}

function getMessageElementByClass(className) {
	var allElementsOfClass = document.getElementsByClassName(className);
	return allElementsOfClass[allElementsOfClass.length-1];
}

function removeHiddenChildrenOfNodeInHtml(parent, html) {
	var children = parent.getElementsByClassName("hidden");
	for (var i in children) {
		if (children[i].nodeType == 1) {
			html = html.replace(outerHTML(children[i]), '');
		}
	}
	return html;
}

function removeHiddenChildrenOfNodeInContentText(parent, text) {
	var children = parent.getElementsByClassName("hidden");
	for (var i in children) {
		if (children[i].nodeType == 1) {
			text = text.replace(children[i].textContent, '');
		}
	}
	return text;
}
function outerHTML(node){
	// IE and Chrome have their own method
	return node.outerHTML || (
		function(n){
			var div = document.createElement('div'), h;
			div.appendChild( n.cloneNode(true) );
			h = div.innerHTML;
			div = null;
			return h;
		}
	)(node);
}

function getUserId() {
	if (!localStorage.userId) {
		localStorage.userId = guid();
	}
	return localStorage.userId;
}
function S4() {
	   return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid() {
   return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}

@@ -923,15 +923,24 @@
 ce(/
-%22
+&quot;
 /g, '&
+amp;
 quot
@@ -949,74 +949,56 @@
 );%0A%09
-var headerText = messageBoxHeaderElement.textContent;%0A%09var content
+code = code.replace(/%22/g, '&quot;');%0A%09var header
 Text
@@ -1006,31 +1006,30 @@
 = messageBox
-Content
+Header
 Element.text
@@ -1038,16 +1038,20 @@
 ntent;%0A%09
+var 
 contentT
@@ -1120,29 +1120,16 @@
 tElement
-, contentText
 );%0A%09%0A%09va
@@ -2433,17 +2433,27 @@
 rent
-, text) %7B
+) %7B%0A%09var text = '';
 %0A%09va
@@ -2476,40 +2476,18 @@
 ent.
-getElementsByClassName(%22hidden%22)
+childNodes
 ;%0A%09f
@@ -2538,24 +2538,81 @@
 odeType == 1
+ && !children%5Bi%5D.getAttribute(%22class%22).contains(%22hidden%22)
 ) %7B%0A%09%09%09text 
@@ -2615,23 +2615,11 @@
 ext 
++
 = 
-text.replace(
 chil
@@ -2637,21 +2637,16 @@
 tContent
-, '')
 ;%0A%09%09%7D%0A%09%7D

fix images in firefox.