Declaring a global variable?

I am trying to declare a global variable, a variable that will be recognized throughout the entire site. Then I am checking for that variable with a function inside of a movieClip, that is inside of another movieClip.

I declare the variable on the main timeline like this:

var habitat:String = "habitat"

Then set the variable depending on which page you go to: (you must go to one before moving on)

habitat = "forest";

And then on nested two movieClips down, I check for it using this function:

function habitatBG(event:Event):void {

	if (habitat == "forest") {
		MovieClip(parent.parent).gotoAndStop("forest_critters");
		trace ("Forest VAR 1");
	} else if (habitat == "seashore"){
		MovieClip(parent.parent).gotoAndStop("seashore_critters");
		trace ("Seashore VAR 1");
    } else if (habitat == "prairie"){
		MovieClip(parent.parent).gotoAndStop("prairie_critters");
		trace ("Prairie VAR 1");
    } else if (habitat == "desert"){
		MovieClip(parent.parent).gotoAndStop("desert_critters");
		trace ("Desert Var 1");
    } else if (habitat == "marine"){
		MovieClip(parent.parent).gotoAndStop("marine_critters");
		trace ("Marine VAR 1");
    } else {
		MovieClip(parent.parent).gotoAndStop("home");
		trace ("Wlcome back home");
    }
}

However when I publish, it tells me:

Symbol 'journal_open', Layer 'Actions', Frame 1, Line 27	1120: Access of undefined property habitat.


What am I doing wrong?