//remove string whitespace
function trimString(str)
{
	return str.replace(/^\s+|\s+$/g, '');
}

//basic email validation
function validateEmail(str)
{
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 }
 
 function getRequestObject()
{
	var xmlHttp;
	try
	  {
	  // modern browsers
	    xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer 6
	  try
	    {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    try
	      {
		//old internet explorer
	      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	      }
	    catch (e)
	      {
	      xmlHttp  =  null;
	      }
	    }
	  }
	  return xmlHttp;
 }