//<script type="text/javascript">

var loadedobjects="";
//var rootdomain="http://"+window.location.hostname
//---------------------------
function ajaxpage(url, containerid)
{	
	var page_request = false
	
	if (window.XMLHttpRequest){// if Mozilla, Safari etc
		
		page_request = new XMLHttpRequest();
			
	}
	else if (window.ActiveXObject)
	{ // if IE
		
		try 
		{	
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
			
		} 
		catch (e)
		{	
			try
			{	
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
				
			}
			catch (e){}
		}
	}
	else
	{
		return false;
	}
	
	page_request.open('GET', url, true);
	page_request.onreadystatechange=function(){
		loadpage(page_request, containerid);
		initLightbox();
		}
	page_request.send(null);
	
}

//---------------------------------
// initialize the validation requests cache
	//var cache = new Array();
	var cache = "";
	
function ajaxpagepost(url, containerid)//,postdata)
{	
	var page_request = false
	
	if (window.XMLHttpRequest){// if Mozilla, Safari etc
		
		page_request = new XMLHttpRequest();
			
	}
	else if (window.ActiveXObject)
	{ // if IE
		
		try 
		{	
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
			
		} 
		catch (e)
		{	
			try
			{	
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
				
			}
			catch (e){}
		}
	}
	else
	{
		return false;
	}
	//var cacheEntry = cache.shift();
	page_request.open('POST', url,true);
	//page_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	page_request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=iso-8859-1");
	page_request.onreadystatechange=function(){
		loadpage(page_request, containerid);
		
		}
	//alert(cache);
	//x = encodeURIComponent(cache);
	page_request.send(cache);
	cache="";
	
	
	
	
}
//-----------------------------------
function loadpage(page_request, containerid)
{
		
if (page_request.readyState == 4 )
{
	if(page_request.status==200 || window.location.href.indexOf("http")==-1)
	{
		// read the response 
		response = page_request.responseText;
		
		// server error? 
		if (response.indexOf("ERRNO") >= 0 || response.indexOf("error") >= 0 || response.length == 0) { 
		// display error message 
		alert(response.length == 0 ? "Server serror." : response); 
		// exit function return; 
		} 
		//sus='<table border="0" cellspacing="0" cellpadding="0" width="780" align="center">'+
			//'<tr valign="top" >';
		//jos='</tr></table>';
		//document.getElementById(containerid).innerHTML=sus+response+jos;
		
		
		if(document.getElementById(containerid)){
		document.getElementById(containerid).innerHTML=response;
		}
		
	}
	else 
	{
		alert("Error reading server response.")
	} 
}
}
//----------------------------------
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ 
	//Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
//--------------------------
function init1(){
	
	ajaxpage('home.html','recent_news');
}

//----------------------------
function setCache(inputValue, fieldID)
{
// if we received non-null parameters, we add them to cache in the
// form of the query string to be sent to the server for validation
if (inputValue && fieldID )
{
// encode values for safely adding them to an HTTP request query string
//inputValue = encodeURIComponent(inputValue);
//fieldID = encodeURIComponent(fieldID);
// add the values to the queue
cache+=fieldID + "="+ inputValue + "&";
//cache.push(fieldID + "="+ inputValue + "&");
}
}
//</script>
