if (typeof DOMParser == "undefined") {
	xmlProlog = "";


	DOMParser = function () {}

   DOMParser.prototype.parseFromString = function (str, contentType) {
	   
      if (typeof ActiveXObject != "undefined") {
		
		if(str.indexOf("?>") != -1){
			xmlProlog = str.substring(0, str.indexOf("?>") + 2);
			str = str.substring(str.indexOf("?>") + 2);
		}
		var progIDs = [ 'Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.5.0', 'Msxml2.DOMDocument.4.0', 'Msxml2.DOMDocument.3.0', 'Msxml2.DOMDocument' ];
		
		for (var i = 0; i < progIDs.length; i++) {
			try {
				var xmlDOM = new ActiveXObject(progIDs[i]);
				xmlDOM.async = false;
				xmlDOM.loadXML(str);
			   
				return xmlDOM;
			}
			catch (ex) {
			}
		}
      } else if (typeof XMLHttpRequest != "undefined") {
         var req = new XMLHttpRequest;
         req.open("GET", "data:" + (contentType || "application/xml") +
                         ";charset=utf-8," + encodeURIComponent(str), false);
         if (req.overrideMimeType) {
            req.overrideMimeType(contentType);
         }
         req.send(null);
         return req.responseXML;
      }
   }
}

if(typeof XMLSerializer == "undefined") {
	XMLSerializer = function() {}
	
	XMLSerializer.prototype.serializeToString = function (node) {
		return xmlProlog != "" ? xmlProlog + node.xml : node.xml;
	}
}


function getElementsByClass(searchClass, node, tag) {
    var classElements = new Array();
    if ( node == null )
        node = document;
    if ( tag == null )
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}
