<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />

<meta property="og:image" content="https://w2.chabad.org/media/images/1154/XltL11545882.png" itemprop="image" width="150" height="150" />
<meta property="og:image:width" content="150" />
<meta property="og:image:height" content="150" />
<meta name="keywords" content="Glossary,of,Terms" />
<meta name="title" content="Glossary of Terms - Chabad of Ellicott City" />
<meta property="og:type" content="website" />
<meta name="scope-aids" content="5054068-5054076-5077466-5094679-5094707-5094712" />
<meta name="article-keywords" content="19478-19479-19958-20962-8495-8972-18927-19353-19480-2170-2898-2471-537-6939-31567-32228-63" />
<meta name="scope-aid" content="5054068" />
<meta name="scope-aid" content="5054076" />
<meta name="scope-aid" content="5077466" />
<meta name="scope-aid" content="5094679" />
<meta name="scope-aid" content="5094707" />
<meta name="scope-aid" content="5094712" />
<meta name="article-keyword" content="19478" />
<meta name="article-keyword" content="19479" />
<meta name="article-keyword" content="19958" />
<meta name="article-keyword" content="20962" />
<meta name="article-keyword" content="8495" />
<meta name="article-keyword" content="8972" />
<meta name="article-keyword" content="18927" />
<meta name="article-keyword" content="19353" />
<meta name="article-keyword" content="19480" />
<meta name="article-keyword" content="2170" />
<meta name="article-keyword" content="2898" />
<meta name="article-keyword" content="2471" />
<meta name="article-keyword" content="537" />
<meta name="article-keyword" content="6939" />
<meta name="article-keyword" content="31567" />
<meta name="article-keyword" content="32228" />
<meta name="article-keyword" content="63" />
<meta property="og:url" content="https://www.chabadellicottcity.com/" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:site" content="@chabad" />
<meta property="og:title" content="Glossary of Terms - Chabad of Ellicott City" /><link rel="canonical" href="https://www.chabadellicottcity.com/" />
<link rel="icon" type="image/png" href="https://www.chabadellicottcity.com/media/images/1154/XltL11545882.png" />
<link rel="Stylesheet" href="/css/fonts/font-awesome/font-awesome-5.css?v=2D6ABDDB" id="kfont-awesome" type="text/css"/>
<link rel="Stylesheet" href="/css/DefaultGrid.css?v=A13D74E8" id="kgrid" type="text/css"/>
<link rel="Stylesheet" href="/css/Elements.css?v=3A4C63F41" id="k6" type="text/css"/>
<link rel="Stylesheet" href="/css/vendor/ds/tokens/sites.css?v=A934B108" id="ksites-ds-css" type="text/css"/>
<link rel="Stylesheet" href="/css/new/main.css?v=BB63DD50" id="k7" type="text/css"/>
<link rel="Stylesheet" href="/css/old/global.css?v=43DDBA77" id="k2898" type="text/css"/>
<link rel="Stylesheet" href="/css/cco/minisites/themes/plannedgiving/styles.css?v=6BD6A965" id="k19353" type="text/css"/>
<link rel="Stylesheet" href="https://w2.chabad.org/css/cco/minisites/global.css" id="k20962" type="text/css"/>
<link rel="Stylesheet" href="/css/bootstrap/grid.css?v=F4390F2B" id="kbootstrap4-grid" type="text/css"/>
<link rel="Stylesheet" href="/css/Library/reader-comments.css?v=8AB57D79" id="kCommentsStylesheet" type="text/css"/>
<link rel="Stylesheet" href="/css/inline/BookInfo.css?v=3D052243" id="kBookInfoCss" type="text/css"/>

<script>$q=[];$j=function(f){$q.push(f);}</script>
	
 
	
	<style type="text/css">
		body{margin:0;}
	</style>
	
	



<script>
	window.dataLayer = window.dataLayer || [];
	dataLayer.push({"event":"datalayer-initialized","page":{"numberOfComments":0,"publicationDate":"2021-04-08","primaryArticleId":2569766,"title":"","author":"","authorId":0,"contentLevel1":"My Site","contentLevel2":"Ways To Give","contentLevel3":"Planned Giving","contentLevel4":"Resources","contentLevel5":"Glossary of Terms","siteName":"Chabad of Ellicott City"},"time":{"upcomingHoliday":"Rosh Hashanah","daysToUpcomingHoliday":20,"hebrewDate":"5786-06-10"}});
		dataLayer.push({ 'articleHierarchy': '-5054068-5054076-5077466-5094679-5094707-5094712-', 'keywords': '-k63-k32228-k31567-k6939-k537-k2471-k2898-k2170-k19480-k19353-k18927-k8972-k8495-k20962-k19958-k19479-k19478-', 'k': '-5054068-5054076-5077466-5094679-5094707-5094712--k63-k32228-k31567-k6939-k537-k2471-k2898-k2170-k19480-k19353-k18927-k8972-k8495-k20962-k19958-k19479-k19478-' });
	
</script>
<script>

(function(c,h,a,b,a,d){c[a]=c[a]||[];c[a].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=h.getElementsByTagName(b)[0],
j=h.createElement(b);j.async=true;
j.src='https://w6.chabad.org/mitzvah-tank.js';f.parentNode.insertBefore(j,f);
})(window,document,0,'script','dataLayer');</script>

	<!-- Start of StatCounter Code -->
	<script type="text/javascript">
	var sc_project = 12485608;var sc_partition = 96;var sc_invisible = 1;var sc_remove_link=1;var sc_security = "0844ee4e";var sc_https = 1;
	</script>
	<script type="text/javascript" src="https://secure.statcounter.com/counter/counter_xhtml.js" defer async></script>
	<noscript><img src="//c97.statcounter.com/counter.php?sc_project=12485608&amp;java=0&amp;security=0844ee4e&amp;invisible=1" border="0" /> </noscript>
	<!-- End of StatCounter Code -->


<script>
document.addEventListener('DOMContentLoaded', () => {
  const dropdown = document.getElementById('ReserversTitle');
  if (dropdown) {
    // Add standard options dynamically
    const titles = ['Imam', 'Pastor', 'Priest', 'Other'];
    titles.forEach(title => {
      const option = document.createElement('option');
      option.value = title;
      option.textContent = title;
      dropdown.appendChild(option);
    });

    // Create elements for custom prefix input and "Add" button
    const manualPrefixContainer = document.createElement('div');
    manualPrefixContainer.id = 'manualPrefixContainer';
    manualPrefixContainer.style.marginTop = '10px';
    manualPrefixContainer.style.alignItems = 'center';
    manualPrefixContainer.style.gap = '10px';
    manualPrefixContainer.style.display = 'flex';

    const manualPrefixInput = document.createElement('input');
    manualPrefixInput.type = 'text';
    manualPrefixInput.id = 'manualPrefix';
    manualPrefixInput.placeholder = 'Enter custom prefix';

    const addButton = document.createElement('div');
    addButton.id = 'addButton';
    addButton.textContent = 'Add';
    addButton.style.padding = '8px 15px';
    addButton.style.backgroundColor = '#007bff';
    addButton.style.color = '#fff';
    addButton.style.borderRadius = '5px';
    addButton.style.cursor = 'pointer';
    addButton.style.textAlign = 'center';
    addButton.style.display = 'inline-block';
    addButton.style.userSelect = 'none';

    // Add hover effect
    addButton.addEventListener('mouseover', () => {
      addButton.style.backgroundColor = '#0056b3';
    });
    addButton.addEventListener('mouseout', () => {
      addButton.style.backgroundColor = '#007bff';
    });

    // Append input and button to container
    manualPrefixContainer.appendChild(manualPrefixInput);
    manualPrefixContainer.appendChild(addButton);

    // Event listener for dropdown selection
    dropdown.addEventListener('change', () => {
      if (dropdown.value === 'Other') {
        dropdown.parentNode.insertBefore(manualPrefixContainer, dropdown.nextSibling);
        manualPrefixInput.focus();
      } else {
        if (manualPrefixContainer.parentNode) {
          manualPrefixContainer.parentNode.removeChild(manualPrefixContainer);
        }
      }
    });

    // Event listener for the "Add" action
    addButton.addEventListener('click', () => {
      const customValue = manualPrefixInput.value.trim();
      if (customValue) {
        const customOption = document.createElement('option');
        customOption.value = customValue;
        customOption.textContent = customValue;
        dropdown.appendChild(customOption);
        dropdown.value = customValue;
        manualPrefixContainer.style.display = 'none';
        manualPrefixInput.value = '';
      } else {
        alert('Please enter a custom prefix before adding.');
      }
    });
  } else {
    console.error('Dropdown with ID #ReserversTitle not found.');
  }
});
</script><title>
	Glossary of Terms - Chabad of Ellicott City
</title></head>
<body class="lang_en dir_ltr cco_body cco_templateless_page section_branch">
	
	
		<div width="100%" class="cco_templateless_template" style="z-index:100 !important;display:block !important;left:0px !important;top:0px !important;height:30px!important;width:100% !important;line-height:30px !important; position:relative !important; margin-bottom:0 !important; padding:0;text-indent: 25px;" align="Left"><a href="//www.chabadellicottcity.com" style="display:block!important;font-size:14px !important;">&laquo; Back to&nbsp;Chabad of Ellicott City</a></div>
	
	<div class="cco_templatelates_content">
		
	<div class="co_content_container clearfix local_content" id="co_content_container">
		<div class="clearfix">
			<!-- BEGIN HEADER --><style type="text/css">
	.cco_templateless_template,
	.cco_templateless_template a {
		background: #6C0647;
	}
.sidebar-ads co\:item {
    padding: 3%;
    text-align: center;
    background: #690645;
    display: block;
    margin-bottom: 3%
}

.section_root .sidebar-ads co\:item {
    float: left;
    width: 315px;
    padding: 12px 0;
    text-align: center;
    background: #690645;
    display: block;
    margin-left: 15px
}

body.mobile.section_root .sidebar-ads co\:item {
    float: none;
    display: block;
    width: 100%;
    margin: 5px 0
}

.section_root .sidebar-ads co\:item:first-child {
    margin: 0
}

.sidebar-ads co\:item a {
    text-decoration: none;
    position: absolute;
    width: 283px;
    height: 167px
}

.sidebar-ads co\:item img {
    width: 90%
}

.sidebar-ads co\:item .caption {
    font: 12px/18px Merriweather, times, serif;
    color: #a7a6a2;
    margin-top: 15px
}
co\:item {display:unset!important}
</style>
<div id="chabad_body_page">
<div id="chabad_main_content" class="container">


<div id="chabad_head" class="header">



<div class="chabad_header header-logo" data-href="/5094679">
<a href="/5094679" class="header-title" title="Planned Giving">
<span>
Planned Giving to Chabad</span></a>
<div class="header-subtitle">
<a href="/5094679" class="header-subtitle" style="text-decoration:none">
Make Your Legacy a Jewish Future</a></div>
</div>


<div id="navigation" class="chabad_navigator_bar">
<div class="chabad_menu_content">
<ul id="menu" class="navi">
<li class="item parent arrow">
<a href="/article.asp?aid=5094680" class="parent arrow">Why Giving Matters</a>
<div class="sub_menu">
<ul>
<li class="item first">
<a href="/article.asp?aid=5094681">Changing Jewish Destiny</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094682">Chabad In The News</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094683">The Rebbe's Mandate</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094684">Giving In Jewish Tradition</a>
</li>
<li class="item last">
<a href="/article.asp?aid=5094685">Donor Stories</a>
</li>
</ul>
</div>
|
</li>
<li class="item parent arrow">
<a href="/article.asp?aid=5094693" class="parent arrow">Ways To Give</a>
<div class="sub_menu">
<ul>
<li class="item first">
<a href="/article.asp?aid=5094694">Bequest</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094695">Charitable Gift Annuity</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094697">Real Estate</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094698">Life Insurance</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094699">Charitable Trusts</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094700">Retirement Plans</a>
</li>
<li class="item last">
<a href="/article.asp?aid=5094701">Planned Giving Videos</a>
</li>
</ul>
</div>
|
</li>
<li class="item parent arrow">
<a href="/article.asp?aid=5094703" class="parent arrow">Gratitude</a>
<div class="sub_menu">
<ul>
<li class="item first">
<a href="/article.asp?aid=5094704">Jewish Legacy Society</a>
</li>
<li class="item last">
<a href="/article.asp?aid=5094705">My Story</a>
</li>
</ul>
</div>
|
</li>
<li class="item parent arrow selected">
<a href="/article.asp?aid=5094707" class="parent arrow selected">Resources</a>
<div class="sub_menu">
<ul>
<li class="item first">
<a href="/article.asp?aid=5094708">Bequest Form</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094709">Frequently Asked Questions</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094710">Advisor Information</a>
</li>
<li class="item">
<a href="/article.asp?aid=5094711">Planned Giving Council</a>
</li>
<li class="item last selected">
<a href="/article.asp?aid=5094712">Glossary of Terms</a>
</li>
</ul>
</div>
|
</li>
<li class="item parent arrow">
<a href="/article.asp?aid=5094713" class="parent arrow">Contact</a>
<div class="sub_menu">
<ul>
<li class="item first">
<a href="/article.asp?aid=5094714">Contact Us</a>
</li>
<li class="item last">
<a href="/article.asp?aid=5094715">Share Your Story</a>
</li>
</ul>
</div>
</li>

</ul>
</div>
</div>



</div>
<div class="break_floats" ></div>
<div id="chabad_body_content">
<div detached="true" type="static" id="ContentArea" name="content_area" class="chabad_left_column"><div id="content_page" class="content_page"><!-- END HEADER -->
			
			
			<div class="clearfix bh mobile-only align_right">ב"ה</div>
			
				<div class="master-content-wrapper " >
					

<header class="article-header cf ">
	
	
			<h1 class="article-header__title js-article-title js-page-title">Glossary of Terms</h1>
		
			<div>
				
			</div>
		
</header>
				</div>
			
			<div class="body_wrapper clearfix co_body">
				<div class="" id="co_body_container">
					
					<div id="ContentBody">
						
						
							<div class="content-area-parent no_margin">
								
	<div id="cco_body">
		<div class="content  no_margin no_overflow" id="co_content_container">
			
			
	

	<article class="content js-content" itemscope itemtype="http://schema.org/Article">
	



<meta itemprop="mainEntityOfPage headline name" content="" />

<meta itemprop="image" content="" />


<meta itemprop="uploadDate" content="2021-04-08T12:00:49" />
<span itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
	<meta itemprop="name" content="Chabad of Ellicott City" />
	<meta itemprop="brand" content="Chabad of Ellicott City" />
	<span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
		<meta itemprop="url" content="https://w2.chabad.org/media/images/1154/XltL11545882.png" />
		<meta itemprop="height" content="150" />
		<meta itemprop="width" content="150" />
	</span>
</span>
<meta itemprop="datePublished" content="2021-04-08T12:00:49" />
			<div itemprop="articleBody">
				<co:body xmlns:co="www1.chabadonline.com/alpha1" xmlns:ext="urn:xslt-extensions">
  <div class="co_body article-body cf">
    <dl>
      <dt>Annuity</dt>
<dd>A fixed sum payable at specified intervals.</dd>
<dt>Appreciated Property</dt>
<dd>A property that has increased in value.</dd>
<dt>Beneficiary</dt>
<dd>The person who receives the benefits of a trust, or the recipient of the proceeds of a life insurance policy.</dd>
<dt>Bequest</dt>
<dd>In wills and estates, the gift part of the estate to a beneficiary.</dd>
<dt>Charitable Gift Annuity</dt>
<dd>Transfers cash or property to a charity in exchange for a partial tax deduction and a lifetime stream of annual income from the charity.</dd>
<dt>Charitable Trust</dt>
<dd>An irrevocable trust established for charitable purposes.</dd>
<dt>Estate Tax</dt>
<dd>A tax imposed on a decedent's property, assessed on the gross estate prior to distribution to the heirs.</dd>
<dt>Executor (or Personal Representative)</dt>
<dd>A person named in a decedent's will to carry out the provisions of that will.</dd>
<dt>Guardian</dt>
<dd>A person entrusted by law with the care of person, property, or both.</dd>
<dt>Life Insurance Trust</dt>
<dd>A trust that has an individual's life insurance policy as its principal asset. It's usually set up for the purpose of life excluding the proceeds of life insurance from the insured's estate.</dd>
<dt>Power of Attorney</dt>
<dd>A written document given by one person or party to another, authorizing the latter to act for the former.</dd>
<dt>Retained Life Estate</dt>
<dd>A person can transfer the title to his or her property to someone else and reserve a life estate. That means they no longer own the property but have the right to use and occupy the property for the duration of their natural life. When they die, the life estate is extinguished and the property is owned free and clear by the title owners. The need for probate has thus been avoided.</dd>
<dt>Testamentary Trust</dt>
<dd>A trust created by a will, which is scheduled to occur after the maker's death.</dd>
<dt>Trust</dt>
<dd>A fiduciary relationship calling for a trustee to hold the title to assets for the benefit of the beneficiary. The person creating the trust, who may or may not also be the beneficiary, is called the grantor.</dd>
<dt>Trustee</dt>
<dd>Any individual or company who manages assets on behalf of another.</dd>
<dt>Will</dt>
<dd>A document stating how and to whom a person wants his/her property transferred after death.</dd>
    </dl>
  </div>
</co:body>
			</div>
			

			<div class="break_floats"></div>
			
	<div class="break_floats"></div>
	

<div class="content-footer">
	
	
	
	
		<div class="section-articles below-article clearfix" id="MoreInSection" data-list-name="more in this section">
			<h2 class="below-article__title">More in this section</h2>
			<div class="bs-container">
				<div class="bs-row">
					
		<div class="section-articles__column col-md-6 ">
			<ul class="small-links small-links--orange">
				
		<li class="small-links__item ">
			
			<a class="link_item" href="/templates/articlecco_cdo/aid/5094708/jewish/Bequest-Form.htm" data-aid="5094708">Bequest Form</a>
		</li>
		
	
		<li class="small-links__item ">
			
			<a class="link_item" href="/templates/articlecco_cdo/aid/5094709/jewish/Frequently-Asked-Questions.htm" data-aid="5094709">Frequently Asked Questions</a>
		</li>
		
	
			</ul>
		</div>
	
		<div class="section-articles__column col-md-6 ">
			<ul class="small-links small-links--orange">
				
		<li class="small-links__item ">
			
			<a class="link_item" href="/templates/articlecco_cdo/aid/5094710/jewish/Advisor-Information.htm" data-aid="5094710">Advisor Information</a>
		</li>
		
	
		<li class="small-links__item ">
			
			<a class="link_item" href="/templates/articlecco_cdo/aid/5094711/jewish/Planned-Giving-Council.htm" data-aid="5094711">Planned Giving Council</a>
		</li>
		
	
			</ul>
		</div>
	
				</div>
			</div> 
		</div>
	
		

	
	
</div>
	</article>

		</div>
	</div>
</div>
						
						<div class="break_floats"></div>
						
					</div>
				</div>
				
				
				
			</div>
			
			<!-- BEGIN FOOTER --></div></div><div class="co_section">
<div class="co_section_head">
<div>In this Section</div>
</div>
<div class="co_section_body">
<div class="co_section_gradient">
<div class="co_section_text">
<div class="item first">
<span>●</span>
<a href="/article.asp?aid=5094708">Bequest Form</a>
</div>
<div class="item">
<span>●</span>
<a href="/article.asp?aid=5094709">Frequently Asked Questions</a>
</div>
<div class="item">
<span>●</span>
<a href="/article.asp?aid=5094710">Advisor Information</a>
</div>
<div class="item">
<span>●</span>
<a href="/article.asp?aid=5094711">Planned Giving Council</a>
</div>
<div class="item last">
<span>●</span>
<a href="/article.asp?aid=5094712">Glossary of Terms</a>
</div>
</div>
</div>
</div>
<div class="co_section_footer" ></div>
</div>
<div class="chabad_right_column">
<div class="caption" id="contact-address">

<p>Rabbi Yanky Baron<br/>                 Chabad of Ellicott City<br/>                 9785 Statae Route 99,<br/>                 Ellicott City, MD, 21042<br/>                 443-676-3837<br/>
<a href="mailto:rabbi@chabadellicottcity.com">                 rabbi@chabadellicottcity.com</a></p>
<p></p>
</div>
<ul class="sidebar-ads">


<li>

<a href="/5094681" ></a>

<img src="https://w2.chabad.org/images/Shluchim/minisites/themes/plannedgiving/sidebar-thumbs-jewish-destiny.png" alt="Changing Jewish Destiny" border="0" />
<div class="caption">
Changing Jewish Destiny</div>

</li>



<li>

<a href="/5094705" ></a>

<img src="https://w2.chabad.org/images/Shluchim/minisites/themes/plannedgiving/sidebar-thumbs-testimony.png" border="0" />
<div class="caption">
My Story</div>
</li>



<li>

<a href="/5094701" ></a>

<img src="https://w2.chabad.org/images/Shluchim/minisites/themes/plannedgiving/sidebar-thumbs-planned-giving.png" border="0" />
<div class="caption">
Planned Giving Videos</div>

</li>


</ul>

</div></div>
</div>
<div id="border_bottom" ></div>
</div>
<!-- END FOOTER -->
		</div>
		
		<aside class="page-tools-sidebar js-page-tools-sidebar hide_for_print">
<div class="page-tools js-page-tools-menu">
<div class="page-tools__section page-tools__section--share">
<a class="page-tools__tool js-share-popup page-tools__tool--facebook" data-share-url="https://www.facebook.com/dialog/share?app_id=188669250943&amp;display=popup&amp;href=https%3a%2f%2fwww.chabadellicottcity.com%2ftemplates%2farticlecco_cdo%2faid%2f5094712%2fjewish%2fGlossary-of-Terms.htm%23utm_medium%3dpage_tools%26utm_content%3ddesktop%26utm_source%3dFB">
				<i class="fa fa-facebook"></i>
			</a>
<a class="page-tools__tool js-share-popup page-tools__tool--twitter" data-share-url="https://twitter.com/intent/tweet?text=Glossary+of+Terms+-+Chabad+of+Ellicott+City&amp;url=https%3a%2f%2fwww.chabadellicottcity.com%2ftemplates%2farticlecco_cdo%2faid%2f5094712%2fjewish%2fGlossary-of-Terms.htm%23utm_medium%3dpage_tools%26utm_content%3ddesktop%26utm_source%3dtwitter&amp;via=Chabad">
				<i class="fa fa-twitter"></i>
			</a>
<a class="page-tools__tool js-share-popup page-tools__tool--whatsapp d-lg-none js-share-whatsapp" data-share-url="whatsapp://send?text=Glossary+of+Terms+-+Chabad+of+Ellicott+City https%3a%2f%2fwww.chabadellicottcity.com%2ftemplates%2farticlecco_cdo%2faid%2f5094712%2fjewish%2fGlossary-of-Terms.htm%23utm_medium%3dpage_tools%26utm_content%3ddesktop%26utm_source%3dwhatsapp">
				<i class="fa fa-whatsapp">
					<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" fill="#128c7e" width="1em" height="1em"><path d="M25 2C12.318 2 2 12.318 2 25c0 3.96 1.023 7.854 2.963 11.29L2.037 46.73c-.096.343-.003.711.245.966.191.197.451.304.718.304.08 0 .161-.01.24-.029l10.896-2.699C17.463 47.058 21.21 48 25 48c12.682 0 23-10.318 23-23S37.682 2 25 2zm11.57 31.116c-.492 1.362-2.852 2.605-3.986 2.772-1.018.149-2.306.213-3.72-.231-.857-.27-1.957-.628-3.366-1.229-5.923-2.526-9.791-8.415-10.087-8.804-.295-.389-2.411-3.161-2.411-6.03s1.525-4.28 2.067-4.864c.542-.584 1.181-.73 1.575-.73s.787.005 1.132.021c.363.018.85-.137 1.329 1.001.492 1.168 1.673 4.037 1.819 4.33.148.292.246.633.05 1.022s-.294.632-.59.973-.62.76-.886 1.022c-.296.291-.603.606-.259 1.19s1.529 2.493 3.285 4.039c2.255 1.986 4.158 2.602 4.748 2.894.59.292.935.243 1.279-.146.344-.39 1.476-1.703 1.869-2.286s.787-.487 1.329-.292c.542.194 3.445 1.604 4.035 1.896.59.292.984.438 1.132.681.148.242.148 1.41-.344 2.771z"/></svg>
				</i>
			</a>
<a class="page-tools__tool js-share-popup page-tools__tool--pinterest d-none d-lg-block" data-share-url="http://pinterest.com/pin/create/button/?url=https%3a%2f%2fwww.chabadellicottcity.com%2ftemplates%2farticlecco_cdo%2faid%2f5094712%2fjewish%2fGlossary-of-Terms.htm%23utm_medium%3dpage_tools%26utm_content%3ddesktop%26utm_source%3dpinterest&amp;description=Glossary+of+Terms+-+Chabad+of+Ellicott+City">
				<i class="fa fa-pinterest"></i>
			</a>
<a class="page-tools__tool" onclick="showEmailLayer(this);">
<i class="fa fa-envelope"></i>
</a>
</div>
<div class="page-tools__section page-tools__section--other js-page-tool-other">
<div class="page-tools__tool popover-parent d-lg-block">
<div class="popover popover--right align_left nowrap">
<div class="popover__content">
<label class="bold bottom_margin block">
Print Options:
</label>
<form class="vcenter" name="print-form" onsubmit="coPrint(event, 5094707);return false;">
<div>
<label><input type="checkbox" name="print-green"><span title="Save paper and ink">Print without images <i class="fa fa-leaf text-green"></i></span></label>
</div>
<br/>
<div class="center">
<button class="co-button page-tools__print-button">Print</button>
</div>
</form>
</div>
</div>
<i class="fa fa-print"></i>
</div>
</div>
</div>
<div class="js-fab-wrapper fab-wrapper">
<div class="fab">
<i class="fab-icon"></i>
</div>
</div>
</aside>
<!-- END CACHE -->
	</div>

	</div>

	<div id="BodyContainer">
		<div class="g960 footer">
			<div class="poweredby large_bottom_margin">
				



	<div class="footer3">
		<span class="footer-title" >Chabad of Ellicott City</span>
		<div class="footer-address">
			<span class="footer-street">9785 Route 99 </span>
			<span class="footer-city-state">Ellicott City, MD 21042</span>
		</div>
			<span>443-676-3837</span>
	</div>
	<img src="https://w2.chabad.org/images/global/spacer.gif" width="1" height="6" border="0" /><br />



Powered by <a href="https://www.chabad.org/" target="_new" class="">Chabad.org</a> &copy; 1993-2026 <a href="/4026210" target="_blank" class="privacy-link">Privacy Policy</a>




			</div>
		</div>
	</div>
	
	

	
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/os/jquery-1.8.3.min.js?v=14C45307"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/os/jquery/jquery.tools.expose.min.js?v=AB0A58F7"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/os/jquery.tools.1.2.7.min.js?v=FBC14E36"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/co/dist/CoLib.js?v=98C851E4"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/WebComponents/bundles/magen-cdo-global.js?v=41844740"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/templates/plannedgiving/custom.js?v=8742C543"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/modules/pagetools.js?v=930B07AB"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/custom/multimedia/infolayer.js?v=ED1B8531"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/article/comments/reply-form-controller.js?v=DC70C970"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/custom/commentsloader.js?v=AD6AAB79"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/custom/minisites.js?v=F38E4DA5"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/custom/subscribeprompt.js?v=86D84DC2"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/custom/deprecated.js?v=D506A83E"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/OverrideJSDocumentWrite.js?v=9A0227AA"></script><script>$j = $j.fn ? $j : jQuery;$j(()=>{$q.forEach(f=>{try{f.call(window);}catch(ex){console.error(ex);}});})</script>
	

<script  language="javascript" type="text/javascript"> Co.Settings      = {CacheClassName:'js-cache-default',MosadName:'Chabad of Ellicott City'}; Co.ArticleId     = '5094712';Co.SectionId     = 5077466;Co.PartnerSiteId = 0;Co.SiteId        = 11215;Co.IsMobilePage  = false;Co.IsResponsive  = false;Co.DbDomain      = 'chabadellicottcity.com';Co.LanguageCode  = '';Co.LoginStatus   = 'None';</script>
	
	
<script>
//<![CDATA[
    /* <-----------Upcoming Events Carousel (Google Sheets) — with Segmented Events ---------> */
    if (window.location.pathname === '/' || window.location.pathname === '/default.aspx' || window.location.pathname === '') {

        (async function() {

            // Global Error listener to catch broken images safely without triggering Cloudflare WAF via inline onerror attributes
            document.addEventListener('error', function(e) {
                if (e.target && e.target.tagName && e.target.tagName.toLowerCase() === 'img') {
                    if (!e.target.dataset.fallbackApplied) {
                        e.target.dataset.fallbackApplied = 'true';
                        e.target.src = 'https://placehold.co/400x300/eee/ccc?text=Image+Not+Found';
                    }
                }
            }, true);

            // =========================================================
            // CONFIGURATION
            // =========================================================
            const SHEET_ID = '1EPGntfwESm5hdd-RPpR7kmNARdvi9dpDT3YrJnO0ens';
            const TARGET_LOCATIONS = [ 'Chabad of Ellicott City', 'All Chabads of Howard County' ];
            const MAX_EVENTS = 10;   // counts a whole segment as ONE item
            // Segment columns (0-based). AA = 26, AB = 27
            const COL_SEGMENT_ID = 26;
            const COL_SEGMENT_TITLE = 27;
            // =========================================================

            // Using \u0026 to guarantee XML/WAF parsers don't break on the ampersand
            const EVENTS_URL = `https://docs.google.com/spreadsheets/d/${SHEET_ID}/gviz/tq?tqx=out:json\u0026sheet=Events`;
            const SETTINGS_URL = `https://docs.google.com/spreadsheets/d/${SHEET_ID}/gviz/tq?tqx=out:json\u0026sheet=Settings`;

            let categoryColors = {};
            let locationLogos = {};
            let demoColors = {};
            let capacityColors = {};
            const dayOfWeekMap = { 'sunday':0, 'monday':1, 'tuesday':2, 'wednesday':3, 'thursday':4, 'friday':5, 'saturday':6 };

            function parseGoogleJson(text) {
                return JSON.parse(text.substring(text.indexOf('{'), text.lastIndexOf('}') + 1));
            }

            // ---------------- Shared date / calendar helpers ----------------
            function parseTimeToParts(timeStr) {
                let hours = 0, mins = 0, ok = false;
                if (timeStr) {
                    const match = String(timeStr).match(/(\d+):(\d+)\s*(AM|PM)/i);
                    if (match) {
                        hours = parseInt(match[1], 10); mins = parseInt(match[2], 10);
                        if (match[3].toUpperCase() === 'PM' && hours < 12) hours += 12;
                        if (match[3].toUpperCase() === 'AM' && hours === 12) hours = 0;
                        ok = true;
                    }
                }
                return { hours, mins, ok };
            }

            function getStartEnd(dateObj, timeStr) {
                const p = parseTimeToParts(timeStr);
                const start = new Date(dateObj);
                start.setHours(p.hours, p.mins, 0, 0);
                const end = new Date(start.getTime() + 60 * 60 * 1000);
                return { start, end };
            }

            const formatICSDate = (d) => {
                return d.getUTCFullYear() + String(d.getUTCMonth() + 1).padStart(2, '0') + String(d.getUTCDate()).padStart(2, '0') + 'T' + String(d.getUTCHours()).padStart(2, '0') + String(d.getUTCMinutes()).padStart(2, '0') + String(d.getUTCSeconds()).padStart(2, '0') + 'Z';
            };

            function stripHtml(html) {
                const tempDiv = document.createElement('div');
                tempDiv.innerHTML = html || '';
                return tempDiv.textContent || tempDiv.innerText || '';
            }

            function icsEscape(str) {
                return String(str || '').replace(/\\/g, '\\\\').replace(/;/g, '\\;').replace(/,/g, '\\,').replace(/\r?\n/g, '\\n');
            }

            function buildGCalUrl(title, desc, loc, dateObj, timeStr) {
                const se = getStartEnd(dateObj, timeStr);
                return `https://calendar.google.com/calendar/render?action=TEMPLATE\u0026text=${encodeURIComponent(title)}\u0026dates=${formatICSDate(se.start)}/${formatICSDate(se.end)}\u0026details=${encodeURIComponent(stripHtml(desc))}\u0026location=${encodeURIComponent(loc || '')}`;
            }

            // Builds a single .ics containing one VEVENT per session
            function buildIcsUrl(sessions, segmentTitle) {
                let out = 'BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Chabad Events//Segments//EN\r\nCALSCALE:GREGORIAN\r\n';
                const stamp = formatICSDate(new Date());
                sessions.forEach(function(s, i) {
                    const se = getStartEnd(s.dateObj, s.time);
                    let summary = s.title;
                    if (segmentTitle && segmentTitle !== s.title) summary = segmentTitle + ': ' + s.title;
                    out += 'BEGIN:VEVENT\r\n';
                    out += 'UID:' + formatICSDate(se.start) + '-' + i + '@chabadevents\r\n';
                    out += 'DTSTAMP:' + stamp + '\r\n';
                    out += 'DTSTART:' + formatICSDate(se.start) + '\r\n';
                    out += 'DTEND:' + formatICSDate(se.end) + '\r\n';
                    out += 'SUMMARY:' + icsEscape(summary) + '\r\n';
                    out += 'DESCRIPTION:' + icsEscape(stripHtml(s.description)) + '\r\n';
                    out += 'LOCATION:' + icsEscape(s.location) + '\r\n';
                    out += 'END:VEVENT\r\n';
                });
                out += 'END:VCALENDAR';
                const blob = new Blob([out], { type: 'text/calendar;charset=utf-8' });
                return URL.createObjectURL(blob);
            }

            const fmtFull = (d) => d.toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' }).toUpperCase();
            const fmtShort = (d) => d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }).toUpperCase();
            const fmtSession = (d) => d.toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' }).toUpperCase();

            function cleanTime(t) {
                let timeText = t ? String(t).trim().toUpperCase() : '';
                if (timeText) timeText = timeText.replace(/(\d)([AP]M)$/, '$1 $2');
                return timeText;
            }

            // ---------------- Segment grouping ----------------
            // Turns a flat list of sessions into a list of CARDS.
            // A card is either a single event, or a segment holding many sessions.
            function groupIntoCards(events) {
                const cards = [];
                const buckets = {};

                events.forEach(function(ev) {
                    if (!ev.segmentId) {
                        cards.push({ isSegment: false, sessions: [ev], lead: ev, dateObj: ev.dateObj, lastDate: ev.dateObj });
                        return;
                    }
                    const key = ev.segmentId.toLowerCase();
                    if (!buckets[key]) {
                        buckets[key] = { isSegment: true, sessions: [], lead: null, segmentTitle: '', dateObj: ev.dateObj, lastDate: ev.dateObj };
                        cards.push(buckets[key]);
                    }
                    const b = buckets[key];
                    b.sessions.push(ev);
                    if (ev.dateObj < b.dateObj) b.dateObj = ev.dateObj;
                    if (ev.dateObj > b.lastDate) b.lastDate = ev.dateObj;
                    if (!b.lead && ev.segmentTitle) b.lead = ev;               // explicit lead row
                    if (!b.segmentTitle && ev.segmentTitle) b.segmentTitle = ev.segmentTitle;
                });

                cards.forEach(function(c) {
                    c.sessions.sort(function(a, b) {
                        if (a.dateObj - b.dateObj !== 0) return a.dateObj - b.dateObj;
                        const pa = parseTimeToParts(a.time), pb = parseTimeToParts(b.time);
                        return (pa.hours * 60 + pa.mins) - (pb.hours * 60 + pb.mins);
                    });
                    if (!c.lead) c.lead = c.sessions[0];                        // fallback: earliest row
                    if (c.isSegment && !c.segmentTitle) c.segmentTitle = c.lead.title;
                });

                cards.sort(function(a, b) { return a.dateObj - b.dateObj; });
                return cards;
            }

            // Generate Pre-filled Email Body
            function generateEmailBody(card, dateTimeStr) {
                const ev = card.lead;
                const instName = ev.institution || 'Chabad Ellicott City';
                const displayName = card.isSegment ? card.segmentTitle : ev.title;

                let body = `Dear ${instName} Events Team,\n\n`;
                body += `I would like to sign up for the following event:\n\n`;
                body += `Event Name: ${displayName}\n`;

                if (card.isSegment && card.sessions.length > 1) {
                    body += `\nSessions I plan to attend (mark with an X):\n`;
                    card.sessions.forEach(function(s) {
                        const t = cleanTime(s.time);
                        body += `[ ] ${fmtSession(s.dateObj)}${t ? ', ' + t : ''} \u2014 ${s.title}\n`;
                    });
                    body += `\n`;
                } else {
                    body += `Event Date: ${dateTimeStr}\n\n`;
                }

                body += `Number of Attendees: [# of people]\n`;
                body += `Names of Attendees: [List names]\n\n`;
                body += `* For new attendees, please provide your contact information below. Returning members may leave this section blank if we already have your details on file. *\n`;
                body += `Home Address: [Put Home Address Here]\n`;
                body += `Phone Number: [Put Phone Number Here]\n\n`;

                if (ev.priceText) {
                    body += `Pricing Info: ${ev.priceText}\n\n`;
                    body += `Payment Commitment:\n`;
                    if (ev.donateLink) {
                        body += `[ ] I will pay in advance online (${ev.donateLink})\n`;
                    } else {
                        body += `[ ] I will pay in advance online\n`;
                    }
                    body += `[ ] I will pay at the door\n`;
                    body += `[ ] I will make an additional donation in the amount of: $______\n`;
                    body += `[ ] Please send me payment instructions\n\n`;
                    body += `Total Amount Committing to Pay: $[Amount]\n\n`;
                }

                body += `Additional Notes (optional):\n`;
                body += `[Any dietary restrictions, seating requests, etc.]\n\n`;
                body += `Please confirm my registration at your earliest convenience.\n\n`;
                body += `Thank you,\n`;
                body += `[Your Name]\n`;
                body += `[Your Email]\n`;
                body += `[Your Phone Number]`;

                return encodeURIComponent(body);
            }

            const runTransformation = async () => {
                try {
                    // Fetch Settings for Colors, Logos, and Capacity Tags
                    try {
                        const setRes = await fetch(SETTINGS_URL);
                        const setData = parseGoogleJson(await setRes.text());
                        if (setData && setData.table && setData.table.rows) {
                            setData.table.rows.forEach(row => {
                                const catName = row.c[0] ? String(row.c[0].v).trim() : null;
                                const catColor = row.c[1] ? String(row.c[1].v).trim() : null;
                                if(catName && catColor) categoryColors[catName.toLowerCase()] = catColor;

                                const locName = row.c[2] ? String(row.c[2].v).trim() : null;
                                const locLogo = row.c[3] ? String(row.c[3].v).trim() : null;
                                if(locName && locLogo) locationLogos[locName.toLowerCase()] = locLogo;

                                const demoName = row.c[4] ? String(row.c[4].v).trim() : null;
                                const demoColor = row.c[5] ? String(row.c[5].v).trim() : null;
                                if(demoName && demoColor) demoColors[demoName.toLowerCase()] = demoColor;

                                const capName = row.c[8] ? String(row.c[8].v).trim() : null;
                                const capColor = row.c[9] ? String(row.c[9].v).trim() : null;
                                if(capName && capColor) capacityColors[capName.toLowerCase()] = capColor;
                            });
                        }
                    } catch (err) { console.warn("Could not load Settings.", err); }

                    // Fetch Events
                    let processedEvents = [];
                    const today = new Date();
                    today.setHours(0,0,0,0);

                    const evRes = await fetch(EVENTS_URL);
                    const evText = await evRes.text();
                    if (evText.toLowerCase().includes('<!doctype html>')) return;

                    const evData = parseGoogleJson(evText);
                    const rows = evData.table.rows;

                    rows.forEach(row => {
                        const getVal = (idx) => (row.c && row.c.length > idx && row.c[idx] && row.c[idx].v !== null) ? String(row.c[idx].v).trim() : '';

                        const title = getVal(0);
                        if(!title) return;

                        const location = getVal(5); // Location in Col F
                        const institution = getVal(12); // Institution in Col M

                        // Only verify the Institution column M. ("ellicot" catches both "ellicott" and "ellicot")
                        // Match against any entry in TARGET_LOCATIONS (Institution, Column M)
const instLower = institution.toLowerCase();
if (!TARGET_LOCATIONS.some(t => instLower.includes(t.toLowerCase()))) return;

                        const description = getVal(1) || '';
                        const imageSrc = getVal(2) || 'https://placehold.co/600x400/eee/ccc?text=Event+Image';
                        const demographics = getVal(3);
                        const eventType = getVal(4);

                        // ROBUST DATE PARSER (Fixes Calendar Picker variations)
                        let dateObj = null;
                        let dateVal = row.c && row.c[6] ? row.c[6].v : null;
                        let fDateVal = row.c && row.c[6] ? row.c[6].f : null;

                        if (typeof dateVal === 'string' && dateVal.startsWith('Date(')) {
                            const parts = dateVal.match(/Date\((\d+),(\d+),(\d+)\)/);
                            if (parts) dateObj = new Date(parts[1], parts[2], parts[3]);
                        } else if (typeof dateVal === 'number') {
                            dateObj = new Date(Math.round((dateVal - 25569) * 86400 * 1000));
                            dateObj = new Date(dateObj.getTime() + dateObj.getTimezoneOffset() * 60000);
                        } else if (dateVal) {
                            dateObj = new Date(dateVal);
                        } else if (fDateVal) {
                            dateObj = new Date(fDateVal);
                        }

                        if (dateObj) { dateObj.setHours(0,0,0,0); }

                        // TIME PARSER
                        let time = (row.c && row.c[7] && row.c[7].f) ? row.c[7].f : String(getVal(7));
                        if (time.startsWith('Date(')) {
                            const tParts = time.match(/Date\((\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\)/);
                            if (tParts) {
                                let h = parseInt(tParts[4], 10);
                                let m = parseInt(tParts[5], 10);
                                let ampm = h >= 12 ? 'PM' : 'AM';
                                h = h % 12 || 12; m = m < 10 ? '0' + m : m;
                                time = `${h}:${m} ${ampm}`;
                            }
                        }

                        const isRecurring = String(getVal(8)).toLowerCase() === 'true' || String(getVal(8)).toLowerCase() === 'yes';
                        const dayOfWeekStr = String(getVal(9)).toLowerCase();
                        const untilDateRaw = row.c && row.c.length > 10 && row.c[10] ? row.c[10].v : null;
                        let moreInfoLink = getVal(11) || '#';

                        const contactPhone = getVal(13); // Column N
                        const contactEmail = getVal(14); // Column O
                        const smsMessage = getVal(15);   // Column P
                        const capacityUpdate = getVal(16); // Column Q
                        const donateLink = getVal(17);     // Column R
                        const priceText = getVal(18);      // Column S
                        const segmentId = getVal(COL_SEGMENT_ID);      // Column AA
                        const segmentTitle = getVal(COL_SEGMENT_TITLE); // Column AB

                        const displayTitle = title.replace('[E]', '').trim();

                        const makeSession = (targetDate) => ({
                            title: displayTitle, description, imageSrc, eventType, demographics, location, institution,
                            contactPhone, contactEmail, smsMessage, capacityUpdate, donateLink, priceText,
                            segmentId, segmentTitle, time, moreInfoLink, dateObj: new Date(targetDate)
                        });

                        if (isRecurring && dayOfWeekMap[dayOfWeekStr] !== undefined && untilDateRaw) {
                            let currentDate = new Date();
                            currentDate.setHours(0,0,0,0);

                            let untilDate = null;
                            if(typeof untilDateRaw === 'string' && untilDateRaw.startsWith('Date(')){
                                const parts = untilDateRaw.match(/Date\((\d+),(\d+),(\d+)\)/);
                                if(parts) untilDate = new Date(parts[1], parts[2], parts[3]);
                            } else { untilDate = new Date(untilDateRaw); }

                            const targetDay = dayOfWeekMap[dayOfWeekStr];

                            if (untilDate) {
                                let loopCount = 0;
                                while (currentDate <= untilDate && loopCount < 365) {
                                    if (currentDate.getDay() === targetDay && currentDate >= today) {
                                        processedEvents.push(makeSession(currentDate));
                                    }
                                    currentDate.setDate(currentDate.getDate() + 1);
                                    loopCount++;
                                }
                            }
                        }
                        else if (dateObj && dateObj >= today) {
                            processedEvents.push(makeSession(dateObj));
                        }
                    });

                    // Collapse segments, THEN take the first MAX_EVENTS cards
                    const featuredCards = groupIntoCards(processedEvents).slice(0, MAX_EVENTS);

                    if (featuredCards.length === 0) return;

                    // --- DOM Injection Logic ---
                    const eventsSection = document.createElement('div');
                    eventsSection.className = 'injected-featured-events-section';
                    eventsSection.id = 'injected-upcoming-events-section';

                    eventsSection.innerHTML = `
                      <div class="injected-featured-events-header"><h2>Upcoming Events</h2></div>
                    `;

                    const carouselContainer = document.createElement('div');
                    carouselContainer.className = 'injected-events-carousel-container';
                    const carouselWrapper = document.createElement('div');
                    carouselWrapper.className = 'injected-events-carousel-wrapper';

                    featuredCards.forEach((card) => {
                        const ev = card.lead;
                        const cardTitle = card.isSegment ? card.segmentTitle : ev.title;

                        let tagColor = 'var(--color-primary-navy)';
                        if (ev.eventType && categoryColors[ev.eventType.toLowerCase()]) tagColor = categoryColors[ev.eventType.toLowerCase()];

                        let dColor = '#888888';
                        if (ev.demographics && demoColors[ev.demographics.toLowerCase()]) dColor = demoColors[ev.demographics.toLowerCase()];

                        let capColor = '#ff6b6b';
                        if (ev.capacityUpdate && capacityColors[ev.capacityUpdate.toLowerCase()]) capColor = capacityColors[ev.capacityUpdate.toLowerCase()];

                        let logoHtml = '';
                        if (ev.institution && locationLogos[ev.institution.toLowerCase()]) {
                            logoHtml = `<img src="${locationLogos[ev.institution.toLowerCase()]}" class="uec-inst-logo" alt="Logo" />`;
                        }

                        // Date line: single date, or a range for a multi-day segment
                        let dateTimeString;
                        let dateIcon = 'far fa-clock';
                        const spansDays = card.isSegment && (card.dateObj.getTime() !== card.lastDate.getTime());
                        if (spansDays) {
                            dateTimeString = `${fmtShort(card.dateObj)} \u2013 ${fmtShort(card.lastDate)}`;
                            dateIcon = 'far fa-calendar-alt';
                        } else {
                            const dateStr = fmtFull(card.dateObj);
                            const timeText = card.isSegment ? '' : cleanTime(ev.time);
                            dateTimeString = timeText ? `${dateStr} | ${timeText}` : dateStr;
                            if (card.isSegment) dateIcon = 'far fa-calendar-alt';
                        }

                        // Schedule block for segments
                        let segmentHtml = '';
                        if (card.isSegment) {
                            const items = card.sessions.map(function(s) {
                                const t = cleanTime(s.time);
                                const g = buildGCalUrl(card.segmentTitle !== s.title ? card.segmentTitle + ': ' + s.title : s.title, s.description, s.location, s.dateObj, s.time);
                                return `
                                    <div class="uec-seg-item">
                                        <div class="uec-seg-text">
                                            <div class="uec-seg-when">${fmtSession(s.dateObj)}${t ? ' \u00b7 ' + t : ''}</div>
                                            <div class="uec-seg-what">${s.title}</div>
                                        </div>
                                        <a href="${g}" target="_blank" class="uec-seg-gcal" title="Add this to Google Calendar"><i class="fab fa-google"></i></a>
                                    </div>`;
                            }).join('');

                            segmentHtml = `
                                <div class="uec-seg-block">
                                    <button type="button" class="uec-seg-toggle">
                                        <i class="far fa-calendar-alt"></i>
                                        <span class="uec-seg-label">View full schedule (${card.sessions.length})</span>
                                        <span class="uec-seg-caret">\u25be</span>
                                    </button>
                                    <div class="uec-seg-list">${items}</div>
                                </div>`;
                        }

                        const cardEl = document.createElement('div');
                        cardEl.className = 'unified-event-card';

                        let smsHref = '';
                        if (ev.contactPhone) {
                            const cleanPhone = ev.contactPhone.replace(/[^\d+]/g, '');
                            const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
                            const separator = isIOS ? '\u0026' : '?';
                            smsHref = `sms:${cleanPhone}${ev.smsMessage ? separator + 'body=' + encodeURIComponent(ev.smsMessage) : ''}`;
                        }
                        let phoneBtn = smsHref ? `<a href="${smsHref}" class="uec-btn-icon" title="Text Us"><i class="fas fa-sms"></i></a>` : '';

                        let emailBodyEncoded = generateEmailBody(card, dateTimeString);
                        let emailBtn = ev.contactEmail ? `<a href="mailto:${ev.contactEmail}?subject=${encodeURIComponent(cardTitle)}\u0026body=${emailBodyEncoded}" class="uec-btn-icon" title="Email to Register"><i class="fas fa-envelope"></i></a>` : '';

                        // Calendar buttons: segments get one multi-event .ics; singles keep both buttons
                        const icsUrl = buildIcsUrl(card.sessions, card.isSegment ? card.segmentTitle : '');
                        let calHtml;
                        if (card.isSegment) {
                            calHtml = `
                                <a href="${icsUrl}" download="events.ics" class="uec-btn-cal" title="Adds every service in this schedule">
                                    <i class="fab fa-apple"></i> Add all ${card.sessions.length} to Apple / Outlook
                                </a>`;
                        } else {
                            const gCalUrl = buildGCalUrl(ev.title, ev.description, ev.location, ev.dateObj, ev.time);
                            calHtml = `
                                <a href="${gCalUrl}" target="_blank" class="uec-btn-cal" title="Add to Google Calendar">
                                    <i class="fab fa-google"></i> Add to Google Calendar
                                </a>
                                <a href="${icsUrl}" download="event.ics" class="uec-btn-cal" title="Add to Apple/Outlook Calendar">
                                    <i class="fab fa-apple"></i> Add to Apple / Outlook
                                </a>`;
                        }

                        cardEl.innerHTML = `
                            <div class="uec-image">
                                <a href="${ev.moreInfoLink}">
                                    <img src="${ev.imageSrc}" alt="${cardTitle}" />
                                </a>
                            </div>
                            <div class="uec-body">
                                <div class="uec-header-row">
                                    <div class="uec-tags">
                                        ${ev.capacityUpdate ? `<span class="uec-category uec-pulse-tag" style="background-color: ${capColor}">${ev.capacityUpdate}</span>` : ''}
                                        ${ev.eventType ? `<span class="uec-category" style="background-color: ${tagColor}">${ev.eventType}</span>` : ''}
                                        ${ev.demographics ? `<span class="uec-category" style="background-color: ${dColor}">${ev.demographics}</span>` : ''}
                                    </div>
                                    ${logoHtml}
                                </div>

                                <div class="uec-date"><i class="${dateIcon}"></i> ${dateTimeString}</div>
                                ${ev.location ? `<div class="uec-location"><i class="fas fa-map-marker-alt"></i> ${ev.location}</div>` : ''}

                                <h3 class="uec-title"><a href="${ev.moreInfoLink}">${cardTitle}</a></h3>
                                <div class="uec-desc" title="${ev.description.replace(/"/g, '\u0026quot;')}">${ev.description}</div>

                                ${segmentHtml}

                                <div class="uec-actions">
                                    <div class="uec-main-action-row">
                                        <a href="${ev.moreInfoLink}" class="uec-btn-main">MORE INFO</a>
                                        ${phoneBtn}
                                        ${emailBtn}
                                    </div>
                                    <div class="uec-cal-col">${calHtml}</div>
                                </div>
                            </div>
                        `;
                        carouselWrapper.appendChild(cardEl);
                    });

                    const viewAllCard = document.createElement('a');
                    viewAllCard.className = 'unified-event-card view-all-card';
                    viewAllCard.href = 'https://www.chabadellicottcity.com/templates/articlecco_cdo/aid/7286655/jewish/Upcoming-Events.htm';
                    viewAllCard.innerHTML = `
                      <div class="view-all-content">
                        <h3>View All</h3><p>Upcoming Events</p><span class="view-all-arrow">→</span>
                      </div>
                    `;
                    carouselWrapper.appendChild(viewAllCard);

                    carouselContainer.appendChild(carouselWrapper);
                    eventsSection.appendChild(carouselContainer);

                    // Delegated handler for the schedule toggles
                    eventsSection.addEventListener('click', function(e) {
                        const btn = e.target.closest ? e.target.closest('.uec-seg-toggle') : null;
                        if (!btn) return;
                        e.preventDefault();
                        const block = btn.parentElement;
                        block.classList.toggle('open');
                        const label = btn.querySelector('.uec-seg-label');
                        if (label) {
                            const count = block.querySelectorAll('.uec-seg-item').length;
                            label.textContent = block.classList.contains('open') ? 'Hide schedule' : `View full schedule (${count})`;
                        }
                    });

                    const swipeHint = document.createElement('div');
                    swipeHint.className = 'mobile-swipe-hint';
                    swipeHint.innerHTML = '<span>Swipe for more events</span> <span class="arrow">→</span>';
                    eventsSection.appendChild(swipeHint);

                    if (carouselWrapper.children.length > 3) {
                        const prevButton = document.createElement('button');
                        prevButton.className = 'events-carousel-arrow prev'; prevButton.innerHTML = '❮';
                        const nextButton = document.createElement('button');
                        nextButton.className = 'events-carousel-arrow next'; nextButton.innerHTML = '❯';
                        carouselContainer.appendChild(prevButton); carouselContainer.appendChild(nextButton);

                        let currentIndex = 0;
                        const itemsToShowDesktop = 3;
                        const totalItems = carouselWrapper.children.length;

                        const updateCarousel = () => {
                            if (carouselWrapper.children.length === 0) return;
                            const cardWidth = carouselWrapper.children[0].offsetWidth;
                            const gap = 30;
                            const totalMove = (cardWidth + gap) * currentIndex;
                            carouselWrapper.style.transform = `translateX(-${totalMove}px)`;
                            prevButton.disabled = currentIndex === 0;
                            nextButton.disabled = currentIndex >= totalItems - itemsToShowDesktop;
                        };

                        prevButton.addEventListener('click', () => { if (currentIndex > 0) { currentIndex--; updateCarousel(); } });
                        nextButton.addEventListener('click', () => { if (currentIndex < totalItems - itemsToShowDesktop) { currentIndex++; updateCarousel(); } });

                        updateCarousel();
                        window.addEventListener('resize', updateCarousel);
                    }

                    let insertionPoint = null;
                    try {
                        insertionPoint = document.querySelector('#BodyContainer > div > div.g960 > div > div.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.g960.no_margin.g960.no_margin > div > div:nth-child(2)');
                    } catch(e) {}

                    if (insertionPoint && insertionPoint.parentElement) {
                        insertionPoint.parentElement.insertBefore(eventsSection, insertionPoint);
                    } else {
                        document.body.appendChild(eventsSection);
                    }

                } catch (error) { console.error('Error fetching data:', error); }
            };

            const injectCSS = () => {
                const style = document.createElement('style');
                style.textContent = `
                    @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
                    :root { --color-accent-green: #afc78b; --color-accent-plum: #6b1457; --color-primary-navy: #212459; --color-bg-light: #f8f9fa; }
                    .injected-featured-events-section { padding: 80px 20px; background-color: var(--color-bg-light); font-family: "Inter", sans-serif; box-sizing: border-box; }
                    .injected-featured-events-header { text-align: center; margin-bottom: 50px; max-width: 800px; margin-left: auto; margin-right: auto; }
                    .injected-featured-events-header h2 { font-size: 42px; font-weight: 800; color: var(--color-primary-navy); letter-spacing: -1px; margin-bottom: 10px; position: relative; display: inline-block; }
                    .injected-featured-events-header h2:after { content: ''; display: block; width: 60px; height: 4px; background: var(--color-accent-green); margin: 15px auto 0; border-radius: 2px; }
                    .injected-events-carousel-container { position: relative; max-width: 1200px; margin: 0 auto; overflow: hidden; padding: 20px 0 40px 0; }
                    .injected-events-carousel-wrapper { display: flex; gap: 30px; transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1); align-items: stretch; }

                    /* UNIFIED CARD STYLES FOR HOMEPAGE */
                    .unified-event-card {
                        flex: 0 0 calc(33.333% - 20px); background: #ffffff; border-radius: 16px; overflow: hidden;
                        box-shadow: 0 10px 40px -10px rgba(33, 36, 89, 0.1); display: flex; flex-direction: column;
                        border: 1px solid rgba(0,0,0,0.05); transition: transform 0.3s ease, box-shadow 0.3s ease; height: auto;
                    }
                    .unified-event-card:hover { transform: translateY(-8px); box-shadow: 0 20px 50px -10px rgba(33, 36, 89, 0.2); }

                    .uec-image { position: relative; height: 200px; overflow: hidden; background-color: #eee; flex-shrink: 0; }
                    .uec-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
                    .unified-event-card:hover .uec-image img { transform: scale(1.05); }

                    .uec-body { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }

                    .uec-header-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
                    .uec-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
                    .uec-category {
                        display: inline-flex; align-items: center; justify-content: center;
                        font-size: 10px; font-weight: 700; text-transform: uppercase;
                        padding: 4px 12px; border-radius: 50px;
                        color: white; white-space: nowrap;
                    }
                    .uec-pulse-tag {
                        box-shadow: 0 0 0 0 rgba(0, 0, 0, 1);
                        transform: scale(1);
                        animation: pulse-tag 2s infinite;
                    }
                    @keyframes pulse-tag {
                        0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.2); }
                        70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(0, 0, 0, 0); }
                        100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
                    }

                    .uec-inst-logo { max-height: 28px; max-width: 90px; object-fit: contain; }

                    .uec-date { font-family: "Inter", sans-serif; color: var(--color-primary-navy); font-weight: 800; font-size: 13px; letter-spacing: 0.5px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
                    .uec-location { font-family: "Inter", sans-serif; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

                    .uec-title { font-family: "Inter", sans-serif; color: var(--color-primary-navy); margin: 0 0 10px; line-height: 1.3; }
                    .uec-title a { font-size: 20px !important; font-weight: 800 !important; color: var(--color-primary-navy) !important; text-decoration: none; transition: color 0.2s; }
                    .uec-title a:hover { color: var(--color-accent-plum) !important; }

                    .uec-desc { font-size: 13px; color: #666; line-height: 1.5; margin: 0 0 20px; flex-grow: 1; max-height: 60px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

                    /* ---- SEGMENTED EVENT SCHEDULE ---- */
                    .uec-seg-block { margin: 0 0 16px; }
                    .uec-seg-toggle {
                        width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
                        background: #f4f5f8; border: 1px solid #e3e5ec; color: var(--color-primary-navy);
                        font-family: "Inter", sans-serif; font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
                        padding: 9px 10px; border-radius: 8px; cursor: pointer; transition: all 0.2s;
                    }
                    .uec-seg-toggle:hover { background: var(--color-primary-navy); color: #ffffff; border-color: var(--color-primary-navy); }
                    .uec-seg-caret { display: inline-block; transition: transform 0.25s ease; }
                    .uec-seg-block.open .uec-seg-caret { transform: rotate(180deg); }
                    .uec-seg-list { display: none; margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--color-accent-green); max-height: 190px; overflow-y: auto; }
                    .uec-seg-block.open .uec-seg-list { display: block; }
                    .uec-seg-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px dashed #eeeeee; }
                    .uec-seg-item:last-child { border-bottom: none; }
                    .uec-seg-text { flex-grow: 1; min-width: 0; }
                    .uec-seg-when { font-size: 11px; font-weight: 800; color: var(--color-primary-navy); letter-spacing: 0.3px; }
                    .uec-seg-what { font-size: 12px; color: #666; line-height: 1.35; }
                    .uec-seg-gcal { flex-shrink: 0; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: #f0f0f0; color: #555 !important; font-size: 11px; text-decoration: none; transition: all 0.2s; }
                    .uec-seg-gcal:hover { background: var(--color-primary-navy); color: #ffffff !important; }
                    .uec-seg-gcal i.fab { background: transparent !important; width: auto !important; height: auto !important; padding: 0 !important; margin: 0 !important; color: inherit !important; box-shadow: none !important; }

                    .uec-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

                    .uec-main-action-row { display: flex; gap: 8px; width: 100%; align-items: stretch; margin-bottom: 8px; }
                    .uec-btn-main {
                        flex-grow: 1; display: flex; align-items: center; justify-content: center;
                        background-color: var(--color-primary-navy); color: #ffffff !important;
                        padding: 10px; border-radius: 8px; text-decoration: none; font-weight: 700; text-align: center;
                        border: 2px solid var(--color-primary-navy); transition: all 0.2s; font-size: 14px; margin: 0;
                    }
                    .uec-btn-main:hover { background-color: var(--color-accent-plum); border-color: var(--color-accent-plum); color: #ffffff !important; }

                    .uec-btn-icon { width: 42px; display: flex; align-items: center; justify-content: center; background-color: #f0f0f0; color: #555; border-radius: 8px; text-decoration: none; transition: all 0.2s; flex-shrink: 0; font-size: 16px; border: 1px solid #ddd; }
                    .uec-btn-icon:hover { background-color: var(--color-primary-navy); color: white; border-color: var(--color-primary-navy); }

                    .uec-cal-col { display: flex; flex-direction: column; gap: 8px; }
                    .uec-btn-cal {
                        display: block; width: 100%; text-align: center; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 600;
                        color: #555 !important; background: #f0f0f0; text-decoration: none; transition: all 0.2s; box-sizing: border-box;
                    }
                    .uec-btn-cal:hover { background: #e0e0e0; color: #222 !important; }
                    .uec-btn-cal i { margin-right: 4px; }

                    /* -- APPLE & GOOGLE MOBILE ICON FIX -- */
                    .uec-cal-col a.uec-btn-cal i.fab,
                    .uec-cal-col a.uec-btn-cal i.fas {
                        background: transparent !important; border-radius: 0 !important; width: auto !important; height: auto !important;
                        padding: 0 !important; margin: 0 4px 0 0 !important; display: inline-block !important;
                        color: inherit !important; line-height: inherit !important; text-align: left !important; box-shadow: none !important;
                    }
                    .uec-cal-col a.uec-btn-cal i.fab::before,
                    .uec-cal-col a.uec-btn-cal i.fas::before {
                        position: static !important; transform: none !important;
                    }

                    .view-all-card { justify-content: center; align-items: center; text-align: center; background-color: #ffffff; border: 2px dashed var(--color-accent-green); text-decoration: none; }
                    .view-all-card:hover { background-color: #fcfcfc; border-color: var(--color-accent-plum); }
                    .view-all-card .view-all-content h3 { font-size: 22px; font-weight: 800; color: var(--color-accent-plum); margin: 0 0 5px; text-transform: uppercase; font-family: "Inter", sans-serif; }
                    .view-all-card .view-all-content p { font-size: 15px; color: #888; margin: 0 0 15px; font-family: "Inter", sans-serif; }
                    .view-all-card .view-all-arrow { font-size: 32px; font-weight: bold; color: var(--color-accent-green); transition: transform 0.3s; display: inline-block; }
                    .view-all-card:hover .view-all-arrow { transform: translateX(5px); color: var(--color-accent-plum); }

                    .events-carousel-arrow { position: absolute; top: 50%; transform: translateY(-50%); background-color: #fff; border: 1px solid #eee; border-radius: 50%; width: 48px; height: 48px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--color-primary-navy); z-index: 10; transition: all 0.2s; }
                    .events-carousel-arrow:hover { background-color: var(--color-primary-navy); color: #fff; }
                    .events-carousel-arrow.prev { left: 0px; }
                    .events-carousel-arrow.next { right: 0px; }
                    .mobile-swipe-hint { display: none; text-align: center; margin-top: 10px; font-family: "Inter", sans-serif; color: #999; font-size: 13px; align-items: center; justify-content: center; gap: 8px; }

                    @media (max-width: 1250px) { .events-carousel-arrow.prev { left: 10px; } .events-carousel-arrow.next { right: 10px; } }
                    @media (max-width: 900px) { .unified-event-card { flex-basis: calc(50% - 15px); } }
                    @media (max-width: 600px) {
                      .injected-featured-events-header h2 { font-size: 28px; }
                      .injected-events-carousel-container { overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; padding: 0 20px 20px 20px; margin: 0 -20px; }
                      .injected-events-carousel-container::-webkit-scrollbar { display: none; }
                      .injected-events-carousel-wrapper { width: max-content; transform: none !important; padding-right: 20px; gap: 15px; }
                      .unified-event-card { flex-basis: 85vw; scroll-snap-align: start; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
                      .events-carousel-arrow { display: none; }
                      .mobile-swipe-hint { display: flex; }
                    }
                `;
                document.head.appendChild(style);
            };

            injectCSS();
            if (document.readyState === 'complete' || document.readyState === 'interactive') runTransformation();
            else window.addEventListener('DOMContentLoaded', runTransformation);

        })();
    }
//]]>
</script>
</body>
</html>