$ = function(el){return document.getElementById(el)}

var xmlHttp = false;

try {
  xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
  try {
    xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
  } catch (othermicrosoft) {
    try {
      xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
    } catch (failed) {
      xmlHttp = false;
    }
  }
}

if (!xmlHttp)
  alert('Error initializing XMLHttpRequest!');


function getFormData(fId){
	var targetForm = document.forms[fId];
	var key;
	var val;
	var returnData = '';
	for (i=0; i<targetForm.elements.length; i++) {
		key = '';
		if (targetForm.elements[i]['name'] == '') continue;
		if (targetForm.elements[i]['value'] == '') continue;

		if (i != 0) key += '&';
		key += targetForm.elements[i]['name'];
		val = targetForm.elements[i]['value'];

		returnData += key+'='+val;
	}
	return returnData;
}
