function diff=f_qhncsp(XX,alfa,delttass,Ass,rss,gss,hb,deltah,ksi,epsilonass)


% copied from f_qhnc, to change the par deltta to delttass, for the use
% in hm4sim

% added gamma back


%Calculates the steady state capital 
%Output:    diff: difference between the lhs and rhs of the equilibrium
%                   condition (needs to be 0)
%Input:     XX: vector of capital and labor (K,N)
%           params: structure of parameters

%Created by Peter Karadi
%June 2010

Qh   =   XX(1);
Nc   =   XX(2);

%Creating variables from the params structure
% params_names     =   fieldnames(params);
% nn=length(params_names);
% for ii=1:nn
%     eval([params_names{ii} '=params.' params_names{ii} ';']);
% end;

%Calculating steady state values
epsilona=epsilonass;
A = Ass;
R =1+rss;
gh = gss;
% g =0;
gam = 1; 
%v=0;
Pm = (epsilona-1)/epsilona; 
Pd = (epsilona-1)/epsilona;
Yc = Nc^(1-alfa);
Nh = Qh^(1/alfa)*Nc;
N = Nc+Nh;
Yh = Nh^(1-alfa);
Y = Yc + Qh*Yh;
H = 1/deltah*Yh;
C = Yc- gh/(1+gh)*Y;
Ct = (1-hb)*C;
W = Pm*(1-alfa)*Nc^(-alfa);



% D = alfa*(Yc + Qh*Yh);
% Q = D/(R-1);
% Siggma = (ksi*(Q+Qh*H)/Ct-ksi+1)/(1-(1-ksi)/R);
% Ome = Q +Qh*H+D;

%gam*Ct/(1-(1-deltah)/R)/(Yc + Qh*Yh)


diff(1)     =   delttass/(1-N)-W/Ct;
diff(2)     =   Qh*H - gam*Ct/(1-(1-deltah)/R);