function addToBasket(file_id, image_id, tn_image_id, article_id)
{
	var param;

	if (file_id > 0)
		param = 'file_id=' + file_id;
	else if (image_id > 0)
		param = 'image_id=' + image_id + '&tn_image_id=' + tn_image_id;
	else if (article_id > 0)
		param = 'article_id=' + article_id;
	else
	{
		alert('Ошибка в параметре!');
		return;
	}
							
	if (!http) http = getRequestObj();
	if (!http) return false;
	
	http.open('get', '/add_to_basket.php?' + param);
	basketDiv = getObject('basketId');

	///////////////////////////////////////////////////////////////
	http.onreadystatechange = 
		function() 
		{
			
			if ((http.readyState == 4) && (http.status == 200))
			{
				////////////////////////////////////////////////
				var responseTxt = http.responseText;//ответ в формате: [флаг объект уже был в корзине или нет]:[кол-во элевментов в корзине]
				
				var posSep = responseTxt.indexOf(':');//позиция разделителя
				var alreadyExist = responseTxt.substr(0, posSep);
				var count = responseTxt.substr(posSep + 1);//учитываем (+ 1 позиция)
//				alert(alreadyExist + ':' + count);
				///////////////////////////////////////////////
				
				if (alreadyExist == 1)
					alert('Объект не может быть добавлен в корзину, т.к. он уже есть в корзине!');
				else
				{
					alert('Файл добавлен в корзину');
					basketDiv.innerHTML = 'Объектов: ' + count; 
				}	
			}
								
		}		
	/////////////////////////////////////////////////////////////////
		
	http.send(null);
}
			
function getObject(ObjectId) 
{  
	var Obj;
	if (document.getElementById)
		Obj = document.getElementById(ObjectId);
	else if (document.all)
		Obj = eval("window." + ObjectId);
	else if (document.layers)
		Obj = document.layers[ObjectId];
	else
		Obj = null;

	return Obj; 
}      