//global variables used to store object;
var req;
var setobj;
var falgchk=0;


//Create xmlhttp object.
function createXMLHttpRequest() {    
	var ua;
	
	if(window.XMLHttpRequest) {    
		try {     
			ua = new XMLHttpRequest();    
		} catch(e) {     
			ua = false;    
		}    
	} else if(window.ActiveXObject) {     
		try {       
			ua = new ActiveXObject("Microsoft.XMLHTTP");     
		} catch(e) {       
			ua = false;     
		}    
	}   return ua;   
}     

//Request file to get output.
function sendRequest(file) { 
	var str = "";  
	
	req.open('GET', file);    
	req.onreadystatechange = handleResponse;  	
	req.send(null);   
	return false;  
}   

// REQUEST FILE WITH METHOD POST
function sendRequest_POST(file,params) {  
	var str = "";    

	req.open('POST', file, true);    

	//Send the proper header information along with the request
	req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	req.setRequestHeader("Content-length", params.length);
	req.setRequestHeader("Connection", "close");

	req.onreadystatechange = handleResponse;    
	req.send(params);   
	return false;  
}


//Get response for div poppulation.
function handleResponse() {   
	if(req.readyState == 4){    
		var response = req.responseText;
		//alert(response);
		setobj.innerHTML = response;
	}  
}

//function to show a div.
function showdiv(divobj)
{
	//if(window.parent.sel_search != "undefined")
	//	window.parent.sel_search.style.visibility = "hidden";
	
	divobj.style.visibility="visible";
	//alert("hello");
	//document.getElementById("username_div").style.display="none";
}

//function to hide a div.
function hidediv(divobj)
{
	//if(window.parent.sel_search != "undefined")
	//	window.parent.sel_search.style.visibility = "visible";

	divobj.style.visibility="hidden";
	
}
function displayLoading(element) {
  while (element.hasChildNodes()) {
    element.removeChild(element.lastChild);
  }
  var image = document.createElement("img");
  image.setAttribute("src","images/loading.gif");
  image.setAttribute("alt","Loading Loading...");
  element.appendChild(image);
}
