var xmlHttp;
function encode_utf8( s )	{
  return unescape( encodeURIComponent( s ) );
}

function decode_utf8( s )	{
  return decodeURIComponent( escape( s ) );
}

function execAjaxRequest(url,querystring,target,type,loader)	{
	if(loader)	{
		document.getElementById(target).innerHTML = document.getElementById(loader).innerHTML;
	}	
	xmlHttp=GetXmlHttpObject()	
	if (xmlHttp==null)	{
		alert ("Browser does not support HTTP Request")
		return
	}
	xmlHttp.onreadystatechange = function(){stateChanged(target,type,loader)};
	xmlHttp.open("POST",url,true)
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset:iso-8859-1');
	
	xmlHttp.send(querystring)
}

function stateChanged(target,type,loader)	{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	{
		document.getElementById(loader).style.visibility='hidden';
		if(type=='innerHTML')	
			document.getElementById(target).innerHTML=xmlHttp.responseText
		if(type=='value')
			document.getElementById(target).value=xmlHttp.responseText
		if(type=='src')	
			document.getElementById(target).src=xmlHttp.responseText
	} 	
}

function GetXmlHttpObject()	{
	var xmlHttp=null;
	try	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)	{
		try	{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)	{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  	}
	}
	return xmlHttp;
}
