<!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/1179/hIsi11793255.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="Events" />
<meta name="title" content="Events - Chabad Madison" />
<meta property="og:type" content="website" />
<meta name="scope-aids" content="1918556-1918564-3184062-7201375-7262287" />
<meta name="article-keywords" content="1675-8495-20962-31783-32769-2170-2898" />
<meta name="scope-aid" content="1918556" />
<meta name="scope-aid" content="1918564" />
<meta name="scope-aid" content="3184062" />
<meta name="scope-aid" content="7201375" />
<meta name="scope-aid" content="7262287" />
<meta name="article-keyword" content="1675" />
<meta name="article-keyword" content="8495" />
<meta name="article-keyword" content="20962" />
<meta name="article-keyword" content="31783" />
<meta name="article-keyword" content="32769" />
<meta name="article-keyword" content="2170" />
<meta name="article-keyword" content="2898" />
<meta property="og:url" content="https://www.chabadmadison.com/templates/articlecco_cdo/aid/7262287/jewish/Events.htm" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:site" content="@chabad" />
<meta property="og:title" content="Events - Chabad Madison" /><link rel="canonical" href="https://www.chabadmadison.com/templates/articlecco_cdo/aid/7262287/jewish/Events.htm" />
<link rel="icon" type="image/png" href="https://www.chabadmadison.com/media/images/1179/hIsi11793255.png" />
<link rel="Stylesheet" href="/css/fonts/font-awesome/font-awesome-5.css?v=98662BF4" id="kfont-awesome" type="text/css"/>
<link rel="Stylesheet" href="/css/DefaultGrid.css?v=44B79007" id="kgrid" type="text/css"/>
<link rel="Stylesheet" href="/css/Elements.css?v=E669C926" id="k6" type="text/css"/>
<link rel="Stylesheet" href="/css/vendor/ds/tokens/sites.css?v=D77AD1C0" id="ksites-ds-css" type="text/css"/>
<link rel="Stylesheet" href="/css/new/main.css?v=2B7F734E" id="k7" type="text/css"/>
<link rel="Stylesheet" href="/css/old/global.css?v=F7C22456" id="k2898" type="text/css"/>
<link rel="Stylesheet" href="https://w2.chabad.org/images/shluchim/minisites/themes/cyp/style.css?v=154" id="k32769" 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=B92FCAD8" id="kbootstrap4-grid" type="text/css"/>
<link rel="Stylesheet" href="/css/Library/reader-comments.css?v=5F31D0D8" id="kCommentsStylesheet" type="text/css"/>
<link rel="Stylesheet" href="/css/inline/BookInfo.css?v=14B88022" 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":"2026-02-23","primaryArticleId":7262287,"title":"","author":"","authorId":0,"contentLevel1":"My Site","contentLevel2":"Adults","contentLevel3":"CYP","contentLevel4":"Events","siteName":"Chabad Madison"},"time":{"upcomingHoliday":"Shavuot","daysToUpcomingHoliday":0,"hebrewDate":"5786-03-06"}});
		dataLayer.push({ 'articleHierarchy': '-1918556-1918564-3184062-7201375-7262287-', 'keywords': '-k2898-k2170-k32769-k31783-k20962-k8495-k1675-', 'k': '-1918556-1918564-3184062-7201375-7262287--k2898-k2170-k32769-k31783-k20962-k8495-k1675-' });
	
</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 = 8150798;var sc_partition = 91;var sc_invisible = 1;var sc_remove_link=1;var sc_security = "02b0a49d";var sc_https = 1;
	</script>
	<script type="text/javascript" src="https://secure.statcounter.com/counter/counter_xhtml.js" defer async></script>
	<noscript><img src="//c92.statcounter.com/counter.php?sc_project=8150798&amp;java=0&amp;security=02b0a49d&amp;invisible=1" border="0" /> </noscript>
	<!-- End of StatCounter Code -->


<link href="https://fonts.googleapis.com/css?family=Oswald|Overpass|Poppins|Roboto|Roboto+Condensed|Source+Sans+Pro" rel="stylesheet">
<meta name="google-site-verification" content="IU0bIvt29Stfzx_e3qeJ7LrCRSmQ4fCkhWMM6u0ylrY" />
<meta name="google-site-verification" content="d40ipFpFLuXK6sn8_LRzjji0EGvqFj09MHFGbyhNY3U" />
<style type="text/css">
.main {
    padding-top: 0px !important;
}
[class^="widget-"] a:hover {
     text-decoration: none; 
}
.widget-4 .wrapper {
-webkit-box-shadow: none;
box-shadow: none;
}

.widget-4, .sneak_peek {
-webkit-box-shadow: none;
box-shadow: none;
}

</style>

<style  type="text/css">
button.add-fields, button.remove-fields {
  position: relative;
  padding: 10px;
  font-weight: 700;
 color: #105689;
  border: 2px #105689 solid;
  border-radius: 4px;
  text-transform: uppercase;
  outline: 0;
  margin-right:10px;
  overflow:hidden;
  background: none;
  z-index: 1;
  cursor: pointer;
  transition:         0.08s ease-in;
  -o-transition:      0.08s ease-in;
  -ms-transition:     0.08s ease-in;
  -moz-transition:    0.08s ease-in;
  -webkit-transition: 0.08s ease-in;
}

.add-fields:hover, .remove-fields:hover {
  color: whitesmoke;
}

.add-fields:before, .remove-fields:before {
  content: "";
  position: absolute;
  background: #105689;
  bottom: 0;
  left: 0;
  right: 0;
  top: 100%;
  z-index: -1;
  -webkit-transition: top 0.09s ease-in;
}

.add-fields:hover:before, .remove-fields:hover:before {
  top: 0;
}

button[disabled="disabled"].add-fields, button[disabled="disabled"].remove-fields {
    border: 2px solid #888;
    color: #888;
}

button[disabled="disabled"].add-fields:before, button[disabled="disabled"].remove-fields:before {
    top:100%
}
</style>


<link rel="icon" type="image/png" href="https://chabadmadison.com/media/images/1179/wTKv11793664.png" />



<script language="javascript" type="text/javascript" src="//w4.chabad.org/scripts/js/os/jquery-latest.min.js?v=20170328.5"></script><script type="text/javascript">
jQuery(document).ready(function ($) {
    function toggleFields(fieldsList, sourceElm, val, condition) {
        var elm = $(sourceElm);
        elm.change(function () {
            let elmValue = $(this).val();
            var found = condition == '>=' ? elmValue >= val : elmValue == val;

            if ($(this).is(':radio')) {
                found = $(this).is(':checked');
            }

            fieldsList.forEach(function (i, x, a) {
                found ? $(i).show() : $(i).hide();

                if (!found) {
                    $(i).find('select', 'input').not(':radio', ':checkbox').each(function () {
                        $(this).val('');
                    });
                }
            });
        });
        elm.change();
    }

    var toggleIndex = 0;

    function addToggleButtons(parentElm, totalElm, requiredMin, optionalMax, addText, removeText) {
        toggleIndex++;

        function getSelectedValue(e) {
            var totalValue = parseInt($(e).val());
            if (!totalValue) {
                totalValue = 1;
            }
            return totalValue;
        }

        $(parentElm).prepend('<button type="button" class="remove-fields" id="remove-fields-' + toggleIndex + '" style="display:none;">' + removeText + '</button>');

        $('#remove-fields-' + toggleIndex).click(function () {
            var value = getSelectedValue(totalElm);
            if (value > requiredMin) {
                value--;
            }
            $(totalElm).val(value);
            $(totalElm).change();
            value == requiredMin ? $(this).hide() : $(this).show();
            value == optionalMax ? $('#add-fields-' + toggleIndex).attr('disabled', 'disabled') : $('#add-fields-' + toggleIndex).removeAttr('disabled');
            if (initTotal && typeof initTotal == 'function') {
                initTotal();
            }
        });

        $(parentElm).prepend('<button type="button" class="add-fields" id="add-fields-' + toggleIndex + '">' + addText + '</button>');

        $('#add-fields-' + toggleIndex).click(function () {
            var value = getSelectedValue(totalElm);
            if (value < optionalMax) {
                value++;
            }
            $(totalElm).val(value);
            $(totalElm).change();
            value == requiredMin ? $('#remove-fields-' + toggleIndex).hide() : $('#remove-fields-' + toggleIndex).show();
            value == optionalMax ? $(this).attr('disabled', 'disabled') : $(this).removeAttr('disabled');
            if (initTotal && typeof initTotal == 'function') {
                initTotal();
            }
        });
    }

    if (Co.ArticleId == 3756131) {
        var selectElmId = '#input_53';

        toggleFields(["#cid_39", "#id_40", "#id_41", "#id_42", "#id_43", "#id_44", "#id_46"], selectElmId, "2", ">=");

toggleFields(["#cid_58", "#id_59", "#id_60", "#id_61", "#id_62", "#id_63", "#id_64"], selectElmId, "3", ">=");

        addToggleButtons("#cid_25", selectElmId, 1, 3, "Add additional child", "Remove additional child");
    }

if (Co.ArticleId == 3830454) {
        var selectElmId = '#input_49';

toggleFields(["#cid_42", "#id_11", "#id_12", "#id_44", "#id_65", "#id_45", "#id_46", "#id_47", "#id_48", "#id_16", "#id_53", "#id_54"], selectElmId, "2", ">=");
toggleFields(["#cid_61", "#id_62", "#id_63", "#id_64", "#id_79", "#id_66", "#id_67", "#id_68", "#id_69", "#id_55", "#id_56", "#id_57"], selectElmId, "3", ">=");
toggleFields(["#cid_70", "#id_71", "#id_72", "#id_73", "#id_78", "#id_74", "#id_75", "#id_76", "#id_77", "#id_58", "#id_59", "#id_60"], selectElmId, "4", ">=");

        addToggleButtons("#cid_17", selectElmId, 1, 4, "Add additional child", "Remove additional child");
    }
});
</script><script src="https://webmk.co/sites/chabad-madison/main-script.js" /></script><script>
(function() {
    // 1. CONFIGURATION
    var targetPageID = "7152430"; 
    var urlIdentifier = "ArticleCcoResponse_cdo"; 

    // *** VERIFY THIS IS YOUR DEPLOYED WEB APP URL ***
    var googleWebAppUrl = "https://script.google.com/macros/s/AKfycbwyY9A_f34OQm2jH8kmbC59MKyLyo1ABgsdiW3qamX9e9R0p3ORtlcuWtoJTIuiF-jF4g/exec"; 

    // 2. CHECK URL
    if (window.location.href.indexOf(targetPageID) > -1 && window.location.href.indexOf(urlIdentifier) > -1) {
        
        console.log("Campaign Scraper: Page detected. Waiting for table...");

        // Wait for the table to appear (Dynamic Loading)
        var attempts = 0;
        var maxAttempts = 20; // 10 seconds timeout

        var checkInterval = setInterval(function() {
            var table = document.querySelector('.response_table');
            
            if (table) {
                clearInterval(checkInterval);
                console.log("Campaign Scraper: Table found!");
                scrapeAndSend();
            } else {
                attempts++;
                if (attempts >= maxAttempts) {
                    clearInterval(checkInterval);
                    console.log("Campaign Scraper: Timed out waiting for table.");
                }
            }
        }, 500); 

        function scrapeAndSend() {
            var extractedData = {
                firstName: "",
                lastName: "",
                amount: "", 
                submissionId: "" 
            };

            // 3. SCRAPE TABLE
            var tableRows = document.querySelectorAll('.response_table tr');
            
            if (tableRows.length > 0) {
                tableRows.forEach(function(row) {
                    var labelCell = row.querySelector('.field_name');
                    var valueCell = row.querySelector('.field_value');

                    if (labelCell && valueCell) {
                        var label = labelCell.innerText.trim().toLowerCase();
                        var value = valueCell.innerText.trim();

                        // A. FIRST NAME
                        if (label.indexOf('full name - first name') > -1) {
                            extractedData.firstName = value;
                        }
                        // B. LAST NAME
                        else if (label.indexOf('full name - last name') > -1) {
                            extractedData.lastName = value;
                        }
                        // C. AMOUNT (From "Total Amount")
                        else if (label.indexOf('total amount') > -1) {
                            extractedData.amount = value;
                        }
                        // D. SUBMISSION ID (For Duplicate Prevention Only)
                        else if (label.indexOf('submission id') > -1) {
                            extractedData.submissionId = value;
                        }
                    }
                });

                // --- DUPLICATE CHECK ---
                if (extractedData.submissionId) {
                    var sentIds = JSON.parse(localStorage.getItem('ec_sent_submissions') || "[]");
                    if (sentIds.indexOf(extractedData.submissionId) > -1) {
                        console.log("Campaign Scraper: Duplicate submission detected. Skipping.");
                        return; 
                    }
                }

                console.log("Sending Data to Sheet:", extractedData);

                // 4. SEND TO GOOGLE
                fetch(googleWebAppUrl, {
                    method: 'POST',
                    mode: 'no-cors',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify(extractedData)
                }).then(function() {
                    console.log("Data sent successfully.");
                    
                    if (extractedData.submissionId) {
                        var sentIds = JSON.parse(localStorage.getItem('ec_sent_submissions') || "[]");
                        sentIds.push(extractedData.submissionId);
                        localStorage.setItem('ec_sent_submissions', JSON.stringify(sentIds));
                    }

                }).catch(function(err) {
                    console.error("Error sending data:", err);
                });
            }
        }
    }
})();
</script><title>
	Events - Chabad Madison
</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.ChabadMadison.com" style="display:block!important;font-size:14px !important;">&laquo; Back to&nbsp;Chabad Madison</a></div>
	
	<div class="cco_templatelates_content">
		
	<div class="co_content_container clearfix local_content" id="co_content_container">
		<div class="clearfix">
			<!-- BEGIN HEADER -->
<div id="chabad_body_page">
<div id="chabad_main_content">

<div id="back-header" class="back-header transparent-header">

<div class="toolbar-area hidden-md">
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-12">
<div class="toolbar-text">

<co:item>

<a href="tel:608-231-3450">
<img src="https://w2.chabad.org/images/shluchim/minisites/themes/fontawesome-free-6.7.2-web/svgs/solid/phone.svg" alt="Phone social icon" />
608-231-3450
</a>

</co:item>

</div>
</div>
<div class="col-lg-4 col-md-12">
<div class="toolbar-content">
<div class="toolbar-contact">
<ul>
<li>

<co:item>

<a href="/tools/feedback">
<img src="https://w2.chabad.org/images/shluchim/minisites/themes/fontawesome-free-6.7.2-web/svgs/regular/envelope.svg" alt="Email social icon" />Contact Us</a>

</co:item>

</li>
</ul>
</div>
<div class="toolbar-sl-share">
<ul>

<co:item>
<li>

<a href="https://www.facebook.com/chabadyoungprofessionals/">
<img src="https://w2.chabad.org/images/shluchim/minisites/themes/fontawesome-free-6.7.2-web/svgs/brands/facebook-f.svg" alt="Social icon" /></a>

</li>
</co:item>


<co:item>
<li>

<a href="https://www.instagram.com/chabadyoung">
<img src="https://w2.chabad.org/images/shluchim/minisites/themes/fontawesome-free-6.7.2-web/svgs/brands/instagram.svg" alt="Social icon" /></a>

</li>
</co:item>

</ul>
</div>
</div>
</div>
</div>
</div>
</div>

<div class="menu-part">
<div class="container">
<div class="back-main-menu">
<div class="menu-toggle">

<div class="logo-text">

<a href="/7201375">
<img src="https://w2.chabad.org/images/shluchim/minisites/themes/cyp/assets/images/logo/logo.png" alt="Logo" />
</a>


<a href="/7201375">YJP Madison</a>

</div>

<button type="button" id="menu-btn">
<span class="icon-bar" ></span>
<span class="icon-bar" ></span>
<span class="icon-bar" ></span></button>
</div>
<div class="back-inner-menus">
<div class="chabad_navigator_bar_wrapper">

<div id="navigation" class="chabad_navigator_bar">
<div class="chabad_menu_content">
<ul id="menu" class="navi">
<li class="item parent">
<a href="/article.asp?aid=7201375" class="parent">Home</a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7201376" class="parent">About</a>
|
</li>
<li class="item parent selected">
<a href="/article.asp?aid=7262287" class="parent selected">Events</a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7262286" class="parent">YJP Chai Club </a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7201380" class="parent">Donate</a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7262320" class="parent">YJP Community</a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7262315" class="parent">Torah Study</a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7262328" class="parent">Support</a>
|
</li>
<li class="item parent">
<a href="/article.asp?aid=7355527" class="parent">Met@chabad</a>
</li>

</ul>
</div>
</div>


</div>
<ul id="backmenu" class="back-menus back-sub-shadow" style="display: none;" ></ul>
</div>
</div>
</div>
</div>
</div>

<div class="chabad_left_column" detached="true" type="static" name="content_area" id="ContentArea"><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">Events</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="2026-02-23T19:36:05" />
<span itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
	<meta itemprop="name" content="Chabad Madison" />
	<meta itemprop="brand" content="Chabad Madison" />
	<span itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
		<meta itemprop="url" content="https://w2.chabad.org/media/images/1179/hIsi11793255.png" />
		<meta itemprop="height" content="150" />
		<meta itemprop="width" content="150" />
	</span>
</span>
<meta itemprop="datePublished" content="2026-02-23T19:36:05" />
			<div itemprop="articleBody">
				<co:body xmlns:co="www1.chabadonline.com/alpha1" xmlns:ext="urn:xslt-extensions">
  <div class="co_body article-body cf">
</div>
</co:body>
			</div>
			

			<div class="break_floats"></div>
			
	<div class="break_floats"></div>
	

<div class="content-footer">
	<!-- END CACHE -->
	
	
	
	
	
</div>
	</article>

		</div>
	</div>
</div>
						
						<div class="break_floats"></div>
						
					</div>
				</div>
				
				
				
			</div>
			
			<!-- BEGIN FOOTER -->


<div id="back-footer" class="back-footer style2">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-lg-9" style="text-align: right;">
<div class="footer-widget"></div></div></div></div></div></div>


<div class="content3">
<script src="https://01.myjewishpage.com/images/shluchim/minisites/themes/cyp/scripts.js?v=11"></script>
<script src="https://01.myjewishpage.com/images/shluchim/minisites/themes/cyp/assets/js/jquery.min.js"></script>
<script src="https://01.myjewishpage.com/images/shluchim/minisites/themes/cyp/assets/js/bootstrap.min.js"></script>
<script src="https://01.myjewishpage.com/images/shluchim/minisites/themes/cyp/assets/js/back-menus.js"></script>
<script src="https://01.myjewishpage.com/images/shluchim/minisites/themes/cyp/assets/js/main.js?v=4"></script></div>


</div>
</div>
<!-- END FOOTER -->
		</div>
		
		
	</div>

	</div>

	<div id="BodyContainer">
		<div class="g960 footer">
			<div class="poweredby large_bottom_margin">
				



	<div class="footer3">
		<span class="footer-title" >Chabad Madison</span>
		<div class="footer-address">
			<span class="footer-street">1711 Monroe St </span>
			<span class="footer-city-state">Madison, WI 53711</span>
		</div>
			<span>608-231-3450</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-latest.min.js?v=0293E3EC"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/co/dist/CoLib.js?v=F809B22F"></script>
<script type="text/javascript" src="https://w2.chabad.org/scripts/js/WebComponents/bundles/magen-cdo-global.js?v=95D39855"></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/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 Madison'}; Co.ArticleId     = '7262287';Co.SectionId     = 3184062;Co.PartnerSiteId = 0;Co.SiteId        = 214;Co.IsMobilePage  = false;Co.IsResponsive  = false;Co.DbDomain      = 'ChabadMadison.com';Co.LanguageCode  = '';Co.LoginStatus   = 'None';</script>
	
	
<script>
document.addEventListener('DOMContentLoaded', function() {

    // =========================================================================
    // PART 1: HELPER FUNCTIONS & CONFIG
    // =========================================================================

    const googleSheetCsvUrl = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRhqJdBdBaaXEuIqeSwRyVapiMHHjZfI8deYHLBaISbliR8mihmy2uaRTsMX6KlRbZEkQA5RNDw6fr3/pub?output=csv';

    // Helper: Find a div containing specific text (handling the period issue)
    function findPlaceholderElement(placeholderText) {
        const potentialContainers = document.querySelectorAll('div.form-html'); 
        for (let container of potentialContainers) {
            // Check textContent to find the placeholder
            if ((container.textContent || '').includes(placeholderText)) {
                return container; 
            }
        }
        return null;
    }

    // Helper: Parse CSV Text into JSON
    function parseCsvResponse(csvText) {
        if (!csvText || typeof csvText !== 'string') return []; 
        try { 
            const lines = csvText.trim().split('\n'); 
            if (lines.length < 2) return []; 
            const headers = lines.shift().trim().split(',').map(h => h.trim().replace(/"/g, '')); 
            return lines.map(line => { 
                const values = line.trim().split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); 
                const rowData = {}; 
                headers.forEach((header, index) => { 
                    let value = values[index] ? values[index].trim().replace(/^"|"$/g, '') : ''; 
                    if (['Amount', 'Goal', 'Value / GID'].includes(header) && value) { 
                        value = parseFloat(value.replace(/[^0-9.-]+/g, "")) || 0; 
                    } 
                    rowData[header] = value; 
                }); 
                return rowData; 
            }); 
        } catch (e) { 
            console.error("Failed to parse CSV.", e); 
            return []; 
        }
    }

    // Helper: Get specific sheet URL
    function getSheetCsvUrl(gid) {
        const sheetIdMatch = googleSheetCsvUrl.match(/\/d\/e\/(.*?)\//);
        if (!sheetIdMatch) return null;
        return 'https://docs.google.com/spreadsheets/d/e/' + sheetIdMatch[1] + '/pub?gid=' + gid + '&output=csv';
    }

    // =========================================================================
    // PART 2: STYLING & INTERACTIVITY (Radio Tabs)
    // =========================================================================

    function injectFormStyles() {
        // 1. Add Google Font
        const link = document.createElement('link');
        link.href = 'https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;700;900&display=swap';
        link.rel = 'stylesheet';
        document.head.appendChild(link);
        
        // 2. Add Custom CSS
        const style = document.createElement('style');
        style.innerHTML = `
            /* --- Base and Font --- */
            .campaign-form-styling-active .userform-form, 
            .campaign-form-styling-active .userform-form span {
                font-family: 'Raleway', sans-serif !important;
                box-sizing: border-box;
                color: white !Important;
            }
            /* --- Blue Background Section (Grid) --- */
            .campaign-form-styling-active ul.form-section {
                background-color: #2F3C4D !important;
                padding: 30px !important;
                border-radius: 8px;
                margin-top: 20px;
                display: block !important;
                gap: 20px;
                list-style: none !important;
            }
            /* --- Exclude Top Elements from Blue BG --- */
            .campaign-form-styling-active ul.form-section > li#id_1, 
            .campaign-form-styling-active ul.form-section > li#id_3, 
            .campaign-form-styling-active ul.form-section > li#id_12,
            .campaign-form-styling-active ul.form-section > li#id_13,
            .campaign-form-styling-active ul.form-section > li#id_4 {
                background-color: transparent !important;
                padding: 0 !important;
                grid-column: 1 / -1 !important;
                margin: 0 !important;
                border: none !important;
                box-shadow: none !important;
            }
            /* Hide GID field */
            .co_body .content .form-all p{ color: white !important;}
            /* Reset text color for items in blue section */
            .campaign-form-styling-active ul.form-section > li { color: white; }
            /* Reset for top elements */
            .campaign-form-styling-active ul.form-section > li.form-line#id_3 .form-html p,
            .campaign-form-styling-active ul.form-section > li#id_13 * { color: #333 !important; }
            
            /* --- Make sections span full width --- */
            .campaign-form-styling-active ul.form-section > li#id_14,
            .campaign-form-styling-active ul.form-section > li#id_7,
            .campaign-form-styling-active ul.form-section > li#id_8,
            .campaign-form-styling-active ul.form-section > li#id_2,
            .campaign-form-styling-active ul.form-section > li#id_10,
            .campaign-form-styling-active ul.form-section > li#id_11 { grid-column: 1 / -1 !important; }

            /* --- RADIO TABS STYLING --- */
            .campaign-form-styling-active li.custom-radio-tab-list {
                grid-column: 1 / -1 !important; background: transparent !important; border: none !important; padding: 0 !important; margin: 0 !important;
            }
            .campaign-form-styling-active .custom-radio-grid-container {
                display: grid !important; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px;
            }
            .campaign-form-styling-active .custom-radio-tab {
                background-color: white !important; border-radius: 8px !important; padding: 20px !important; color: #333 !important; cursor: pointer;
                transition: all 0.2s ease-in-out; border: 3px solid transparent; display: block !important;
            }
            .campaign-form-styling-active .custom-radio-tab.custom-radio-tab-selected {
                border-color: #B99362 !important; box-shadow: 0 4px 12px rgba(185, 147, 98, 0.4);
            }
            .campaign-form-styling-active .custom-radio-tab input[type="radio"] { display: none !important; }
            .campaign-form-styling-active .custom-radio-tab label {
                font-size: 1rem !important; font-weight: 500 !important; color: #555 !important; line-height: 1.3 !important; display: block; cursor: pointer; width: 100%;
            }
            .campaign-form-styling-active .custom-radio-tab label::before {
                content: attr(data-amount); display: block; font-size: 2rem; font-weight: 900; line-height: 1.1; margin-bottom: 5px;
            }
            .campaign-form-styling-active .custom-radio-tab.spinner-odd label::before { color: #A47E4D !important; }
            .campaign-form-styling-active .custom-radio-tab.spinner-even label::before { color: #2F3C4D !important; }
            .campaign-form-styling-active .custom-radio-tab-other { align-self: start; }
            .campaign-form-styling-active .custom-radio-tab-other label { margin-bottom: 10px; }
            .campaign-form-styling-active .custom-other-input-wrapper { display: block; margin: 0; padding: 0; }
            .campaign-form-styling-active .custom-radio-tab-other input[type="number"] {
                width: 100% !important; border: 1px solid #ccc !important; border-radius: 4px !important; padding: 12px 8px !important;
                font-size: 1.2rem !important; font-weight: 700 !important; color: #2F3C4D !important; margin: 0 !important;
            }
            .campaign-form-styling-active .custom-radio-tab-other input[type="number"]:disabled { background: #f4f4f4 !important; cursor: not-allowed; }
            .campaign-form-styling-active .custom-radio-grid-container .clearfix, .campaign-form-styling-active .custom-radio-tab br { display: none !important; }

            /* --- Other Form Fixes --- */
            .co_body h3, .co_body h2, .co_body h1 { color: #B99362 !important; }
            .co_body .content .form-all .form-submit-button { background: #B99362 !important; }
            .co_body .content .form-all .form-label-left label, .form-sub-label { color: white !important; }
        `;
        document.head.appendChild(style);
        document.body.classList.add('campaign-form-styling-active');
    }

    function setupAllRadioTabs() {
        try {
            const allFormLines = document.querySelectorAll('li.form-line[id*="id_"]');
            allFormLines.forEach((liContainer) => {
                const radioItems = liContainer.querySelectorAll('.form-radio-item');
                const hasOther = liContainer.querySelector('.form-radio-other');
                const firstLabel = liContainer.querySelector('.form-radio-item label');
                const isPaymentRadio = hasOther || (firstLabel && firstLabel.innerText.includes('$'));
                
                if (radioItems.length === 0 || !isPaymentRadio) return;

                // Process Payment List
                liContainer.classList.add('custom-radio-tab-list');
                const gridContainer = liContainer.querySelector('.form-single-column');
                if (gridContainer) gridContainer.classList.add('custom-radio-grid-container');

                const globalOtherInput = liContainer.querySelector('input[type="number"]');
                const globalOtherRadio = liContainer.querySelector('input.form-radio-other');

                radioItems.forEach((radioItem, index) => {
                    radioItem.classList.add('custom-radio-tab');
                    radioItem.classList.add((index % 2 === 0) ? 'spinner-odd' : 'spinner-even');
                    
                    const radio = radioItem.querySelector('input[type="radio"]');
                    let labelEl = radioItem.querySelector('label');
                    const otherInput = radioItem.querySelector('input[type="number"]');

                    if (otherInput) {
                        radioItem.classList.add('custom-radio-tab-other');
                        if (!labelEl) {
                            labelEl = document.createElement('label');
                            labelEl.setAttribute('for', radio.id);
                            radioItem.insertBefore(labelEl, radioItem.querySelector('span'));
                        }
                        labelEl.setAttribute('data-amount', 'Other');
                        labelEl.innerText = 'Enter your own amount';
                        const inputSpan = otherInput.parentElement;
                        if (inputSpan && inputSpan.tagName === 'SPAN') inputSpan.classList.add('custom-other-input-wrapper');
                    } else if (labelEl) {
                        const labelText = labelEl.innerText.trim();
                        const dataAmountAttr = labelEl.getAttribute('data-amount');
                        let amount = "", description = "";

                        if (dataAmountAttr) {
                            amount = dataAmountAttr;
                            description = labelText;
                        } else {
                            const firstSpaceIndex = labelText.indexOf(' ');
                            if (firstSpaceIndex > -1) {
                                amount = labelText.substring(0, firstSpaceIndex);
                                description = labelText.substring(firstSpaceIndex + 1);
                                labelEl.innerText = description;
                                labelEl.setAttribute('data-amount', amount);
                            }
                        }
                    }

                    radioItem.addEventListener('click', (e) => {
                        if (e.target.type === 'number') return;
                        gridContainer.querySelectorAll('.custom-radio-tab').forEach(t => t.classList.remove('custom-radio-tab-selected'));
                        radioItem.classList.add('custom-radio-tab-selected');
                        
                        if (radio === globalOtherRadio) {
                            if(globalOtherInput) { globalOtherInput.disabled = false; globalOtherInput.focus(); }
                        } else {
                            if(globalOtherInput) { globalOtherInput.disabled = true; }
                        }
                    });
                });

                if (globalOtherInput) {
                    globalOtherInput.addEventListener('focus', () => {
                        if (globalOtherRadio && !globalOtherRadio.checked) globalOtherRadio.click();
                        gridContainer.querySelectorAll('.custom-radio-tab').forEach(t => t.classList.remove('custom-radio-tab-selected'));
                        const otherTab = globalOtherInput.closest('.custom-radio-tab');
                        if (otherTab) otherTab.classList.add('custom-radio-tab-selected');
                    });
                }
            });
        } catch (e) {
            console.error("Error setting up radio tabs: ", e);
        }
    }

    // =========================================================================
    // PART 3: DATA FETCHING & POPULATION (Progress Bar / Donors)
    // =========================================================================

    async function processData(currentGid) {
        try {
            // Fetch ONLY the master sheet (Removed Minisite Fetch)
            const masterResponse = await fetch(googleSheetCsvUrl);
            if (!masterResponse.ok) throw new Error('Failed to fetch Master sheet');
            
            const masterText = await masterResponse.text();
            const masterData = parseCsvResponse(masterText);
            
            // Find Campaign Data
            const allCampaigns = masterData.filter(row => row.Type === 'campaign');
            const currentCampaignInfo = allCampaigns.find(c => String(c['Value / GID']) === String(currentGid));

            if (!currentCampaignInfo) { console.error('No campaign with GID ' + currentGid + ' found.'); return; }
            
            const goal = currentCampaignInfo.Goal || 0; 
            
            // Get Specific Donor Sheet
            const donorSheetUrl = getSheetCsvUrl(currentGid);
            if (!donorSheetUrl) return;

            const donorResponse = await fetch(donorSheetUrl);
            const donorText = await donorResponse.text();
            const donors = parseCsvResponse(donorText);

            // Calculate Raised
            const raised = donors.reduce((sum, d) => sum + (d.Amount || 0), 0);

            // Render Elements
            // NOTE: We call these sequentially. We use text replacement (innerHTML) 
            // instead of element replacement to ensure that if both placeholders 
            // are in the same container, one doesn't delete the other.
            populateProgressBar(raised, goal); 
            populateDonorsList(donors); 

        } catch (e) {
            console.error("Error processing campaign data:", e);
        }
    }

    function populateProgressBar(raised, goal) {
        const placeholderElement = findPlaceholderElement('%%CAMPAIGN_PROGRESS_BAR%%');
        if (!placeholderElement) return;

        const percentage = goal > 0 ? Math.round((raised / goal) * 100) : 0;
        
        // Build the HTML String
        const progressBarHtml = 
            '<div id="campaign-form-progress-bar-container" style="padding: 20px 0;">' +
                '<div style="display: flex; justify-content: space-between; font-size: 1.1rem; font-weight: 500; margin-bottom: 8px; color: #333;">' +
                    '<span>Money Raised: <span style="font-weight: 700;">$' + raised.toLocaleString() + '</span></span>' +
                    '<span>Goal: $' + goal.toLocaleString() + '</span>' +
                '</div>' +
                '<div style="background-color: #e0e0e0; border-radius: 20px; height: 35px; overflow: hidden; position: relative;">' +
                    '<div style="background-color: #a47e4d; color: white; text-align: center; font-weight: 700; font-size: 1.2rem; line-height: 35px; height: 100%; width: ' + percentage + '%; transition: width 0.8s ease-in-out; border-radius: 20px;">' +
                        percentage + '%' +
                    '</div>' +
                '</div>' +
            '</div>';
        
        // Style Parent LI to Span Width
        const parentLi = placeholderElement.closest('li');
        if (parentLi) parentLi.style.gridColumn = '1 / -1';

        // Use Text Replacement so we don't accidentally remove the Donor placeholder
        // Regex handles optional trailing period
        placeholderElement.innerHTML = placeholderElement.innerHTML.replace(/%%CAMPAIGN_PROGRESS_BAR%%\.?/, progressBarHtml);
    }

    function populateDonorsList(donors) {
        // Re-find element in case the DOM was updated by populateProgressBar
        const placeholderElement = findPlaceholderElement('%%CAMPAIGN_DONORS_LIST%%');
        if (!placeholderElement) return;

        let donorsHtmlContent = '<h2>Campaign Donors</h2>';
        const showCount = 5; 
        let sortedDonors = []; 

        if (!donors || donors.length === 0) {
            donorsHtmlContent += '<p style="text-align:center;">Be the first to donate to this campaign!</p>';
        } else {
            sortedDonors = [...donors].sort((a,b) => (b.Amount || 0) - (a.Amount || 0));
            sortedDonors.forEach((donor, index) => {
                if (donor.Donor_Name && typeof donor.Amount === 'number') { 
                    const isHidden = index >= showCount;
                    donorsHtmlContent += '<div class="campaign-donor-item" style="background: #F2F2F2; border-radius: 10px; display: ' + (isHidden ? 'none' : 'flex') + '; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid #eee;"><span style="font-size: 1.2rem; font-weight: 500; color: black !Important;">' + donor.Donor_Name + '</span><span style="font-size: 1.2rem; font-weight: 700; color: #a47e4d !Important;">$' + (donor.Amount).toLocaleString() + '</span></div>';
                }
            });

            if (sortedDonors.length > showCount) {
                donorsHtmlContent += '<button id="show-all-donors-btn" style="background: #a47e4d; color: white; border: none; padding: 10px 15px; border-radius: 5px; font-weight: 700; cursor: pointer; margin-top: 10px; text-transform: uppercase; font-size: 0.9rem; width: 100%;">Show All Donors \u2193</button>';
            }
        }
        
        // Build the HTML String
        const donorListHtml = 
            '<div id="campaign-form-donors-list-container" style="margin-top: 40px; display: flex; flex-direction: column; gap: 5px;">' +
                donorsHtmlContent +
            '</div>';

        // Style Parent LI to Span Width
        const parentLi = placeholderElement.closest('li');
        if (parentLi) parentLi.style.gridColumn = '1 / -1';

        // Use Text Replacement
        placeholderElement.innerHTML = placeholderElement.innerHTML.replace(/%%CAMPAIGN_DONORS_LIST%%\.?/, donorListHtml);

        // Attach Event Listeners AFTER injection
        if (sortedDonors.length > showCount) {
            const showMoreBtn = document.getElementById('show-all-donors-btn');
            if (showMoreBtn) {
                showMoreBtn.addEventListener('click', function() {
                    const hiddenDonors = document.querySelectorAll('.campaign-donor-item[style*="display: none"]');
                    hiddenDonors.forEach(donorEl => { donorEl.style.display = 'flex'; });
                    showMoreBtn.style.display = 'none';
                });
            }
        }
    }

    // =========================================================================
    // PART 4: MAIN EXECUTION (The Gatekeeper)
    // =========================================================================

    function initCampaignPage() {
        console.log("Checking for campaign placeholders...");

        // 1. Find GID
        const gidPlaceholder = findPlaceholderElement('%%GID=[');
        let currentGid = null;
        if (gidPlaceholder) {
            const gidMatch = (gidPlaceholder.textContent || '').match(/%%GID=\[(\d+)\]%%/);
            if (gidMatch && gidMatch[1]) {
                currentGid = gidMatch[1];
                gidPlaceholder.style.display = 'none'; // Hide it but keep logic
            }
        }

        // 2. Find Progress Bar & Donors List
        // Note: Using 'includes' in helper handles the trailing period '.' automatically
        const hasProgressBar = findPlaceholderElement('%%CAMPAIGN_PROGRESS_BAR%%');
        const hasDonorsList = findPlaceholderElement('%%CAMPAIGN_DONORS_LIST%%');

        // 3. Strict Check: ALL THREE must be present
        if (currentGid && hasProgressBar && hasDonorsList) {
            console.log("All requirements met. Initializing Campaign Page (Styling + Data).");
            
            // A. Run Styling
            setupAllRadioTabs();
            injectFormStyles();

            // B. Run Data Fetching
            processData(currentGid);

        } else {
            console.log("Script skipped. Requirements not met (Missing GID, Progress Bar, or Donors List).");
            // We do nothing. The page loads as a standard form.
        }
    }

    // Run the check
    initCampaignPage();

});
</script>
</body>
</html>