function edit_calendar()
{
    $db = JFactory::getDBO();
    $cid = JRequest::getVar('cid', array(0), '', 'array');
    JArrayHelper::toInteger($cid, array(0));
    $id = $cid[0];
    $row = JTable::getInstance('spidercalendar_calendar', 'Table');
    // load the row from the db table
    $row->load($id);
    $lists = array();
    if ($row->published == '') {
        $row->published = 1;
    }
    $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
    $lists['allow_publish'] = JHTML::_('select.booleanlist', 'allow_publish', 'class="inputbox"', $row->allow_publish);
    $lists['get_email'] = JHTML::_('select.booleanlist', 'get_email', 'class="inputbox"', $row->get_email);
    $lists['time_format'] = JHTML::_('select.booleanlist', 'time_format', 'class="inputbox"', $row->time_format);
    $user = JFactory::getUser()->getAuthorisedGroups();
    $query = "SELECT * FROM #__usergroups";
    $db->setQuery($query);
    $userGroups = $db->loadObjectList();
    //def_month Select List
    $def_month = array('' => 'Current', 1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', 9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
    $def_monthOptions = array();
    foreach ($def_month as $key => $value) {
        $def_monthOptions[] = JHTML::_('select.option', $key, $value);
    }
    //end
    $lists['def_month'] = JHTML::_('select.genericlist', $def_monthOptions, 'def_month', 'class="inputbox"', 'value', 'text', $row->def_month);
    $lists['gid'] = JHTML::_('select.genericlist', $userGroups, 'gid', 'class="inputbox"', 'id', 'title', $row->get('gid'));
    // display function
    HTML_contact::edit_calendar($lists, $row, $themes, $userGroups);
}