var loc='http://travinh-today.com/news/ajax/';
var url='htpp://localhost/ci/pj2/';
function obj()
{
	var td, dd;
	td=navigator.appName;
	if(td == "Microsoft Internet Explorer")
	{
		dd= new ActiveXObject("microsoft.XMLHTTP");	
	}
	else
	{
		dd= new XMLHttpRequest();
	}
	return dd;
}

var http=obj();

function switch_articles(id)
{
	http.open('get',loc+'switch_articles/'+id,true);
	http.onreadystatechange=function()
	{
		if(http.readyState == 4 && http.status == 200)
		{
			document.getElementById('lastnews').innerHTML = http.responseText;
		} 
		
	}
	http.send(null);	
}

function bad_comment(id)
{

	http.open('GET',loc+'bad_comment/'+id,true);
	http.onreadystatechange=function()
	{
		if(http.readyState == 4 && http.status == 200)
		{
			alert('Cam on ban da thong bao . Chung toi se xem xe lai noi dung binh luan nay');
		} 
		
	}
	http.send(null);	
	
}

function delcom(id)
{
	http.open('GET',loc+'delcom/'+id,true);
	http.onreadystatechange=function()
	{
		if(http.readyState == 4 && http.status == 200)
		{
			alert('Delete sucessfully.');
			window.location.reload( false );			
//			window.location=url;
		} 
		
	}
	http.send(null);		
}
