function ajaxRequest(src, objID, action)
{	
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			if(typeof action == 'function')
				action(xmlhttp.responseText);
			else
				document.getElementById(objID).innerHTML = xmlhttp.responseText;
			
			loadScripts(xmlhttp.responseText);
		}
	}
	
	xmlhttp.open("GET",src,true);
	xmlhttp.send();
}

function ajaxPostRequest(src, params, objID, action)
{
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			if(typeof action == 'function')
				action(xmlhttp.responseText);
			else
				document.getElementById(objID).innerHTML = xmlhttp.responseText;
			
			loadScripts(xmlhttp.responseText);
		}
	}
	xmlhttp.open("POST",src,true);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(params);
}

function loadScripts(response)
{
	var from = response.search('>') +1;
	var to = response.search('</script>');
	if (from != -1 && to != -1)
	{
		script = document.createElement('script');
		script.type = 'text/javascript';
		script.text = response.substring(from, to);
		document.getElementsByTagName('head')[0].appendChild(script);
	}
}
