function openInformationBlock(infoblockname)
{
	var oInfoblock = 'document.getElementById("'+infoblockname+'")';
	eval(oInfoblock).style.display = "block";
	
}
function closeInformationBlock(infoblockname)
{
	var oInfoblock = 'document.getElementById("'+infoblockname+'")';
	eval(oInfoblock).style.display = "none";
}
function openSubscribe()
{	
	var email = document.getElementById('txtSubscribe').value;
	var subscribeType = document.getElementById('hdnType').value;
	var bAtmail = false;
    var bDotmail = false;
    for(i=0;i<=email.length;i++)
   	{
     	if(email.charAt(i)=='@' && !bAtmail)
     	{
	     	bAtmail=true;
	   	}
	   	
     	if(email.charAt(i)=='.' && bAtmail && !bDotmail)
     	{
	     	bDotmail=true;
	    }
   	}
	if(bAtmail && bDotmail)
	{
		 var sCorrEmailVal = '1';
	}	
	if(document.getElementById('txtSubscribe').value == "" || document.getElementById('txtSubscribe').value == "Enter your email" || (!bAtmail || !bDotmail))
	{
		document.getElementById('txtSubscribe').style.borderColor = "red";
		document.getElementById('txtSubscribe').style.color="red";		
		document.getElementById('txtSubscribe').style.fontFamily="Tahoma";
		document.getElementById('txtSubscribe').style.fontSize="11px";		
		document.getElementById('txtSubscribe').style.verticalAlign = "middle";
		document.getElementById('txtSubscribe').value="Enter your email";		
	}	
	else
	{			
		document.getElementById('txtSubscribe').style.fontFamily="Tahoma";
		document.getElementById('txtSubscribe').style.fontSize="11px";
		var postValues = encodeURIComponent(email)+'/'+ encodeURIComponent(subscribeType);	
		//var postValues = email+'/'+sType;	alert('alok');
	    var url="http://www.abspl.biz/inc/subscribe-abspl.rem.php";	   
        makeRequestSubscription(url,postValues);	
	}
}

function GetXmlHttpObject()
{
	var xmlHttp = null;
    try
    {
	    //Firefox,Opera 8.1
	    xmlHttp = new XMLHttpRequest();
    }
    catch(e)
    {
	   //Internet Explorer
	   try
	   {
		   xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	   }
	   catch(e)
	   {
		   try
		   {
			   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	       }
	       catch(e)
	       {
		       alert("Your browser doesn't support AJAX!");
		       return false;
	       }
      }
   }
   return  xmlHttp;
}
  
var xmlHttp=GetXmlHttpObject();

// SUBSCRIPTION REQUEST
function makeRequestSubscription(url, parameters) 
{
	
 //If our readystate is either not started or finished, initiate a new request
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
   
   url=url+"?query="+parameters;  
   xmlHttp.open("GET",url,true);
   //Set the function that will be called when the XmlHttpRequest objects state changes
   xmlHttp.onreadystatechange = updateSubscription; 

   //Add HTTP headers to the request 
     xmlHttp.send(null);  
 }   
}

function updateSubscription() 
{	 
 //Check if our response is ready
 if (xmlHttp.readyState == 4) 
 {	 
	 
	 if(xmlHttp.responseText == '<div>Error: Thank you for subscribing.</div>')
	 {  
		//Set the content of the DIV element with the response text
		document.getElementById('subscribe').style.display = "none";
		document.getElementById('thanks').style.display = "block";
		document.getElementById('thanks').style.borderColor = "#CDCDCD";
		document.getElementById('thanks').style.textAlign="left";
		document.getElementById('thanks').style.color="green";	
		document.getElementById('thanks').style.verticalAlign = "middle";		
 		document.getElementById('thanks').innerHTML="<div style='float:left;width:100%;'><img style='border:0px;float:left;margin:0px 5px 0px 5px;' src='http://www.abspl.biz/media/images/icon-tick.png' /><div style='float:left'>Thank you for subscribing.</div></div>";
 	 } 
 	 else if(xmlHttp.responseText == '<div>Error: You have already subscribed.</div>')
	 {   
		//Set the content of the DIV element with the response text
		document.getElementById('subscribe').style.display = "none";
		document.getElementById('thanks').style.display = "block";
		document.getElementById('thanks').style.borderColor = "#CDCDCD";
		document.getElementById('thanks').style.textAlign="left";
		document.getElementById('thanks').style.color="green";	
		document.getElementById('thanks').style.verticalAlign = "middle";		
 		document.getElementById('thanks').innerHTML="&nbsp;&nbsp;<span class='redWhiteText'>&nbsp;You have already subscribed.</span>";	
 	 } 
		
 } 
}