//Global Variable
var xmlHttp=GetXmlHttpObject();
//Creating Ajax Object Based on Browser
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;
}

//Utility Method - Trim the Sting in Java Script
function trim(str) {
  str = str.replace( /^\s+/g, "" );// strip leading
  return str.replace( /\s+$/g, "" );// strip trailing
}

var parentMenuName
var childMenuName
//-------------------------------------
function displayContent(contentType,parentName,childName){ 
	//alert("Content Name is :"+contentType+" Parent Name "+parentName+" Child Name"+childName);
	parentMenuName = parentName;
	childMenuName = childName;
	
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	}	
	var url="getContent.jsp?contentType="+contentType;
	xmlHttp.onreadystatechange=display;		
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null);	
}

function display(){ 	
	if (xmlHttp.readyState==4){ 
		var resp = trim(xmlHttp.responseText);		
		if (resp != ""){
			document.getElementById('myTD').innerHTML = resp;
			//Change Title
			document.getElementById('contentTitle').innerHTML = parentMenuName +" >> "+childMenuName;
		}	
	} // end of main if
}// end of funtion
