mainid = '';
function GetXmlHttpObject(handler)
{   var objXMLHttp=null
	 if (window.XMLHttpRequest)
	 {
		objXMLHttp=new XMLHttpRequest();
	 }
	 else if (window.ActiveXObject)
	 {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	 return objXMLHttp;
}

function stateChanged_sub_blog()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		//document.getElementById("show_success").style.display="block";
		//document.getElementById("show_post").style.display="none";
		
		document.getElementById("is_subscribe").value="yes";		
		document.getElementById("show_success"+mainid).innerHTML=xmlHttp.responseText;
		
	}
}
function stateChanged_sub_blog1()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		//alert(xmlHttp.responseText);
		//document.getElementById("show_success").style.display="block";
		//document.getElementById("show_post").style.display="none";
		
		document.getElementById("is_subscribe").value="no";		
		document.getElementById("show_success"+mainid).innerHTML=xmlHttp.responseText;
		
	}
}


function subscribe_blog(path,id,tid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	var url=path+"blog/subscribe_blog.php"
	url=url+"?blog_id=" + id
	url=url+"&template_id=" + tid
	url=url+"&sid="+Math.random();
	
	mainid = id;	

	xmlHttp.onreadystatechange=stateChanged_sub_blog;
	xmlHttp.open("POST",url,true) ;
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", url.length);
	xmlHttp.setRequestHeader("Connection", "close");

	xmlHttp.send(url);
}

function unsubscribe_blog(path,id,tid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp == null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	var url=path+"blog/unsubscribe_blog.php"
	url=url+"?blog_id=" + id
	url=url+"&template_id=" + tid
	url=url+"&sid="+Math.random();
	//alert(url);
	mainid = id;	

	xmlHttp.onreadystatechange=stateChanged_sub_blog1;
	xmlHttp.open("POST",url,true) ;
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", url.length);
	xmlHttp.setRequestHeader("Connection", "close");

	xmlHttp.send(url);
}
document.write(' <\/script>');
document.write(' <\/script>');
