
	// Creating merging fields.
	function addMergingProperties(cfg)
	{
		var req = newXMLHttpRequest(), param = '';
		req.open("POST", "http://www.postcards.dk/NewRealmail/GenericCardActions.php", false);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		param = "action=getSpecialTags";
		req.send(param);
		
		if (req.readyState == 4) {
			// Check that a successful server response was received
			if (req.status == 200) {
				// Pass the XML payload of the response to the handler function
				myXML = req.responseXML;
			} else {
				return;
			}
		} else {
			return;
		}
		cfg.specialtags["Flettefelt"] = '';
		var myTags = myXML.getElementsByTagName("specialTag");
		for (i=0;i<myTags.length;i++) {
			cfg.specialtags[myTags[i].getAttribute('description')] = "[%"+myTags[i].getAttribute('tag')+"%]";
		}
	
		// Get standard texts
		var req = newXMLHttpRequest(), param = '';
		req.open("POST", "http://www.postcards.dk/NewRealmail/GenericCardActions.php", false);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		param = "action=getStandardTexts";
		req.send(param);
		
		if (req.readyState == 4) {
			// Check that a successful server response was received
			if (req.status == 200) {
				// Pass the XML payload of the response to the handler function
				myXML = req.responseXML;
			} else {
				return;
			}
		} else {
			return;
		}
		
		cfg.stdtexts["Standardtekst"] = '';
		var myTexts = myXML.getElementsByTagName("standardText");
		for (i=0;i<myTexts.length;i++) {
			//cfg.stdtexts[unescape(myTexts[i].getAttribute('description')).substr(0,15)] = unescape(myTexts[i].firstChild.nodeValue);
			//cfg.stdtexts[unescape(myTexts[i].getAttribute('description').substr(0,30))] = unescape(myTexts[i].firstChild.nodeValue);
			
			var stdTitle_org = unescape(myTexts[i].getAttribute('description').substr(0,30));
			var stdTitle = stdTitle_org;
			var n = 0;
			while ( cfg.stdtexts[stdTitle] != undefined) {
				n++;
				stdTitle = stdTitle_org+"_"+n
			}

			cfg.stdtexts[stdTitle] = unescape(myTexts[i].firstChild.nodeValue);
		}
		
		// Get profiles.
		var req = newXMLHttpRequest(), param = '';
		req.open("POST", "http://www.postcards.dk/NewRealmail/GenericCardActions.php", false);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		param = "action=getProfiles";
		req.send(param);
		
		if (req.readyState == 4) {
			// Check that a successful server response was received
			if (req.status == 200) {
				// Pass the XML payload of the response to the handler function
				myXML = req.responseXML;
			} else {
				return;
			}
		} else {
			return;
		}
		
		cfg.profiles["Profil"] = '';
		var myProfiles = myXML.getElementsByTagName("profile");
		for (i=0;i<myProfiles.length;i++) {
			cfg.profiles[unescape(myProfiles[i].getAttribute('description')).substr(0,15)] = myProfiles[i].firstChild.nodeValue; //.replace('\"', '"');
		}
	}
