// On the next lines, remove // as appropriate
//var eruvStatus="UNDETERMINED"
var eruvStatus="APPROVED";
//var eruvStatus="NOT APPROVED";

// Define scroller.
var myScroller1 = new Scroller(0, 0, 600, 100, 5, 8);
myScroller1.setColors("black", "white", "blue");
myScroller1.setSpeed(40);
myScroller1.setPause(2500);
myScroller1.setPause(0);

var current_time = getTime();
var now=new Date();
var nextShabbos=now.getNext(6);
var nextShabbosSTJ=new SystemTime(nextShabbos);
var nextShabbosSTH=GregToHeb(nextShabbosSTJ);
var parsha=getParsha(nextShabbosSTH).englishName;
var thisFriday=getTime(now.getNext(5)) // days are numbered from zero=Sunday.
//thisFriday=thisFriday.substring(thisFriday.indexOf(' ')+1,thisFriday.lastIndexOf(' '));
thisFriday=thisFriday.substring(thisFriday.indexOf(' ')+1, thisFriday.length-10);
//myScroller1.addItem("<div style='font-weight:bold;background-color: #00FF00'>Next Sunday, Feb 11th, there will be no morning Bagels and Gemora shiur.</div>");
//myScroller1.addItem("<b><span style='background-color: #FF33CC'>Mazal tov to Dafna & David Barak & Family on Chaggai's engagement.</span></b>");
//myScroller1.addItem("<div style='font-weight:bold;background-color: #3399CC'>Mazal tov to Rabbi Yitzy & Nava Bald on the birth of a Boy .</Div>");
//myScroller1.addItem("<b><span style='background-color: #3399CC'><b>Mazel Tov to Judy & Mark Merlis on the birth of a Grandson, & to the proud parents Shoshana & Yossi Friedman.</b></div>");
//myScroller1.addItem("<div style='font-weight:bold;background-color: #CCCC99'>Mazel Tov to Esther & Sheldon Adler and the whole Adler & Lerner family on the engagement of Rivkie Adler to Dovid meyer Jacobs.</div>");
//myScroller1.addItem("<div style='font-weight:bold;background-color: #CCCC99'>Mazel Tov to Reuven Darvick on his engagement to Rachel Freedman.</div>");
//myScroller1.addItem("<div style='font-weight:bold;background-color: #FF33CC'>Mazel Tov to Lauren & Jonathan Cooper on the birth of Shulamis Nechama.</div>");
//myScroller1.addItem("<div style='font-weight:bold;background-color: #00CCFF'>Mazel Tov to Florence Fleschner on the Aufruf of her Grandson Yosef & on Yosef's upcoming marraige to Batya Reichman.</div>");
//myScroller1.addItem("<div style='font-weight:bold;background-color: #00ccff'>Mazel Tov to Brenda & Rabbi Chaim Bronstein & family on the Aufruf of their son Yosef & on Yosef's upcoming marraige to Batya Reichman.</b></div>");
myScroller1.addItem("<div style='text-align:center'><b>The Eruv notice appears below.</b></div>");
myScroller1.addItem("<b>Cater your simcha at the Young Israel of Wavecrest and Bayswater.  See <a href='your.htm'>our rates page</a> for more details.</b>");
myScroller1.addItem("<b>Please give the Shul your Email address so that we can more easily reach you with important information when necessary&nbsp; Send it to&nbsp; <a href='mailto:webmaster@yiwb.org'>webmaster@yiwb.org</a>.</b>");
myScroller1.addItem("<b>Your feedback is valuable to us.&nbsp; Send your comments via <a href='Feedback.htm'>our feedback page</a> or to&nbsp; <a href='mailto:webmaster@yiwb.org'>webmaster@yiwb.org</a>.</b>");

function init() {

  var img;
  var x, y;

  // Locate placeholder image so we can use it to position the scroller.
/*  img = getImage("tempholder");
  x = getImagePageLeft(img);
  y = getImagePageTop(img);

  // Create the scroller and position it.

  myScroller1.moveTo(x, y);
*/
  myScroller1.create();
  myScroller1.hide();
  myScroller1.setzIndex(100);
  myScroller1.show();
}

function getTime(date)
{
	if (!date)
	{	date=new Date();
	}
	return date.toLocaleString();
}

function eruvUNDETERMINEDTable()
{
	document.write('<div style="text-align:center;padding:20px">');
	document.write('<table border="1" width="650" cellpadding="3px">');
	document.write('<tr>');
	document.write('<td style="background-color:#C0C0C0" align="center">');
	document.writeln('<p style="font:bold 25px">Erev Shabbos Parshas <span class="hebrew">'+
	 parsha+'</span> <span>('+thisFriday+')</span></p>')
	document.writeln('<p style="font:bold 25px">As of '+dontWrap(current_time)+'</p>')
	document.write('<p style="font:bold 25px">the status of the Eruv is currently undetermined.</p></td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</div>');
}
function eruvAPPROVEDTable()
{
	document.write('<div style="text-align:center;padding:20px;">');
	document.write('<table border="1" width="650" cellpadding="3px">');
	document.write('<tr>');
	document.write('<td style="background-color:#00FF00" align="center">');
	document.writeln('<p style="font:bold 25px">Erev Shabbos  <span class="hebrew">'+
	 parsha+'</span> <span>('+thisFriday+')</span></p>')
	document.write('<p style="font:bold 25px">As of '+dontWrap(current_time)+', '+dontWrap('the Eruv is')+'</p>');
	document.write('<p style="font:bold 30px">APPROVED</p>');
	document.write('<p style="font:bold 25px">for use this shabbos. Good Shabbos!</p></td>');
	//
	document.write('</tr>');
	document.write('</table>');
	document.write('</div>');}
function eruvNOTAPPROVEDTable()
{
	document.write('<div style="text-align:center;padding:20px;">');
	document.write('<table border="1" width="650" cellpadding="3px">');
	document.write('<tr>');
	document.write('<td style="background-color:#FF9999" align="center">');
	document.writeln('<p style="font:bold 25px">Erev Shabbos Parshas <span class="hebrew">'+
	 parsha+'</span> <span>('+thisFriday+')</span></p>')
	document.write('<p style="font:bold 25px">As of '+dontWrap(current_time)+', '+dontWrap('the Eruv is')+'</p>');
	document.write('<p style="font:bold 30px">NOT APPROVED</p>');
	document.write('<p style="font:bold 25px">for use this Shabbos.</p>');
	document.write('<p style="font:bold 25px">Be sure to check your pockets. Good Shabbos!</p>');
	document.write('</td></tr>');
	document.write('</table>');
	document.write('</div>');
}