function select_pic(id){
	if (xmlHttp){
		try{			
			xmlHttp.open("POST", "niel/scripts/select_pic.php", true);
			xmlHttp.onreadystatechange = handleRequestStateChange;
			xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlHttp.send("id="+id);
		}
		catch(e){
			alert("Невозможно соединиться с сервером.");
		}
	}
}

function handleRequestStateChange(){
	myDiv = document.getElementById("ajaxDiv");
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			try{
				response = xmlHttp.responseText;
				myDiv.innerHTML = response;
			}
			catch(e){
				alert("Ошибка чтения ответа!");
			}
		}
	}
}

