// Functions serves downside menu in some files

function swapText(num)
{
	document.getElementById("textImage").src="../../../holidays/chanuka/images/on_14_"+num+".gif";
}

function swapTextRestore()
{
	document.getElementById("textImage").src="../../../holidays/chanuka/images/sipur_off_14.gif";
}

function swapTextCandles(num)
{
	document.getElementById("textImage").src="../../../holidays/chanuka/images/13_on_"+num+".gif";
}

function swapTextRestoreCandles()
{
	document.getElementById("textImage").src="../../../holidays/chanuka/images/sipur_off_14.gif";
}

//Shows answer in dynamic div 

function showAnswerDiv(divname, divtext)
{
	var temp="";
	temp+="<table cellspacing=0 cellpadding=0 border=0>";
	temp+="<tr><td><img src='../../../../holidays/chanuka/images/frame_01.gif'></td></tr><tr><td style='background-image:url(../../../../holidays/chanuka/images/frame_03.gif)' width=450><div  class='txtBody' dir=rtl style='margin-left: 15px;margin-right: 15px'>";
	temp+=divtext;
	temp+="</div></td></tr><tr><td><img src='../../../../holidays/chanuka/images/frame_04.gif'></td></tr></table>";

	document.getElementById(divname).innerHTML=temp;

}

//Open a new window        //Don't forget to set location!
function popupWindow(link,winWidth,winHeight,location_flag)
{
	var x=0;
	var y=0;

	if(location_flag=="center")
		{
			x=screen.width/2-winWidth/2;
			y=screen.height/2-winHeight/2;
		}

		win=window.open (link ,"an", "toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=no,height="			+winHeight+",width="+winWidth+",left="+x+",top="+y);
		win.focus()
}

//Open a new window with the specified picture
function showPicture(imgSrc,w,h)
{
	x=(screen.width/2-w/2<0)?0:screen.width/2-w; 
	y=(screen.height/2-h/2<0)?0:screen.height/2-h/2; 
	
	newWindow=window.open('', '', "width="+w+", height="+h+", left="+x+", top="+y);
	newDocument=newWindow.document;
	string='<img src="'+imgSrc+'">\n';
	newDocument.write(string);
	newDocument.close();
}

//Expand the submenu
function menuExpand(container){
	//container is a reference to the containing block element of the sub menu
	container.getElementsByTagName("div").item(0).className = "menuDrop";
	container.getElementsByTagName("div").item(1).className = "subMenuDrop";
	
}
//Collapse the submenu
function menuCollapse(container){
//container is a reference to the containing block element of the sub menu
	container.getElementsByTagName("div").item(0).className = "menuNormal";
	container.getElementsByTagName("div").item(1).className = "subMenuNormal";
}
//switch between collapsed and expanded menus
function menuSwitch(container){
	var x = container.getElementsByTagName("div").item(0).className;
	
	if (x == "menuNormal")
		menuExpand(container);
	if(x == "menuDrop")
		menuCollapse(container);
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
