var respID="";

var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try 
{
	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e)
{
	try 
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} 
	catch (e2) 
	{
		xmlHttp = false;
	}
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
{
  xmlHttp = new XMLHttpRequest();
}


function ajaxPost(rID,url,param) 
{						
	respID = rID;
	
	xmlHttp.open("POST", url, true);
	xmlHttp.onreadystatechange = updatePage;				
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.setRequestHeader("Accept-Language", "ru, en");
	xmlHttp.setRequestHeader("Accept-Charset", "utf-8;q=1");	
	xmlHttp.send(param);				
}

function js_exe(script){
	var start_string = "<script";
	var mid_string = ">";
	var end_string = "</script>";
	
	var i=0;
	while (script.indexOf(start_string) != -1){
		i=i+1;
		
		var tmp_pos = '';
		var script_elem = '';		
		
		tmp_pos=script.indexOf(start_string)+start_string.length;
		script=script.substring(tmp_pos);
		
		tmp_pos=script.indexOf(mid_string)+mid_string.length;
		script=script.substring(tmp_pos);		
		
		script_elem=script.substring(0,script.indexOf(end_string));
		script_elem=script_elem.replace(/&amp;/, "&");
		eval.call(window, script_elem);
		
		//alert(script_elem);
					
		tmp_pos=script.indexOf(end_string)+end_string.length;
		script=script.substring(tmp_pos);
	}				
}	


function updatePage(){
	if (xmlHttp.readyState == 4){ 
    	if (xmlHttp.status == 200){
			if (xmlHttp.responseText != "") 
			{
				if (respID != "") 
					document.getElementById(respID).innerHTML = xmlHttp.responseText;
			
				js_exe(xmlHttp.responseText);
			}
		
		}
	}
}