
// add favorites object
function addToFavorites(type, id, company)
{
	cur=$("#btnAddFavorites"+id).attr("src");
	if(cur.indexOf('add')>0){
	  oper='add';
	}else if(cur.indexOf('del')>0){
	  oper='del';
	}else{
		alert('ddd');
		return false;
	}
 	$("#btnAddFavorites"+id).attr("src", "http://img.allcorp.ru/img/allcorpru/loading.gif");
    $("#favorites").load("/ajax.html",{oper:oper+'favorite',type:type,id:id,company:company}, function(data){
	 	if(oper=='del'){oper='add';}else{oper='del';};
  	    $("#btnAddFavorites"+id).attr("src", "http://img.allcorp.ru/img/allcorpru/fav"+oper+".png");
 	  });

}
// delete favorites object
function delFromFavorites(type,id)
{
	$("#" + type + "_" + id).html('Подождите...');
	$("#favorites").load("/ajax.html",{oper: "delfavorite",type: type,id: id}, function(data){ 
	  $("#" + type + "_" + id).remove();
	});
}

function bayan(x){
	status=$("#bayantr"+x).css('display');
	$("img[rel=bayanimg]").attr('src','http://img.allcorp.ru/img/allcorpru/plus.png');
	$("tr[rel=bayantr]").hide();
	if(status=="none" || status==""){
		$("#bayanimg"+x).attr('src','http://img.allcorp.ru/img/allcorpru/minus.png');
		$("#bayantr"+x).show();
	}
}
