
//get object of http request
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 insertArticles(articlefilename , aritclescontent){
	//alert(articlefilename + "--" + aritclescontent);
	var url="article_insertion.php";
	var params = "articlefilename=" + articlefilename + "&articlecontent=" + aritclescontent;
	//alert(url); 
    //create object 
    xmlHttp=GetXmlHttpObject();
  		if (xmlHttp==null) {
 			alert ("Your browser does not support AJAX!");
  			return;
  		}// end if 
		
   xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.setRequestHeader("Content-length", params.length);
    xmlHttp.setRequestHeader("Connection", "close");
    xmlHttp.onreadystatechange = insertionresponse;
    xmlHttp.send(params);
	//ajax post to insert in articles tablell
}
function insertionresponse() 
	{ 
		if (xmlHttp.readyState==4){
			alert(xmlHttp.responseText);
		}// end if
	}// end fucntion
