<?php
class MButtonClose extends MLink
{
    public function __construct($action)
    {
        parent::__construct('', '', '','&nbsp;');
        $history = $this->manager->history;

        if ($action == 'back')
        {
            $action = $history->back('action');
        }
        elseif ($action == 'backContext')
        {
            $action = $history->back('context');
        }

        // if $action is a "normal" url, prefix it with "GO:" to generate a doLink
//        $href = ( substr(strtoupper($action), 0, 7) == 'HTTP://' ? 'GO:'.$action : $action);
        $href = $action;

        $this->setHREF($href);

        $div = new MDiv('','','mButtonCloseUp');
		$div->addAttribute('title','Fechar');
        $div->addEvent('mousedown',"event.currentTarget.className='mButtonCloseDown';");
        $div->addEvent('mouseout',"event.currentTarget.className='mButtonCloseUp';");
        $div->addEvent('mouseup',"event.currentTarget.className='mButtonCloseUp';");
        $this->text = $div->generate();
    }
}
?>