Heat a/c problem

I have a 2004 Nissan Frontier. When the truck is idling the heat and a/c stop working, but the fan continues to blow.