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;
}



function insertEmail(strEmail)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="emaillist_insert.php";
	url=url+"?insert_email=true";
	url=url+"&email="+strEmail;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=function() {
	 if (xmlHttp.readyState==4)
		{ 
		document.getElementById("email_register").innerHTML='\
		           <table width="100%" border="0" cellspacing="0" cellpadding="0">\
					   <tr>\
						<td width="100%" class="news_text" style="padding-left:10px;">'
						     +    xmlHttp.responseText + '</td>\
						</td>\
					   </tr>\
				  </table>';
				  paush(0);
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function insertValidEmail(){
     if((document.getElementById('email').value.search("@") == -1) || ( document.getElementById('email').value.search("[.*]" ) == -1 )) 
	{
		alert('Email Address seems incorrect!');
		document.getElementById('email').focus();
		return false;
	}
	else
	{
		insertEmail(document.getElementById('email').value);
		return false;
	}
}


function insertEmailHome(strEmail)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="emaillist_insert.php";
	url=url+"?insert_email=true";
	url=url+"&email="+strEmail;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=function() {
	 if (xmlHttp.readyState==4)
		{ 
		document.getElementById("email_register").innerHTML='\
		           <table width="100%" border="0" cellspacing="0" cellpadding="0">\
					   <tr>\
						<td width="100%" class="text_email" style="padding-left:10px;">'
						     +    xmlHttp.responseText + '</td>\
						</td>\
					   </tr>\
				  </table>';
				  paush(0);
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}



function insertValidEmailHome(){
     if((document.getElementById('email').value.search("@") == -1) || ( document.getElementById('email').value.search("[.*]" ) == -1 )) 
	{
		alert('Email Address seems incorrect!');
		document.getElementById('email').focus();
		return false;
	}
	else
	{
		insertEmailHome(document.getElementById('email').value);
		return false;
	}
}

