function [yes_no]= threshold(window, thres);

sizewindow = size(window,1);

leftsize = (sizewindow -1)/2;

meanleft = mean(window([1:leftsize],:));
meanright = mean(window([(leftsize + 2):sizewindow],:));

stdleft = std(window([1:leftsize],:));
stdright = std(window([(leftsize + 2):sizewindow],:));

left = meanleft + (thres * sqrt(stdleft));
right = meanright + (thres * sqrt(stdright));

val = maximum(left, right);

if window(leftsize+1,1) > val
    yes_no = 1;
elseif window(leftsize+1,1) == max(window)
    yes_no = 1;
else
    yes_no = 0;
end


% if (window(leftsize+1,1) < left) & (window(leftsize+1,1) < right)
%     yes_no = 1;
% elseif (window(leftsize+1,1) > left) & (window(leftsize+1,1) > right)
%     yes_no = 1;
% else
%     yes_no = 0;
% end

return