var gBrowser = null;

function getBrowser(){
  if (!gBrowser)
    gBrowser = document.getElementById("content");
  return gBrowser;
} // getBrowser

function getDocument() {
//	return document;
  return window._content.document;
}

function lightup() {
    // Javascript code to determine whether the icon should light up
    return 0;
}

function extionsionname_lightup() {
		if (lightup()) {
			statuslogo = document.getElementById('extensionname-status');
			statuslogo.setAttribute('src', 'chrome://extensionname/content/extensionname.png');
		}
}

function main_extensionname() 
{ 
   	statuslogo = document.getElementById('extensionname-status');
   	statuslogo.setAttribute('src', 'chrome://extensionname/content/extensionname_off.png');
	extensionname_lightup();
}

function addLoadListener() {
	// listen for navigation events
	getBrowser().addEventListener("load", function() {main_extensionname();}, true);
	// listen for tab switches
	getBrowser().addEventListener("select", function() {main_extensionname();}, true);
}

function extensionname_clicked() {

     // Javascript to perform on clicking.
     // The following example changes the browser location to example.com.
     // getDocument().location.href='http://example.com/'
}
addLoadListener();
