Using the Arduino as a power switch

I have a project that requires coding and some type of hardware interaction, so I decided to use an Arduino to switch power sources for a 110v standard fan in a green house. What I plan to do is use the Arduino to control a solar panel and a AC powersource. During the day when the solar panel has enough energy, use it to run the fan. At night, or when the solar panel can not provide enough energy, switch to the AC outlet as a back up. I am just looking for an outline of what exactly I have to do, and parts I would need like a converter. Thanks.

unless the solar panel is massive it wont run a 110v fan

I'm guessing he means that he plugs into a 110 socket. But being in a green house it could be that big I guess.

He says 110v, so i guess he is in america and looking to run a 110v ac fan,

that would need an inverter from a storage battery, and a massive solar panel, but it might be a massive greenhouse:)

Assuming your solar system has enough power to drive the fan, what you want is a voltage meter on the solar system that measures the current. If there is enough current, use a relay to connect the fan to the solar side. If there is not enough power, use the other setting of the relay to connect the fan to the wall socket. I wouldn't worry about trying to measure if there is daylight, etc. just whether the solar side is producing enough energy.

Here is an open energy monitoring system I found via google: http://openenergymonitor.org/emon/.