if (document.images) 
{
//  Activate images
	
	img1on = new Image();      
    img1on.src = "KolHamuzika/images/Kol_HelpH.gif";
    img1off = new Image();      
    img1off.src = "KolHamuzika/images/Kol_Help.gif";

	img2on = new Image();      
    img2on.src = "KolHamuzika/images/Kol_MenuHover_01.gif";
    img2off = new Image();      
    img2off.src = "KolHamuzika/images/Kol_Menu_01.gif";

	img3on = new Image();      
    img3on.src = "KolHamuzika/images/Kol_MenuHover_02.gif";
    img3off = new Image();      
    img3off.src = "KolHamuzika/images/Kol_Menu_02.gif";

	img4on = new Image();      
    img4on.src = "KolHamuzika/images/Kol_MenuHover_03.gif";
    img4off = new Image();      
    img4off.src = "KolHamuzika/images/Kol_Menu_03.gif";

	img5on = new Image();      
    img5on.src = "KolHamuzika/images/Kol_MenuHover_04.gif";
    img5off = new Image();      
    img5off.src = "KolHamuzika/images/Kol_Menu_04.gif";

	img6on = new Image();      
    img6on.src = "KolHamuzika/images/Kol_MenuHover_05.gif";
    img6off = new Image();      
    img6off.src = "KolHamuzika/images/Kol_Menu_05.gif";

	img7on = new Image();      
    img7on.src = "KolHamuzika/images/Kol_MenuHover_06.gif";
    img7off = new Image();      
    img7off.src = "KolHamuzika/images/Kol_Menu_06.gif";

	img8on = new Image();      
    img8on.src = "KolHamuzika/images/Kol_MenuHover_07.gif";
    img8off = new Image();      
    img8off.src = "KolHamuzika/images/Kol_Menu_07.gif";
}       

// Function to 'activate' images

function imgOn(imgName) 
{
    if (top.document.images) 
    {
        top.document[imgName].src = eval(imgName + "on.src");
    }
}

function imgOff(imgName) 
{
    if (top.document.images) 
    {
        top.document[imgName].src = eval(imgName + "off.src");
    }
}

function homeLnk(display)
{
	top.document.getElementById('homeLnk').style.display = display;
}

// Function to 'deactivate' images.


function setCurrentPage(newPage)
{
//	deactivate the last page on the menu.

    if ( top.currentPage != '' )
    {
		top.document.getElementById(top.currentPage).style.display="none";
		top.document.getElementById("lnk"+top.currentPage).style.display="";
	}

	if ( newPage != '' )
	{
//		activate the menu to show the current Page.
		top.document.getElementById("lnk"+newPage).style.display="none";
		top.document.getElementById(newPage).style.display="";
	}

	top.currentPage =  newPage;
}

function adjustPath(currentPg)
{
	if ( currentPg == 'homePg' )
	{
		top.document.getElementById("homePgLnk").style.display='none';
		top.document.getElementById("homePg").style.display='';
	}
	else
	{
		top.document.getElementById("homePgLnk").style.display='';
		top.document.getElementById("homePg").style.display='none';
	}
	
	indexLnk = top.document.getElementById('homePgLnk');
	
	while (indexLnk.nextSibling)
    {
		indexLnk = indexLnk.nextSibling;
		if (indexLnk.id == currentPg)
		{
			indexLnk.style.display='';
		}
		else
		{
			indexLnk.style.display='none';
		}
	}
	
}

function setRightMenuHeight()
{
//	Do once the whole page is loaded.  
//	    Netscape does not recognize 'readystate'

	if ( top.document.getElementById("tblMainMenu") == null ||
		 (!ns6 && top.document.readyState != 'complete') )
	{
		setTimeout("setRightMenuHeight()",500);
	}

	var menuHeight;
	var menuBottom;
	var iFrameHeight;

	if ( top.document.getElementById("tblMainMenu") != null )
	{
		if ( top.document.getElementById("menuBottom") != null )
		{
//			the variable menuBottom contains the height of the 
//			bottommost td. Initialize it to zero before starting.

			top.document.getElementById("menuBottom").style.height = 0;
			
			menuHeight = top.document.getElementById("tblMainMenu").offsetHeight;
			iFrameHeight = top.document.getElementById("mainIframe").height;
			
			if ( iFrameHeight > menuHeight )
			{
				top.document.getElementById("menuBottom").style.height = iFrameHeight - menuHeight + 16;
			}
		}
	}
}

function checkSend(objEvent)
{
	var keyCd = ns6? objEvent.which : objEvent.keyCode;

	if ( keyCd == 13)
	{
		getSearchPg();
	}
}
		
function getSearchPg()
{
	//var searchTxt = escape(document.getElementById("txtFind").value);
    var searchTxt = document.getElementById("txtFind").value;	
    		
	if ( searchTxt != '' )
	{
		top.document.getElementById("mainIframe").src='index.asp?classTo=KolSearchResults&searchTxt=' + searchTxt;	
	}
}

function setMainHeight()
{
//	only reset the height of the mainIframe, 
//	if the innerIframe is not smaller than the mainIframe.
	
	var innerHeight = window.parent.frames["innerIframe"].document.getElementById('tblMain').offsetHeight;
    var mainHeight = top.frames["mainIframe"].document.getElementById('tblMain').offsetHeight;

    if ( innerHeight >= mainHeight )
	{
		setHeight('mainIframe','tblMain','false');
	}
}

function loadMaamar(whichMaamar)
{
	if ( !document.getElementById("innerIframe") )
	{	
		setTimeout("loadMaamar(" + whichMaamar + ")",10);
		return false;
	}
		
	frameLinkTo('innerIframe','KolMaamarimC',whichMaamar);

	if ( totalMaamarim == 0 )
	{
		document.getElementById("maamarimTable").style.display='none';
	}
	else
	{
		if ( currentMaamar != whichMaamar )
		{
	//		restore the last maamar to the list.
			if ( document.getElementById("TR"+currentMaamar) )
			{
				document.getElementById("TR"+currentMaamar).style.display='';
			}
		}

	//  remove the new maamar from the list.
		if ( document.getElementById("TR"+whichMaamar) )
		{
			document.getElementById("TR"+whichMaamar).style.display='none';
		}
		currentMaamar = whichMaamar;

	//	set the height of the div of the previous maamarim list.
		setDivHeight("maamarimDiv","maamarimInnerTbl",200);
	}
}				

function setWorker()
{
	var newWorkerId = document.getElementById("selectWorker").value;
	
//	hide the last worker's information.
	document.getElementById("TRinfo"+currentWorker).style.display='none';
	
//	show the new worker's information.
	document.getElementById("lblWorkerName").innerHTML = document.getElementById("lblName"+newWorkerId).value;
	document.getElementById("TRinfo"+newWorkerId).style.display='';
	
//	change the picture.
	
	document["staffPic"].src = PicArray[newWorkerId].src;	

	currentWorker = document.getElementById("selectWorker").value;
}

var fadingStatus = 0;

function changeProgram(whichProg)
{
	if ( whichProg != '' )
	{
		if ( whichProg != currentProg )
		{
	//		fade away the last program info and its picture.

			if ( ns6 )
			{
				fadingStatus = 1;
				NetscapeFadeOut("mainDiv",1);
				NetscapeFadeOut("programPic",1);
			}
			else
			{
				fadeOut("mainDiv");
				fadeOut("programPic");
			}
		}
	//	switch the contents of the mainDiv and the picture.
		document.getElementById("mainDiv").innerHTML = document.getElementById("divInfo"+whichProg).innerHTML;
		document.getElementById("programPic").src = PicArray[whichProg].src;

	//	fade in the new information and picture.

		if ( ns6 )
		{
			NetscapeFadeIn("mainDiv",0);
			NetscapeFadeIn("programPic",0);
		}
		else
		{
			fadeIn("mainDiv");
			fadeIn("programPic");
		}

		currentProg = whichProg;
	}
}		

function fadeOut(elementName)
{
	var whichElement = document.getElementById(elementName);

	whichElement.style.filter="blendTrans(duration=2)";
    
	// Make sure the filter is not playing.
	if (whichElement.filters.blendTrans.status != 2) 
	{
	    whichElement.filters.blendTrans.apply();
	    whichElement.style.visibility="hidden";
	    whichElement.filters.blendTrans.play();
	}
}

function NetscapeFadeOut(elementName,opacity)
{
	var whichElement = document.getElementById(elementName);
	
	if ( whichElement.style.MozOpacity >= 0 )
	{
		var newOpacity = opacity-0.3;
				
		whichElement.style.MozOpacity = newOpacity;
		fadingOutTimer=setTimeout("NetscapeFadeOut('"+elementName+"',"+newOpacity+")",10);
	}
	fadingStatus = 0;
	clearTimeout(fadingOutTimer);
}
		
function fadeIn(elementName)
{
	whichElement = document.getElementById(elementName);

    whichElement.style.filter="blendTrans(duration=2)";

    // Make sure the filter is not playing.
    if (whichElement.filters.blendTrans.status != 2) 
    {
        whichElement.filters.blendTrans.apply();
        whichElement.style.visibility="visible";
        whichElement.filters.blendTrans.play();
    }
	else 
	{
		fadeInNow=setTimeout("fadeIn('"+elementName+"')",100);
	}
}

function NetscapeFadeIn(elementName,opacity)
{
	var whichElement = document.getElementById(elementName);
	
	if ( fadingStatus == 0 )
	{
		if ( whichElement.style.MozOpacity <= 1 )
		{
			var newOpacity = opacity+0.2;
					
			whichElement.style.MozOpacity = newOpacity;
			fadingInTimer=setTimeout("NetscapeFadeIn('"+elementName+"',"+newOpacity+")",10);
		}
	}
	else 
	{
		fadeInNow=setTimeout("NetscapeFadeIn('"+elementName+"',"+opacity+")",100);
	}
}

var slidingStatus = 0;
var switchedContents = 0;

function changeProductionDiv(whichDiv)
{
	if ( whichDiv != '' )
	{
		if ( (whichDiv != currentDiv) && (currentDiv != '') )
		{
//			fade away the last div.

			switchedContents = 0;
			fadingStatus = 1;

			if ( ns6 )
			{
				NetscapeFadeOut("mainDiv",1);
			}
			else
			{
				fadeOut("mainDiv");
			}
		}

		switchContents(whichDiv);

		slideRight("mainDiv");

		currentDiv = whichDiv;
	}
}

function slideLeft(elementName)
{
	var whichElement = document.getElementById(elementName);

	if ( parseInt(whichElement.style.left) >= (0-parseInt(whichElement.style.width)-5) )
	{
		whichElement.style.left = parseInt(whichElement.style.left) - 1;
		slideTimer = setTimeout("slideLeft('"+elementName+"')",3);
	}
	else 
	{
		slidingStatus = 0;
	}
}

function switchContents(whichDiv)
{
	var whichElement = document.getElementById("mainDiv");

	if ( !ns6 )
	{
	    whichElement.style.filter="blendTrans(duration=2)";
	    if ( whichElement.filters.blendTrans.status == 0 )
	    {
			fadingStatus = 0;
	    }
	}
	
//	Only switch the contents of the mainDiv if not currently fading.

	if ( fadingStatus == 0 )
	{
		whichElement.innerHTML = document.getElementById("divInfo"+whichDiv).innerHTML;
		switchedContents = 1;

//		if it was faded then set the div all the way to the left, so
//		that it could be slid in again, and set to visible again.		

		if (whichElement.style.visibility == 'hidden' || whichElement.style.MozOpacity < 1)
		{
			whichElement.style.left = -335;
			whichElement.style.visibility = 'visible';
		}
	}
	else 
	{
		switchNow=setTimeout("switchContents('"+whichDiv+"')",100);
	}
}

function slideRight(elementName)
{
//  check that the contents were switched already.

	if ( switchedContents == 1 ) 
	{
		var whichElement = document.getElementById(elementName);

		if ( parseInt(whichElement.style.left) <= 0 )
		{
			whichElement.style.left = parseInt(whichElement.style.left) + 1;
			slideTimer = setTimeout("slideRight('"+elementName+"')",10);
		}
	}
	else 
	{
		slideInNow=setTimeout("slideRight('"+elementName+"')",100);
	}
}