function SetClass(AObject, AClass) {
 if (AObject.className != AClass) AObject.className = AClass;
}



//function doLoadItems(e, AValue)
function doLoadItems(AValue)
{
 var req = new JsHttpRequest();
 document.getElementById('result').innerHTML = '<div class="red_bold_text">Идет загрузка...</div>';
 req.onreadystatechange = function()
 {
  if (req.readyState == 4)
  {
   document.getElementById('result').innerHTML = req.responseText;
  }
 }

 req.open(null, 'get_items.php', true);
 req.send( { kind_id: AValue, city_id: document.getElementById('city_id').value,
 ur1: document.getElementById('ur1').value,
 ur2: document.getElementById('ur2').value } );
}

function doLoadShopsItems(AValue)
{
 var req = new JsHttpRequest();
 document.getElementById('result').innerHTML = '<div class="red_bold_text">Идет загрузка...</div>';
 req.onreadystatechange = function()
 {
  if (req.readyState == 4)
  {
   document.getElementById('result').innerHTML = req.responseText;
   SetHeight();
  }
 }
 req.open(null, 'get_shops_items.php', true);
 req.send( { oid: AValue, city_id: document.getElementById('city_id').value } );
}

function ItemSearch(ASelect)
{
	document.getElementById('oid').value =	document.getElementById(ASelect).value;
	document.forms['si2'].submit();
}

function setCheckboxes(container_id, AElem)
{
	var checkboxes = document.getElementById(container_id).getElementsByTagName('input');
	var state = AElem.checked;

	for ( var i = 0; i < checkboxes.length; i++ )
	{
  if ( checkboxes[i].type == 'checkbox' )
  {
   checkboxes[i].checked = state;
  }
	}
	return true;
} // end of the 'setCheckboxes()' function

function StopPropagation(e)
{
 if ('returnValue' in e)
 {
  e.returnValue = false;
  return false;
 }
 else
 {
  e.preventDefault();
  e.stopPropagation();
  return false;
 }
}

function del_object(e, AName)
{
 ret = confirm('Вы действительно хотите удалить ' + AName + '?');
 if (!ret)
 { 	StopPropagation(e);
 }
}


function SendMsg(uid, unick, city, callstr)
{
 var city_str = '';
 if (city == 1) city_str = 'kovcheg';
 if (city == 2) city_str = 'smorye';
 if (city == 3) city_str = 'utes';
 if (callstr)
 {
  call_str = callstr + ' fwd: hhunt.ru';
  call_str = 'http://' + city_str + '.apeha.ru/interface/chat.fpl?body=' + call_str + '&to_id=' + uid + '&to_nick=' + unick;
//  call_str = 'http://' + city_str + '.apeha.ru/fcgi-bin/chhatadd.fpl?body=' + call_str + '&to_user_id=' + uid + '&to_user_nick=' + unick;
//  alert(call_str);
  SendMessage = window.open(call_str, 'PrivCall' + uid, 'height=50, width=50, left=50, top=50');
 }
}

function PrivateCall(uid, unick, city)
{
 var call_str = prompt('Послать приват игроку ' + unick +':', '');
 SendMsg(uid, unick, city, call_str);
}

