function getPilpelPic(whichShow)
{
	/* see if there if another image exists for this show. 
	     If not, put in a default picture */

	var tmpImg = new Image;

	tmpImg.src  = "http://www.iba.org.il/pilpel/images/shum_" + whichShow + "_0.jpg";	
		
	var imgWidth = tmpImg.width;

	if (imgWidth > 0) 
	{
		document.getElementById("imgPilpel").src = tmpImg.src;
	}
}
	
function setToHomePg() 
{ 
  document.getElementById('SpanMakeHomePage').style.behavior='url(#default#homepage)'; 
  document.getElementById('SpanMakeHomePage').setHomePage('http://www.iba.org.il/');
}

function setMainAndRightHeight(setNews)
{
//	Do once the whole page is loaded.  
//	    Netscape does not recognize 'readystate'

	if ( top.document.getElementById("tblMainMenu") == null ||
		 (!ns6 && top.document.readyState != 'complete') )
	{
		setTimeout("setMainAndRightHeight()",500);
	}

	var menuHeight;
	var menuBottom;
	var centerHeight;
	var leftHeight;
	var iframeHeight;
	var max;
	var whichMax = 'left';

	if ( top.document.getElementById("tblMainMenu") != null )
	{
		if ( top.document.getElementById("menuBottom") != null )
		{
//			the variable menuBottom contains the height of an
//			empty td used for lengthening. Initialize it to zero before starting.

			top.document.getElementById("menuBottom").style.height = 0;
			
			menuHeight = top.document.getElementById("tblMainMenu").offsetHeight;
			centerHeight = top.document.getElementById("middleTbl").offsetHeight;
			leftHeight = top.document.getElementById("leftTbl").offsetHeight;
			
			max = leftHeight;
			
			if (menuHeight > max)
			{
			    max = menuHeight;
			    whichMax = 'menu';
			}

			if (centerHeight > max)
			{
			    max = centerHeight;
			    whichMax = 'center';
			}   
			if ( setNews == "true" )
			{
				iframeHeight = top.document.getElementById("mainIframe").height;
				
				if ( iframeHeight < max )
				{
					top.document.getElementById("mainIframe").height = parseInt(iframeHeight) + (max - centerHeight) + 50;
				}
			}
			 
			if ( max > menuHeight )
			{
				if ( ((max - menuHeight )-10) > 0 ) //- 23
				{
					menuHeight = menuHeight 
				}
			    
				try
				{
					top.document.getElementById("menuBottom").style.height = (max - menuHeight)  - 10;
				}
				catch(exception)
				{
				}
			}
			
		}
	}
}

//~~~~~~~~~~~~~~~~~~~~~ FOR SEARCH ~~~~~~~~~~~~~~~~~~~~~~~~~~~
function checkSend(objEvent)
{
	var keyCd = ns6? objEvent.which : objEvent.keyCode;

	if ( keyCd == 13)
	{
		getSearchPg();
	}
}
		
function getSearchPg()
{
    var searchTxt = document.getElementById("txtFind").value;	
    		
	if ( searchTxt != '' )
	{
		top.document.getElementById("mainIframe").src='index.asp?classTo=ReshutSearch&searchTxt=' + searchTxt;	
	}
}
//~~~~~~~~~~~~~~~~~~~~~ END FOR SEARCH ~~~~~~~~~~~~~~~~~~~~~~~~~~~

function setMenuLang(whichLang)
{
	if ( whichLang == currentMenuLang )
	{
		return;
	}
	
	var newlangObj = document.getElementsByName(whichLang);
	var lastLangObj = document.getElementsByName(currentMenuLang);
	var indxLang;
	
	document.getElementById(whichLang + "Lnk").className = "langRollover";
	document.getElementById(whichLang + "Lnk").onmouseout = '';

	if ( currentMenuLang != "" )
	{
		document.getElementById(currentMenuLang + "Lnk").className = "langRegular";
		document.getElementById(currentMenuLang + "Lnk").onmouseout = setLangRollover;
	}

	currentMenuLang = whichLang;

	if (isBlinking == 1)
	{
		stopBlinkTxt("liveTV");
	}

	for (indxLang = 0; indxLang < newlangObj.length; indxLang++)
	{
		// show the new language in the menu.
		newlangObj[indxLang].style.display = '';
		
		// if this language was showing already then hide it.
		if ( lastLangObj.length > 0 )
		{
			lastLangObj[indxLang].style.display = 'none';
		}
	}

	if (isBlinking == 1)
	{
		startTvLiveBlink();
	}
}

function startTvLiveBlink()
{
	blinkTxt("liveTV",600);		
}
function setLangRollover()
{
	this.className = "langRegular";
}

function dropDownAction(whichOne)
{
	if (document.getElementById('tblDrop' + whichOne).style.display == "none")
	{
	//	It was hidden - so now show it.
		document.getElementById('btnDrop' + whichOne).src = "ReshutHashidur/images/btnMinus.gif";
		document.getElementById('btnDrop' + whichOne).title = "Click to Close - קליק לסגור";
		document.getElementById('btnDrop' + whichOne).alt = "Click to Close - קליק לסגור";
		document.getElementById('tblDrop' + whichOne).style.display = "";
	}
	else
	{
	//	It was showing - so now hide it.
		document.getElementById('btnDrop' + whichOne).src = "ReshutHashidur/images/btnPlus.gif";
		document.getElementById('btnDrop' + whichOne).title = "Click to Open - קליק לפתוח";
		document.getElementById('btnDrop' + whichOne).alt = "Click to Open - קליק לפתוח";
		document.getElementById('tblDrop' + whichOne).style.display = "none";
	}
}

function setEdition()
{
//  set the default Reshet Bet Edition based on the time.

	var mahaduraTtls = document.getElementsByName("titleMahadura");
	var mahaduraUrls = document.getElementsByName("urlMahadura");
	var indx;
	var programCd;

	var c = ":00";
	d = new Date();
					
	var myMin = d.getMinutes();
	var myHours = d.getHours();
							
	if (myHours == 0) myHours = 24;
							
	if ( myMin < 9 )
	{
		myHours--;
		if (myHours == 0) myHours = 24;
	}

	var MyTime = myHours + c;

	var sNameTxt = "";
													
	for ( indx=0; indx < mahaduraTtls.length; indx++)	  
	{
		sNameTxt = mahaduraTtls[indx].value;
															
		if ( sNameTxt.search(MyTime) != -1 )
		{
			document.getElementById("lblMahaduraTimeHeb").innerHTML = MyTime;
			document.getElementById("lblMahaduraTimeEng").innerHTML = MyTime;
		    mahaduraUrl = mahaduraUrls[indx].value;
			break;
		}
	}
}

//~~~~~~~~~~~~~~~~~~~~~ FOR WEATHER COMBO ~~~~~~~~~~~~~~~~~~~~~~~~~~~
function closeOpenCombo()
{
	if (comboOpen != '')
	{
//		It was open so now close it.
		closeCombo(comboOpen);
	}
}

function SelectBoxAction(whichOne)
{
	closeOpenCombo();

	if (whichOne == comboOpen)
	{
	//	not interested in opening a new one. Just wanted to close;
		comboOpen = '';
		return;
	}
	
//	Open the new one.

	document.getElementById("tr" + whichOne).style.display='';
	document.getElementById("arrow" + whichOne).src = "ReshutHashidur/images/ComboUp.gif";
	
	var selectedRow = document.getElementById("hid"+whichOne).value;
	
	if ( selectedRow != 0 && !ns6 )
	{
	    document.getElementById("td" + whichOne + selectedRow).focus();
	}
    
	comboOpen = whichOne;
}

function changeTemp(whichOne)
{
	//var whichOne = document.getElementById("selectIsraelTemp").value;
			
	document.getElementById("minIsraelTemp").innerHTML = minIsraelArry[whichOne];
	document.getElementById("maxIsraelTemp").innerHTML = maxIsraelArry[whichOne];
	document.getElementById("IsraelTempIcon").src = iconIsraelArry[whichOne];
}
	

function closeCombo(whichOne)
{
	document.getElementById("tr" + whichOne).style.display='none';
	document.getElementById("arrow" + whichOne).src = "ReshutHashidur/images/ComboDown.gif";
}

function fillSelectBox(whichOne,choiceNum)
{
	var newTxt = document.getElementById("td"+whichOne+choiceNum).innerHTML;
	var newHid = document.getElementById("tdHid"+whichOne+choiceNum).value;
	
	document.getElementById("cbo" + whichOne).innerHTML = newTxt;

	var last = document.getElementById("hid"+whichOne).value;		

//	highlight the row of the one that is currently in the select box.	
	if (choiceNum != 0)
	{
		document.getElementById("td" + whichOne + choiceNum).className = "selected";
	}

//	unselect the previous one
	
	if ( (last != choiceNum) && (last != 0) )
	{
		document.getElementById("td" + whichOne + last).className = "unhighlighted";	
	}

    if (last != 0)
    {
		changeTemp(newHid);
	}

	SelectBoxAction(whichOne);
	document.getElementById("hid" + whichOne).value = newHid;
}

function setHighlight(whichOne,choiceNum)
{
	var current = document.getElementById("current"+whichOne).value;
	var newID = "td" + whichOne + choiceNum;
	var oldID = "td" + whichOne + current;

	// set the new one
	switch (document.getElementById(newID).className)
	{
		case "selectedHighLight":
		case "selected":
			document.getElementById(newID).className = "selectedHighLight";
			break;
		default :
			document.getElementById(newID).className = "highlighted";
	}	

	// reset the last one
	if ( current != 0 )		
	{
		switch (document.getElementById(oldID).className)
		{
			case "selectedHighLight":
			case "selected":
			    document.getElementById(oldID).className = "selected";
				break;
			default :
			    document.getElementById(oldID).className = "unhighlighted";
		}	
	}

	document.getElementById("current"+whichOne).value = choiceNum;
}
//~~~~~~~~~~~~~~~~~~~~~ END FOR WEATHER COMBO ~~~~~~~~~~~~~~~~~~~~~~~~~~~
