var xmlHttp

function showform(str,str1)
{
	
/*
if (str.length==0)
  { 
  document.getElementById("formdisplay").innerHTML="";
  return;
  }*/
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
if (str.length==0)
{
alert("Please enter your Name.");
return;
}
if (str1.length==0)
{
alert("Please enter your E-mail Id.");
return;
}

if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str1))){
	alert("Invalid E-mail Id! Please re-enter.");
return;
}

var url="www.primesource.infusionsoft.com/AddForms/processForm.jsp";
url=url+"?str="+str;
url=url+"&str1="+str1;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedform;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChangedform() 
{ 
if (xmlHttp.readyState==4)
{ 
//document.getElementById("formdisplay").innerHTML=xmlHttp.responseText;
document.getElementById("formdisplay").innerHTML="done";
window.location="success.php";
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
