var sPath = window.location.pathname; 
var sPage = sPath.substring(sPath.lastIndexOf("/") + 1);
sPage = sPage.split(".")[0].toLowerCase();

function writebanner2() {
      document.write ("<div id=\"headbox2\"><img src=\"images/newhead2.gif\"></div>");
      document.write ("<div id=\"newmenu\"><ul><li><a href=\"index.html\">Home</a></li>");
      document.write ("<li><a href=\"#\">About Us</a><ul><li onclick='top.location.href=\"leadership2.html\"'>Our Staff</li><li onclick='top.location.href=\"officers2.html\"'>Officers &amp; Directors</li><li onclick='top.location.href=\"education2.html\"'>Education Programs</li><li onclick='top.location.href=\"community2.html\"'>Community</li></ul></li>");
      document.write ("<li><a href=\"membership2.html\">Membership</a></li><li><a href=\"events2.html\">Events &amp; Calendars</a></li>");
      document.write ("<li><a href=\"music2.html\">Music</a></li><li><a href=\"photographs2.html\">Photo Galleries</a></li><li><a href=\"links2.html\">Links</a></li>");
      document.write ("<li><a href=\"#\">Publications &amp; Forms</a><ul><li onclick='top.location.href=\"publications2.html\"'>Newsletters</li><li onclick='top.location.href=\"flyers2.html\"'>Current Flyers</li><li onclick='top.location.href=\"forms2.html\"'>Forms (to print)</li></ul></li>");
      document.write ("<li><a href=\"#\">Directions</a><ul><li onclick=open_dir2syn()>To the synagogue</li><li onclick=open_dir2cem()>To the cemetery</li></ul></li>");
      document.write ("<li><a href=\"contact2.html\">Contact Us</a></li>");
      document.write ("</ul></div>");
}

function open_dir2syn() {
  window.open('http://www.mapquest.com/maps/map.adp?address=145 Brownell Ave&amp;city=New Bedford&amp;state=MA&amp;zipcode=02740-1654&amp;country=US&amp;title=&lt;b&gt;145 Brownell Ave&lt;/b&gt;&lt;br /&gt; New Bedford, MA 02740-1654,  US&amp;cid=lfmaplink2&amp;name=&amp;dtype=s');
}

function open_dir2cem() {
  window.open('http://www.jcam.org/Pages/Cemeteries_New/Cemetery_Pages_08/New_Bedford_Plainville.html');
}
function writetitle(sHeader) {
      document.write("<div id=\"pagetitle2\"><h1>" + sHeader + "</h1></div>");
}

function writefooter() {
	document.write("<div id=\"blockcenter\">Tifereth Israel Copyright&copy; 2011 All Rights Reserved</div>");
}

function writequote(i) {
	var sQuote;
	var aQuotes = new Array (
		"<br />The world rests on three things; on Torah,<br /> on service of G-d, on deeds of love.<br /> &ndash;&ndash; Shimon Ha-Tzaddik",
		"<br />When you assess people, tip the balance<br />in their favor.<br /> &ndash;&ndash; Joshua ben Perakhyah",
		"<br />Be a disciple of Aaron: loving peace and pursuing peace, loving your fellow creatures and attracting them to the study of Torah.<br /> &ndash;&ndash; Hillel",
		"<br />If I am not for me, who will be? If I am for myself alone, what am I? And if not now, when?<br /> &ndash;&ndash; Hillel",
		"<br />Make the study of Torah your primary occupation; Say little, do much; Greet every person with a cheerful face.<br /> &ndash;&ndash; Shammai",
		"<br />You are not obliged to finish the task, neither are you free to neglect it.<br /> &ndash;&ndash; Rabbi Tarfon",
		"<br />Tradition is a protection for Torah.<br /> &ndash;&ndash; Rabbi Akiva",
		"<br />Silence is a protection<br />for wisdom.<br /> &ndash;&ndash; Rabbi Akiva",
		"<br />There are three crowns: the crown of Torah, the crown of Priesthood, the crown of Royalty. The crown of a good name is superior to them all.<br /> &ndash;&ndash; Rabbi Shimon",
    "<br />One doesn't know another's sorrow.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />G-d gave burdens, also shoulders.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />When it falls, it falls butter side down.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />No one knows whose shoe pinches.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If you want your dreams to come true, don't sleep.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Don't spit in the well, you might drink from it later.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />It's good to have hope, it's the waiting that spoils it.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Suspense is worse than the ordeal itself.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Man plans and G-d laughs.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If there's a bitterness in the heart, sugar in the mouth won't make life sweeter.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />An angry man is not fit to pray.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If things are not as you wish, wish them as they are.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Eating nothing but dumplings is also boring.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />It is not good to be alone, even in Paradise.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If you can't endure the bad, you won't live to see the good.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />You can't control the wind, but you can adjust your sails.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />What soap is to the body, laughter is to the soul.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If you have nothing to lose, you can try everything.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />A man's worst enemies can't wish on him what he can think up himself.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />The woods would be very silent if no birds sang except the best.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If G-d wants people to suffer, He sends them too much understanding.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If G-d were living on earth, people would break His windows.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />No choice is also a choice.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Seek advice but use your own common sense.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If you lie on the ground, you can't fall.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />When fortune calls, offer her a chair.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />The heart is half a prophet.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If you can't go over, you must go under.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If we cannot do what we will, we must will what we can.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />If I try to be like him, who will be like me?<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />The longer a blind man lives, the more he sees.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />The smoothest path is full of stones.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Nerve succeeds!<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />A child's wisdom is also wisdom.<br /> &ndash;&ndash; Yiddish Proverb",
    "<br />Bygone troubles are good to tell.<br /> &ndash;&ndash; Yiddish Proverb");
	if(typeof(i) == "undefined" || isNaN(i) || i < 0 || i > (aQuotes.length-1))
		i = Math.round(Math.random()*(aQuotes.length-1));
	sQuote = aQuotes[i];
	return sQuote;
}	
function writeright(bQ,bWN,bMAP,iQ,bDonate) {
  document.write ("<div style=\"background-color:#151B8D\">");
	if(bQ) {
		document.write("<div id=\"block1\"><p class=\"type2\">" + writequote(iQ) + "</p></div>");
  }
  if (bDonate) {
		document.write("<div id=\"block1\"><p class=\"type2\"><a href=\"onlinedonation1.html\"><img src=\"images/tzedakahbox.jpg\" alt=\"\" /></a>");
		document.write("<a href=\"onlinedonation1.html\">Click here to make a <b>DONATION</b> to<br />Tifereth Israel.</a></div>");
	}
  document.write("<div id=\"block4\"><div id=\"header\">LOOKING FOR A<br />DAILY MINYAN OR SHABBAT SERVICE?</div><div id=\"contents\"><p class=\"type4\"><a class=\"nyroModal\" href=\"http://www.tinewbedford.org/images/ThisWeeksServices.jpg\"><b>Click for this week's Services schedule.</b></a></p></div></div>");
 	if(bMAP) {
  	document.write("<div id=\"block3\"><div id=\"header\">Profiles of Our Fallen</div><div id=\"contents\"><p><a href=\"http://www.forward.com/articles/135331/#ixzz1DeAMPaIh\" target=\"_blank\"><img src=\"images/AmericanFlag.jpg\"><br /><b><i>Reflecting on the Lives of the American Jewish Service Members Who Died Fighting in Iraq and Afghanistan</i></b></a></p></div></div>");
  }
	if(bWN) {
  	document.write("<div id=\"block2\"><div id=\"header\">What's New</div><div id=\"contents\">");
    document.write("SouthCoast Jewish Speaker Series<br />February 26 &mdash; <a href=\"Speaker_series_2011.pdf\" target=\"_blank\">(flyer)</a><br /><hr />");
    document.write("Shabbat<br />Across America<br />March 2 &mdash; <a href=\"Shabbat_Across_America_2012.pdf\" target=\"_blank\">(flyer)</a><br /><hr />");
    document.write("Purim Celebration<br />March 7 &mdash; <a href=\"Purim_Celebration_2012.pdf\" target=\"_blank\">(flyer)</a><br /><hr />");
    document.write("SouthCoast Jewish<br />Film Festival<br />March 14 &mdash; <a href=\"Film_Festival_2012.pdf\" target=\"_blank\">(flyer)</a><br /><hr />");
    document.write("Sisterhood<br />Arts &amp; Crafts Group<br />March 18 &mdash; <a href=\"SisterhoodArtsAndCrafts2011-12.pdf\" target=\"_blank\">(flyer)</a><br />");
    document.write("</div></div>");
	}	
  document.write("<div id=\"rightbottomimg\"><img src=\"" + pickpicture(iQ) + "\" alt=\"bottom\" /></div></div>");
}

function pickpicture(i) {
	var sPicture;
	var aPictures = new Array (
		"images/p1.jpg",
		"images/p2.jpg",
		"images/p3.jpg",
		"images/p4.jpg",
		"images/p5.jpg",
		"images/p6.jpg",
		"images/p7.jpg",
		"images/p8.jpg",
		"images/p9.jpg",
		"images/p10.jpg",
		"images/p11.jpg",
		"images/p12.jpg",
		"images/p13.jpg");
	if(typeof(i) == "undefined" || isNaN(i) || i < 0 || i > (aPictures.length-1))
		i = Math.round(Math.random()*(aPictures.length-1));
	sPicture = aPictures[i];
	return sPicture;
}	

function writeamazon1() {
  document.write("<p><b><a href=\"http://www.amazon.com/?&tag=tiferisraecon-20&camp=212361&creative=392009&linkCode=wsw&\">Start your Amazon shopping here</a></b></p>");
}

function writeamazon3() {
  document.write("<p><b><a href=\"http://www.amazon.com/?&tag=tiferisraecon-20&camp=212361&creative=392009&linkCode=wsw&\">and support<br />Tifereth Israel!</a></b></p>");
//  document.write("<hr /><b><a class=\"nyroModal\" href=\"http://www.tinewbedford.org/images/kindle.jpg\">Win a KINDLE<br /><br />click to learn more!<br />&nbsp;<br /></a></b></p>");
}

function writeleft() {
  document.write("<div style=\"background-color:#151B8D\">");
//	document.write("<div id=\"leftblock2\"><div id=\"contents\"><p class=\"type4\"><a href=\"viewpage4.html\"><b>Two Fun Music Videos</b></a></p></div></div>");
	document.write("<div id=\"leftblock2\"><div id=\"header\">Current Issues of...</div><div id=\"contents\"><p class=\"type4\"><a href=\"awetw_current.html\"><b>As We End the Week</b></a><br /><a href=\"Shofar_Current.pdf\" target=\"_blank\"><b>Shofar</b></a><br /><a href=\"Israelight_Current.pdf\" target=\"_blank\"><b>Tifereth Israelight</b></a><br /></p></div></div>");
	document.write("<div id=\"leftblock2\"><div id=\"contents\"><a href=\"http://www.facebook.com/pages/Tifereth-Israel-Congregation/102140269867396\" target=\"_TOP\" title=\"Tifereth Israel Congregation\"><b>Follow us on</b></a><br /><a href=\"http://www.facebook.com/pages/Tifereth-Israel-Congregation/102140269867396\" target=\"_TOP\" title=\"Tifereth Israel Congregation\"><img src=\"images/facebookx.jpg\" width=\"165\" height=\"43\" style=\"border: 0px;\" /></a></div></div>");
	document.write("<div id=\"leftblock1\"><div id=\"header\">Magen Tzedek</div><div id=\"contents\"<p class=\"type4\"><a href=\"magen_tzedek.pdf\" target=\"_blank\"><b>Responding to a<br />Higher Responsibility</b></a></p></div></div>");
	document.write("<div id=\"leftblock1\"><div id=\"header\">USCJ NEWS</div><div id=\"contents\"><p class=\"type4\">Check out this month's <a href=\"http://www.uscj.org/Aboutus/Publications/eNews/ThisMonth_sIssue.aspx\" target=\"_blank\">United Synagogue eNews</a></p></div></div>");
  document.write("<div id=\"leftblock3\"><a href=\"http://www.keshetonline.org\" target=\"_blank\"><img src=\"images/Keshet_SafeZone.jpg\" alt=\"Keshet SafeZone\" width=\"184\" /></a></div>");
	document.write("</div>");	
}

function setheight() {
	var l = document.getElementById("pageleft");
	var c = document.getElementById("pagecontent");
	var r = document.getElementById("pageright");
 	var heights = new Array(
 		l.offsetHeight,
 		r.offsetHeight,
 		c.offsetHeight);
 	heights.sort(compare);
 	var h = heights[0];
	l.style.height = h+"px";
 	c.style.height = h+"px";
 	r.style.height = h+"px";
}

function compare(a, b) {
	return b - a;
}

function writecalinfo() {
  document.write ("<div id=\"calinfo\">");
	document.write("<script type=\"text/javascript\" src=\"http://www.hebcal.com/shabbat/?geo=zip;zip=02740;m=60;cfg=j\"></script>");
	document.write("<noscript><a href=\"http://www.hebcal.com/shabbat/?geo=zip;zip=02740;m=0\"> Shabbat Candle Lighting times for New Bedford, MA 02740</a> courtesy of hebcal.com.</noscript>");
	document.write("</div>");	
}

