﻿function dw(s) {
	document.write(s);
}

function imgOver(sender, event) {
	var imgURL = sender.src;
	if (typeof(event)=='undefined') event = window.event;
	var newSrc, i = imgURL.lastIndexOf("."), imgExt = imgURL.substr(i);	
	if(imgURL.indexOf("mo.")>0)
		newSrc = imgURL.substr(0, imgURL.length - 2 - imgExt.length);
	else
		newSrc = imgURL.substr(0, imgURL.length - imgExt.length);
	if(event.type=="mouseover") newSrc += "mo";
	imgURL = newSrc + imgExt;
	sender.src = imgURL;
	imgURL = null; newSrc = null; i = null; imgExt = null;
}

function writeHeader() {
	var arr = ["/midrash/Emidrash.aspx","/midrash/Esifria.asp","/ask/eng/","/toraneto/eng/","https://www.yeshiva.org.il/reg/en"]
	for(i=3;i<8;i++) {
		if(arr[i-3].charAt(0)=="/"){arr[i-3]="http://www.yeshiva.org.il"+arr[i-3]}
		dw("<a href='"+arr[i-3]+"'><img src='/Eheader/"+i+".jpg' onmouseover='imgOver(this,event)' onmouseout='imgOver(this,event)'></a>");
	}
}
function writeBar() {
	var arr = [["/Eindex.aspx","HomePage"],["/calendar/eng/","Jewish Calendar"],["https://www.yeshiva.org.il/dedication/Edefault.asp","Dedications"],["/message/Eservices.asp?service=2","Times by SMS"],["/ask/eng/Escroller.asp?what=time","For Your Site"],["/message/Eservices.asp?service=1","Services"],["/about/eng/","About"],["/general/EWriteUs.aspx","Write Us"],["/message/Eservices.asp?service=5","<img src='/pic/rss.gif'>"]]
	dw("<ul>");
	for(i=0;i<arr.length;i++) {
		if(arr[i][0].charAt(0)=="/"){arr[i][0]="http://www.yeshiva.org.il"+arr[i][0]}
		if (arr[i][1] == "Write Us")
		{
			dw("<li><a href='"+arr[i][0]+"' target='_blank'>"+arr[i][1]+"</a></li>");
		}
		else
			dw("<li><a href='"+arr[i][0]+"'>"+arr[i][1]+"</a></li>");
	}
	dw("</ul>");
}

function writeUs() {
	window.open('/message/Esend.asp','','scrollbars=1,resizable=1,width=345,height=410')
}
function open_video(id) {
	link='/midrash/video/Edefault.asp?id='+id;
	window.open(link,'','width=800,height=610')
}
function open_audio(id) {
	window.open('/midrash/video/Edefault.asp?aid='+id,'','width=800,height=610');
}
function openRabbi(rav_id) {
	window.open('/midrash/about_rav.asp?id='+rav_id+'&lan=eng','','width=300,height=400')
}

var adLoaded=false;var reload=false;