function convertCode(){
	var strHTML = 'heyhey<p>Inside a P tag</p> and an image: <img SRC="#" ALT="An image with A TEXT" BORDER="0">, and also one without quotes: <div class=myClass>With class</div> and with one with single quotes: <span title=\'A Small sPAn\'>A SPan</span>. This is finished with a H1 tag, here: <h1>Heading of the page</h1>, followed by an unclosed BR tag.<BR>';
	
	// Replaces uppercase tags and attribute names with lowercase characters
	strHTML = strHTML.replace(/<\/?[A-Z]+|[A-Z]+=/g, function (strMatch){
		return strMatch.toLowerCase();
	});
		
	// Replaces single quotes with double ones
	strHTML = strHTML.replace(/='[^']*'/g, function (strMatch){
		return strMatch.replace(/'/g, "\"");
	});
		
	// Replaces attribute values without quoutes with double quotes
	strHTML = strHTML.replace(/=([\w\d\s]*)(\s\w+=|>)/g, "=\"$1\"$2");
		
	// Closes unclosed IMG and BR tags
	strHTML = strHTML.replace(/(<(img|br)[^>]*)([^\/]|\b)>/gi, "$1$3 />");
	
	alert("Output code:\n" + strHTML);
}