" what="profile">
          <h4>Birthday Info:</h4>
          <div class="row">
          	<label>Jewish Birthday:</label>
            <span class="value"><?php 
echo strGregToHeb($birthday, true);
?>
 - <?php 
echo strGregToHeb($birthday, false);
?>
</span>
          </div>
          <div class="row">
          	<label>Next Occurance:</label>
            <span class="value"><?php 
echo dateThisYear($ahebdate);
?>
</span>
          </div>
          <h4>Actions:</h4>
          <div class="row">
            <b><a href="http://www.facebook.com/inbox/?compose&id=<?php 
echo $id;
?>
" target="_blank" >
                Send
                <fb:name uid="<?php 
echo $_REQUEST['id'];
?>
" capitalize="true" linked="false" firstnameonly="true" />
                a Message
 public function getNextOccurance()
 {
     $ahebdate = explode("/", strGregToHeb($this->data['originalDate'], false, $this->data['night']));
     return dateThisYear($ahebdate);
 }
function updateJDateProfile($updateDB = true)
{
    global $facebook;
    global $bBornAfterSunset, $profileDesign, $displayCurrent, $displayLink, $birthday, $success;
    dbConnect();
    if (isset($_POST["Submit"]) && $_POST["Submit"] == "Submit" && $updateDB) {
        $strBornAfterSunset = "";
        if (isset($_POST["chkSunset"]) && $_POST["chkSunset"] == "on") {
            $strBornAfterSunset = "true";
        } else {
            $strBornAfterSunset = "false";
        }
        $profileDesign = isset($_POST["profileDesign"]) ? $_POST["profileDesign"] : 1;
        $displayCurrent = isset($_REQUEST["chkToday"]);
        $displayLink = isset($_REQUEST["chkExplanation"]);
        $sql = "UPDATE fbJewishDates SET BornAtNight={$strBornAfterSunset}, style={$profileDesign}, displayLink='{$displayLink}', displayCurrent='{$displayCurrent}' WHERE uid={$facebook->user}";
        mysql_query($sql) or die("You must un-install and re-install this app");
        $success = true;
    }
    $sql = "SELECT BornAtNight, Birthday, style, displayCurrent, displayLink FROM fbJewishDates WHERE uid='{$facebook->user}'";
    $results = mysql_query($sql);
    if (!($rs = mysql_fetch_assoc($results))) {
        addBirthdayRecord();
        $results = mysql_query($sql);
        $rs = mysql_fetch_assoc($results);
    }
    mysql_close();
    $bBornAfterSunset = $rs['BornAtNight'];
    $profileDesign = $rs['style'];
    $displayCurrent = $rs['displayCurrent'];
    $displayLink = $rs['displayLink'];
    $birthday = date("M d, Y", strtotime($rs['Birthday']));
    //$userInfo = $facebook->api_client->fql_query("SELECT birthday FROM user WHERE uid=$user");
    //$birthday = $userInfo[0]['birthday'];
    $fbml = printJewishBirthday($birthday, $bBornAfterSunset, $profileDesign, $displayCurrent, $displayLink);
    $mobileFBML = $fbml;
    $mainFBML = $fbml;
    $ahebdate = explode("/", strGregToHeb($birthday, false, $bornAtNight));
    $info_fields = array(array('field' => 'My Hebrew Birthday', 'items' => array(array('label' => strGregToHeb($birthday, true, $bBornAfterSunset), 'description' => 'A kabbalisticly powerful day.', 'link' => 'http://apps.facebook.com/jewishdates/'))), array('field' => 'Next Occurence', 'items' => array(array('label' => dateThisYear($ahebdate), 'description' => 'The next gregorian date that will corespond with my Hebrew Birthday', 'link' => 'http://apps.facebook.com/jewishdates/'))));
    $moreFBML = '<b><u>Special Dates</u></b><br />';
    $specialDays = DateRecord::findByWhere('DateRecord', "uid={$facebook->user}");
    foreach ($specialDays as $friend) {
        $moreFBML .= '<div><b>' . $friend->data['title'] . ':</b>' . $friend->getHebrewDate('longeng') . ' - ' . $friend->getNextOccurance() . '</div>';
        $info_fields[] = array('field' => $friend->data['title'], 'items' => array(array('label' => $friend->getHebrewDate('longeng'), 'description' => 'Hebrew Date', 'link' => 'http://apps.facebook.com/jewishdates/'), array('label' => 'Next Occurance: ' . $friend->getNextOccurance(), 'description' => 'Gregorian Date this coming year', 'link' => 'http://apps.facebook.com/jewishdates/')));
    }
    $facebook->api_client->profile_setFBML($fbml . $moreFBML, $facebook->profileID, $fbml . $moreFBML, NULL, $mobileFBML, $mainFBML);
    $facebook->api_client->profile_setInfo('Jewish Dates', 1, $info_fields, $user);
    $refValue = "Todays Hebrew Date is:<br />" . strGregToHeb(date("M d, Y"), true);
    $facebook->api_client->fbml_setRefHandle("Today_H", $refValue);
    $facebook->api_client->fbml_setRefHandle("Message", "<fb:subtitle><a href='http://apps.facebook.com/jewishdates/'>Add this to my profile.</a></fb:subtitle>");
    //<div style='text-align:center;color:red;'>Help 'Jewish Dates'.<br />Support <a href='http://apps.facebook.com/jewishdates/supportChabadOfNewPaltz'>Chabad of New Paltz</a><hr /></div>
    $facebook->api_client->fbml_setRefHandle("Explanation", "<a href='http://www.chabad.org/library/article.asp?AID=144345'>What is a Jewish Birthday?</a>");
}