Ok, first, I dont understand what prev/next images have anything to do here? (in fact if they dont work, then you did something wrong when modified code, probably in details.php)
Second, are you trying to search in a specific category INCLUDING it's subcategories? or just search in all categories? If later, then it should work without problem by default, unless you modifyed search.php file and now it doesnt.