How to check if a GameObject is active in an if statement

I am trying to make the skybox change when the Directional Light is on or off, but I am having trouble. I looked everywhere and can’t seem to find a working answer.

Code:

#pragma strict

var light : GameObject;
var NightSky : Material;
var DaySky : Material;

function Start () {

}
function Update () {
if ( light.active(false)){
RenderSettings.skybox = NightSky;
}
if ( light.active(true)){
RenderSettings.skybox = DaySky;
}



}

Can you edit it for me so it works? Thanks a lot.

Try this

if (GameObject.activeInHierarchy === true)
{
     //blah blah blah blah
}

This is a link → http://docs.unity3d.com/Documentation/ScriptReference/GameObject-activeInHierarchy.html