	var ns6 = (!document.all && document.getElementById);

	function writeFrame(frame,output)
	{
		if ( !top.frames[frame] )
		{
			setTimeout("writeFrame('" + frame + "','" + output + "')",10);
			return false;
		}
		top.frames[frame].document.location.replace(output);

/*
		try
		{
			clearTimeout(tt);
			top.frames[frame].document.location.replace(output);
		}
		catch (Exception)
		{
			tt=setTimeout("writeFrame('" + frame + "','" + output + "')",10);
		}	
*/
	}

	function LinkTo(classto,entity_code)
	//the function replace the center page by param - classto
	{
		site_code = top.document.getElementById('site_code').value;
		document.location.href='index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code;
	//	document.location.replace('index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code);
		setScroolUp();
	}

	function LinkToNoScroll(classto,entity_code)
	//the function replace the center page by param - classto
	{
		site_code = top.document.getElementById('site_code').value;
		document.location.href='index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code;
       
       window.parent.scrollTo(0,170);	
	}

	function frameLinkTo(whichFrame,classto,entity_code)
	//this function replaces a frame by param - classto
	{
		var pathFrame = '';

		if ( top.document.getElementById(whichFrame) )
		{
			pathFrame = top.document.getElementById(whichFrame);
		}

		else if ( document.getElementById(whichFrame) )
		{
			pathFrame = document.getElementById(whichFrame);
		}
		
		else
		{
			return;
		}

		pathFrame.src = 'index.asp?classto='+classto+'&entity_code='+entity_code;
	//	document.location.replace('index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code);
		setScroolUp();
	}

	function frameLinkToNoScroll(whichFrame,classto,entity_code)
	//this function replaces a frame by param - classto
	{
		var pathFrame = '';

		if ( top.document.getElementById(whichFrame) )
		{
			pathFrame = top.document.getElementById(whichFrame);
		}

		else if ( document.getElementById(whichFrame) )
		{
			pathFrame = document.getElementById(whichFrame);
		}
		
		else
		{
			return;
		}

		pathFrame.src = 'index.asp?classto='+classto+'&entity_code='+entity_code;
		window.parent.scrollTo(0,170);
	}

	function frameLinkGeneralParam(whichFrame,classParam,paramStr)
	{	
		var pathFrame = '';

		if ( top.document.getElementById(whichFrame) )
		{
			pathFrame = top.document.getElementById(whichFrame);
		}

		else if ( document.getElementById(whichFrame) )
		{
			pathFrame = document.getElementById(whichFrame);
		}
		
		else
		{
			return;
		}

	    pathFrame.src = 'index.asp?classto=' + classParam + '&' + paramStr;
	}

	function LinkToFromSite(siteFrom, classto, entity_code)
	//this function opens a class the given site.
	{
	    var site_code;
		var pathFrame = '';

		site_code = siteFrom;

		if ( top.document.getElementById("mainIframe") )
		{
			pathFrame = top.frames["mainIframe"].document;
		}

		else if ( document.getElementById("mainIframe") )
		{
			pathFrame = window.frames["mainIframe"].document;
		}
		
		else
		{
			return;
		}

//		top.document.getElementById("mainIframe").src='index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code;
		pathFrame.location.replace('index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code);
//		writeFrame("mainIframe",'index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code);
		setScroolUp();
	}

	function LinkToInPopup(siteFrom, entity_code)
	//this function opens a popup window for the given site.
	{
		site_code = siteFrom;
	//	NewWindowScroll('index.asp?classto='+classto+'&entity_code='+entity_code+'&site_code='+site_code,650,400,'yes');
		NewWindowScroll('index.asp?classto=PopUpEntity&entity_code='+entity_code+'&site_code='+site_code,650,400,'yes');
	}

	function site_LinkToPopUp(site_code_To,entity_code)
	{
	//	this function loads the maamarim articles in a popUp window.
		NewWindowScroll('index.asp?classto='+site_code_To+'&entity_code='+entity_code+'&maamar=true',650,400,'yes');
	}	

	function site_bydate_left( classto, set_date)
	{
//		top.document.getElementById("leftIframe").src='index.asp?classto='+classto+'&set_date='+set_date;
		top.frames["leftIframe"].document.location.replace('index.asp?classto='+classto+'&set_date='+set_date);
//		writeFrame("leftIframe",'index.asp?classto='+classto+'&set_date='+set_date);
	}	
	
	function site_bydate_center( classto, set_date)
	{
		top.frames["mainIframe"].document.location.replace('index.asp?classto='+classto+'&set_date='+set_date);
	}	

	function site_bydate_centerHREF( whichFrame, classto, set_date)
	{
		var pathFrame = '';

		if ( top.document.getElementById(whichFrame) )
		{
			pathFrame = top.document.getElementById(whichFrame);
		}

		else if ( document.getElementById(whichFrame) )
		{
			pathFrame = document.getElementById(whichFrame);
		}
		
		else
		{
			return;
		}

		pathFrame.src='index.asp?classto='+classto+'&set_date='+set_date;
	}	

	function site_bySpecialFrame(frame,classto,searchTxt)
	{
		var parameterString = classto;
		
		if ( searchTxt > '' )
		{
			parameterString = parameterString + '&searchTxt=' + escape(searchTxt);
		}
		
		//top.document.getElementById(frame).src='index.asp?classto='+parameterString;
		top.frames[frame].document.location.replace('index.asp?classto='+parameterString);
//		writeFrame(frame,'index.asp?classto='+parameterString);
	}
	
	function site_LinkTo(site_code_From,site_code_To,entity_code)
	{
	//	this function loads the maamarim articles.
	
	//	if the article's site is the same as the current site, only replace
	//	the center frame.  Otherwise reload the whole thing.
	
		if(site_code_From == site_code_To)
		{
			top.document.getElementById("mainIframe").src='index.asp?classto=ArticleInner&entity_code='+entity_code;
		//	top.frames["mainIframe"].document.location.replace('index.asp?classto=ArticleInner&entity_code='+entity_code);
		}
		else
		{
			top.location.href='index.asp?classto='+site_code_To+'&entity_code='+entity_code+'&maamar=true';
		}	
	}	
	
	function Link_LeftToCenter(entity_code,entity_type_code)
	//the fuction replace the center page from the left
	{
	//	top.document.getElementById("mainIframe").src='index.asp?classto=WeekInner&entity_code='+entity_code+'&entity_type_code='+entity_type_code
		top.frames["mainIframe"].document.location.replace('index.asp?classto=WeekInner&entity_code='+entity_code+'&entity_type_code='+entity_type_code);
	}


	function ReplacePic(entity_code,PicOperator,PicMax)
	{
		//the function replace the pic src (<>)
		//PicOperator - > Right(+) or left(-)	

		ImgName = document.getElementById('IMG' + entity_code)
		PicIndex = ImgName.PicIndex;
		if(PicOperator == 'right')
		{
			if (PicMax > PicIndex)
			{
				PicIndex++;
			}
		}
		else
		{
			if (PicIndex > 1)
			{
				PicIndex--;
			}	
		}	
	//------  alt  ----------------------
		ImgName.src = EntityPicArray[entity_code][PicIndex][0].src;
		ImgName.alt = Convert_Unicode(EntityPicArray[entity_code][PicIndex][2]);
	
	//--- if this is a vml picture then switch the title of the v:rect 
	
		try
		{
			document.getElementById('RECT' + entity_code).title = Convert_Unicode(EntityPicArray[entity_code][PicIndex][2]);
		}
		catch (exception)
		{
		}
		
	//------  PicIndex  ----------------	
		ImgName.PicIndex = PicIndex;
	
	//------  ImgDesc  ----------------
		
		ImgDesc = document.getElementById('TDdesc' + entity_code);
		//ImgDesc.innerHTML = "<FONT color=#999999 size=2>" + EntityPicArray[entity_code][PicIndex][1] + "</FONT>";
		ImgDesc.innerHTML = EntityPicArray[entity_code][PicIndex][1];
	}

	function unicodeDelimited(tempstr)
	{
		var chrIndx;
		var str = '';
		
		for (chrIndx=0; chrIndx < tempstr.length; chrIndx++)
		{
			str = str + "@" + tempstr.charCodeAt(chrIndx) + ";" ;
		}
		
		return str;
	}
	
	function Convert_Unicode(str)
	{
	tempStr = '';
	j=str.indexOf('&#');		
	if(j>=0)
		{
		while(j>=0)
			{
			tempStr = tempStr + str.substring(0,j) + String.fromCharCode(str.substring(j+2,j+6));
			str = str.substring(j+7,str.length);
			j=str.indexOf('&#');
			}
		str = tempStr;
		}
	if(str.indexOf('<br>')>0)	
		{
		str = del_br(str);
		}
	return str;	
	}

	//  <br>  פונקציה המעלימה
	function del_br(str)
	{
		
		j=str.indexOf('<br>');	
		if(j>0)
			{
			iLen = str.length;
			tempStr = '';
			while(j>0)
				{
				j=str.indexOf('<br>');
				str = str.replace("<br>","");
				if(j>0) 
					tempStr = tempStr + str.substring(0,j-4);
				str = str.substring(j-4,iLen);
				}
			str = tempStr + str;
			}
		return str;	
	}
	
	function setScroolUp()
	{
	  window.parent.scrollTo(0,0);
	} 	

	function slowScrollTo(speed,currentScreenY,elementHeight)
	{
		var screenHeight = ns6? top.innerHeight : top.document.body.clientHeight;

		if ( (screenHeight-currentScreenY) < elementHeight )
		{
		    performScroll(0,speed,elementHeight);
		}
	}           

	function performScroll(step,speed,limit)
	{
		var temp;
		if ( step <= limit )
		{
		    top.scrollBy(0,speed);
		    temp = (step + speed)*1;
		    setTimeout("performScroll("+temp+","+speed+","+limit+")",10);
		}
	}           

	function slowScrollUp(step,speed,limit)
	{
	//	this function scrolls BACKWARDS, the speed MUST be a negative number!
	
		var temp;
		if ( step >= limit )
		{
		    top.scrollBy(0,speed);
		    temp = (step + speed)*1;
		    setTimeout("slowScrollUp("+temp+","+speed+","+limit+")",10);
		}
	}           

	function ShowMedia(entity_code,MediaKind)
	{
	
	//	This function opens the media Window for a specific url.
	//	Open and play right away!
	
	   //str =  MediasArray[entity_code][MediaKind][0]
	   //window.open(MediasArray[entity_code][MediaKind][0]);
	   //window.location.href = MediasArray[entity_code][MediaKind][0];
		
	   //The url must come as ONE parameter string.  An & would break it up.	
		
		var mediaUrl = replaceStr(replaceStr(MediasArray[entity_code][MediaKind][0],"&amp;","ANDSIGN"),"&","ANDSIGN");

		strLink = 'index.asp?classto=10&site_code=' + top.document.getElementById("site_code").value + '&mediaUrl=' + mediaUrl + '&entity_code=' + entity_code;
		
		mediaWindow(strLink)
	}
	
	function playMediaForSite(type,mediaUrl)
	{
	
	//	This function opens the media Window for a specific url.
	//	Open and play right away! Use the site that's hidden in the page.
	
	//  The url must come as ONE parameter string.  An & would break it up.	
		
		var mediaUrl = replaceStr(replaceStr(mediaUrl,"&amp;","ANDSIGN"),"&","ANDSIGN");
		var thisSite = top.document.getElementById("site_code").value;
		
		strLink = 'index.asp?classto=10';
		
		if ( type != '' )
		{
			strLink += '&type=' + type;
		}

		strLink += '&site_code=' + thisSite + '&mediaUrl=' + mediaUrl;
		
		mediaWindow(strLink)
	}

	function MediaWithParams(type,site_code,entity_code,urlStr)
	{
	
	//	This function opens the media Window for a specific url.
	//	Open and play right away!
	
	//	The url must come as ONE parameter string.  An & would break it up.	
		
		strLink = 'index.asp?classto=10';
		
		if ( type != '' )
		{
			strLink += '&type=' + type;
		}

		if ( site_code != 0 )
		{
			strLink += '&site_code=' + site_code;
		}

		if ( entity_code != 0 )
		{
			strLink += '&entity_code=' + entity_code;
		}

		if ( urlStr != '' )
		{
			var mediaUrl = replaceStr(replaceStr(urlStr,"&amp;","ANDSIGN"),"&","ANDSIGN");
			strLink += '&mediaUrl=' + mediaUrl;
		}
		
		mediaWindow(strLink)
       
	}

	function MediaLiveRadioForSite(site_code)
	{
	
	//	This function calls the media Window for a specific site.
	//	The media window gets the url for this site, and plays right away!
	
		strLink = 'index.asp?classto=10&getLive=' + site_code;
		
		mediaWindow(strLink)
       
	}

	function MediaLiveRadio(urlStr,whichDesc)
	{
	
	//	This function opens the media Window for a specific url.
	//	Open and play right away!
	
	//	The url must come as ONE parameter string.  An & would break it up.	
		
		strLink = 'index.asp?classto=10&type=radioLive';
		
		if ( urlStr != '' )
		{
			var mediaUrl = replaceStr(replaceStr(urlStr,"&amp;","ANDSIGN"),"&","ANDSIGN");
			strLink += '&mediaUrl=' + mediaUrl;
		}
		
		if ( whichDesc != '' )
		{
			var sitedesc = replaceStr(whichDesc,"<br>","*br*");
			strLink += '&site_desc=' + sitedesc;
		}

		mediaWindow(strLink)
       
	}

	function openMediaFromHtml()
	{
	
	//	This function opens the media Window from an html file.

		// mediaWindow('../../index.asp?classto=10')
		mediaWindow('index.asp?classto=10')
	}

	function OpenWin_Media(entity_code)
	{
	//	This function opens the media Window for a specific site.

		strLink = 'index.asp?classto=10&site_code='+top.document.getElementById("site_code").value;
		if (entity_code != 0)
		{
			strLink += '&entity_code=' + entity_code;
		}
		mediaWindow(strLink)
	}

	function mediaWindow(strWindowAddrss)
	{
		NewWindowNoresizable("http://media.iba.org.il/" + strWindowAddrss,'724','458','no');
	}
	
	function ShowBroadcast()
	{
	   url = select_Broadcast.
	   window.open(url);
	}
	
	function NewWindowScroll(mypage,w,h,scroll)
	{
		//mypage - URL (-Link)
		//w - width
		//h - height
		//scroll - yes/no
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
		win=open(mypage,'',settings);
		win.opener=self;
		if(win.focus){win.focus();}
	}
	
	var WindowIsOpen = 0;
	
	function NewWindowId(mypage,w,h,resize,scroll)
	{
		//mypage - URL (-Link)
		//w - width
		//h - height
		//resize - yes/no
		//scroll - yes/no
		
		if ( WindowIsOpen )
		{
			WindowIsOpen.close();
		}
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+ resize;
		WindowIsOpen = open(mypage,'WindowPopUp',settings);
		if(WindowIsOpen.focus){WindowIsOpen.focus();}
	}
	
	function NewWinParamId(mypage,w,h,winId,resize,scroll)
	{
		//mypage - URL (-Link)
		//w - width
		//h - height
		//winId - popup window id
		//resize - yes/no
		//scroll - yes/no
		
		try
		{
			if ( win )
			{
				win.close();
			}
		}
		catch(exception)
		{
		}
		
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+ resize;
		win = open(mypage,winId,settings);
		if(win.focus){win.focus();}
	}

    function NewWindowNoresizable(mypage,w,h,scroll)
	{
		//mypage - URL (-Link)
		//w - width
		//h - height
		//scroll - yes/no
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
		win=open(mypage,'',settings);
		win.opener=self;
		if(win.focus){win.focus();}
	}
	function NewBrowserWindow(mypage,w,h)
	{
		//mypage - URL (-Link)
		//w - width
		//h - height
		//scroll - yes/no
		LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
		win=open(mypage,'',settings);
		win.opener=self;
		if(win.focus){win.focus();}
	}
    
	function NewBrowserMax(mypage)
	{
		// this function does not set the focus to itself
		// like the other ones.
		// it opens in a max sized window
		// the id for the window is '' and not null, so that
		// each page will open a new window, not replace the 
		// one opened before.
		
		settings='width='+screen.availWidth+',height='+screen.availHeight+',top=0,left=0,scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
		win=open(mypage,'',settings);
		win.opener=self;
	}

    function NewWin(sPath)
    {
        win=window.open(sPath ,null,'height=' + screen.availHeight   + ',width=' + screen.availWidth  + ',status=yes,toolbar=yes,menubar=yes,directories=yes,location=yes,resizable=yes,scrollbars=yes,top=0,left=0');
		win.opener=self;
		if(win.focus){win.focus();}
    
    }
	function setHeight(whichFrame,whichTable,checkMenu)
	{
//		this function will set the frame height in a page
//		whichFrame - the frame that's getting it's height set.
//		whichTable - the id of the main table 

		var frameHeight;
		var pathFrame = '';

		try
		{
			if ( top.document.getElementById(whichFrame) )
			{
				pathFrame = top.document;
			}

			else if ( window.parent.document.getElementById(whichFrame) )
			{
				pathFrame = window.parent.document;
			}
			
			else
			{
				return;
			}
	        
			frameHeight = document.getElementById(whichTable).offsetHeight;
			pathFrame.getElementById(whichFrame).height = frameHeight;   
	    //  Check if this frame is a childframe.  If it is, then enlarge 
	    //	the parent frame as well (if it is not big enough already.
	    
	        try
	        {
				if (frameHeight > window.frames.parent.frameElement.height)
				{
					window.frames.parent.frameElement.height = frameHeight;
				
			    }
			}
			catch (exception)
			{
			}
			
	//		Set the length of the table of the menu on the side of the
	//		page to reach the bottom of the whole page

			if ( checkMenu == 'true' ) 
			{
				setMenuHeight();
			}
		}
		catch(exception)
		{
		}
	}

	function setHeightMinParent(whichFrame,whichTable,checkMenu,parentHeight)
	{
//		this function will set the frame height in a page
//		whichFrame - the frame that's getting it's height set.
//		whichTable - the id of the main table 

		var frameHeight;
		var pathFrame = '';

		try
		{
			if ( top.document.getElementById(whichFrame) )
			{
				pathFrame = top.document;
			}

			else if ( window.parent.document.getElementById(whichFrame) )
			{
				pathFrame = window.parent.document;
			}
			
			else
			{
				return;
			}
	        
			frameHeight = document.getElementById(whichTable).offsetHeight;
			pathFrame.getElementById(whichFrame).height = frameHeight;   
	    //  Check if this frame is a childframe.  If it is, then enlarge 
	    //	the parent frame as well (if it is not big enough already.
	    
	        try
	        {
				if (frameHeight > window.frames.parent.frameElement.height)
				{
					window.frames.parent.frameElement.height = frameHeight;
				
			    }
			    else
			      if (window.frames.parent.frameElement.height > parentHeight) 
			      {
			         window.frames.parent.frameElement.height = parentHeight
			      }
			}
			catch (exception)
			{
			}
			
	//		Set the length of the table of the menu on the side of the
	//		page to reach the bottom of the whole page

			if ( checkMenu == 'true' ) 
			{
				setMenuHeight();
			}
		}
		catch(exception)
		{
		}
	}

	function maximizeWin() 
	{
//		if the window is not full screen then maximize it.

		var screenWidth = ns6? top.innerWidth : top.document.body.clientWidth;
		var screenHeight = ns6? top.innerHeight : top.document.body.clientHeight;

//		21 is for the scrollbar on the right
		if ( screenWidth+21 < screen.availWidth ) 
		{
			var forHScrolling = ns6? 2 : 8;
			var forVScrolling = ns6? 3 : 5;
		
			if (window.screen) 
			{
				var aw = screen.availWidth + forHScrolling ;
				var ah = screen.availHeight + forVScrolling;

				try
				{
					window.moveTo(0, 0);
					window.resizeTo(aw, ah);
				}
				catch(exception)
				{
				}
			}
		}
	}

	function setMenuHeight()
	{
	//	Do once the whole page is loaded.  
	//	    Netscape does not recognize 'readystate'

		if ( top.document.getElementById("tblMainMenu") == null ||
			 (!ns6 && top.document.readyState != 'complete') )
		{
			setTimeout("setMenuHeight()",500);
		}

		var menuHeight;
		var menuBottom;
		var documentHeight;

		if ( top.document.getElementById("tblMainMenu") != null )
		{
//			the variable menuBottom contains the height of the 
//			bottommost td. Initialize it to zero before starting.

			if ( top.document.getElementById("menuBottom") != null )
			{
				top.document.getElementById("menuBottom").style.height = 0;
				documentHeight = (ns6)? top.document.firstChild.offsetHeight : top.document.getElementById("mainBody").scrollHeight;
				menuHeight = top.document.getElementById("tblMainMenu").offsetHeight;

				if ( documentHeight > menuHeight )
				{
					top.document.getElementById("menuBottom").style.height = documentHeight - menuHeight + 16;
				}
			}
			var pageWidth = top.screen.availWidth;
			top.document.getElementById("mainBody").style.paddingLeft = (pageWidth-800)/2;
		}
	}

	function setDivHeight(whichDiv,whichTable,max)
	{

//		this function will set the height of a scrolling div in a page

//		Parameters:
//		whichDiv - the div that's getting it's height set.
//		whichTable - the id of the main table in the div
//		max - the maximum height allowed for the div before scrolling starts.

		var divHeight;

		if ( document.getElementById(whichDiv)== null )
		{
			return;
		}

		divHeight = document.getElementById(whichTable).offsetHeight;

		if ( divHeight < max )
		{
			document.getElementById(whichDiv).style.height = divHeight;   
		}
		
	}   

//	This function opens a popup window for the purposes of sending
//	a yedia to someone.

	function sendToFriend(linkStr)
	{
		var siteName = top.document.getElementById("englishSiteName").value;
		var parameters = '?site=' + siteName + '&linkStr=' + linkStr;
		NewWindowScroll('general/asp/SendToFriend.asp'+parameters,'320','380','no')
	}

	function sendToFriendEnglish(linkStr)
	{
		var siteName = window.parent.document.getElementById("englishSiteName").value;
		var parameters = '?site=' + siteName + '&linkStr=' + linkStr;
		NewWindowScroll('general/asp/SendToFriendEnglish.asp'+parameters,'320','380','no')
	}

	function imgOn(imgName) // Function to 'activate' images
	{
	    if (document.images) 
	    {
            document[imgName].src = eval(imgName + "on.src");
        }
	}

	function imgOff(imgName) // Function to 'deactivate' images.
	{
        if (document.images) 
        {
            document[imgName].src = eval(imgName + "off.src");
        }
	}

	function SetDate(sDate)
	{
	//	this function receives a string date with the format dd/mm/yyyy
	//	and changes it to a format that date functions will recognize.
	
		if( sDate.substring(0,1) == 0) 
		{     
			day = sDate.substring(1,2);
		}
		else
		{
			day = sDate.substring(0,2);
		}
		month = sDate.substring(5,3) - 1;
		year  = "20" + sDate.substring(6,8)
   
		return new Date(year, month, day );
	}

	function openDivLive()
	{
	//	if a div was already opened, close the old one

		if (document.getElementById("divLive").style.display=="block")
		{
			closeDivLive();
			return(false);
		}

		document.getElementById("divLive").style.display="block";

		setHeight('leftIframe','tblMain','true');
	}
		
	function closeDivLive()
	{
		document.getElementById("divLive").style.display="none";

		setHeight('leftIframe','tblMain','true');
	}
	
	function printPage(id)
	{
		document.getElementById(id).style.visibility = 'hidden';
		window.print();
		document.getElementById(id).style.visibility = 'visible';
	}

	function checkDates(date1,date2)
	{
//		check the date interval - 
//		returns 1 : if date1 is > than date2 
//		returns 2 : if date2 is > than date1 
//		returns 0 : if date1 is = than date2 

		var tempDate1 = new Date( date1 ); 
		var tempDate2 = new Date( date2 ); 

		if ( tempDate1 > tempDate2 )
		{
			return 1;
		}
		if ( tempDate2 > tempDate1 )
		{
			return 2;
		}
		return 0;
			
	}	

	function GetParam(name)
	{
//		this function checks if a parameter exists.	  	
		
		var start=top.location.search.indexOf("?"+name+"=");
	
		if (start<0) start=top.location.search.indexOf("&"+name+"=");
	
		if (start<0) return '';
		
		start += name.length+2;
	  
		var end = top.location.search.indexOf("&",start)-1;
	   
		try
		{	
			if (end < 0)
			{
				end = top.location.search.length;
			} 
		}
		catch( exception )
		{ 
			return '' 
		}
	     
		var result=top.location.search.substring(start,end);
		var result='';
	
		for(var i=start;i<=end;i++) 
		{
			var c = top.location.search.charAt(i);
			result = result+(c=='+'?' ':c);
		}
	 
		return unescape(result);
	}

	function textCounter(whichField,  maxLimit) 
	{   
	//  Check the length of an input box.  If too long...trim it!
		
		var field = document.getElementById(whichField)
		if (field.value.length > maxLimit-1)
		{
			field.value = field.value.substring(0, maxLimit-1);
		}
	}	
	
	function removeBR(whichStr)
	{
		while ( whichStr.search("<br>") != -1 )
		{
			whichStr = whichStr.replace("<br>"," ");
		}
		return whichStr;
	}	
	
	function startBlink(speedBlink) 
	{
		setInterval("doBlink()",speedBlink);
	}

	function doBlink() 
	{
		var blink = document.all.tags("blink")
		for (var i=0; i<blink.length; i++)
		{
			blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "";
		} 
	}

	function checkEmail(emailAddr)
	{
   		var strudel  = emailAddr.indexOf("@")
   		var comma   = emailAddr.indexOf(",")
   		var space  = emailAddr.indexOf(" ")
   		var period  = emailAddr.lastIndexOf(".") + 1
   		var emailLen = emailAddr.length
				 			 
   		if (    (strudel > 0) 
   		     && (comma == -1) 
   		     && (space == -1) 
   		     && (emailLen - period >= 2) 
   		     && (emailLen - period <= 4)
   		     && (emailLen!=0)  )
   		{
			return true;
   		}
   		else
   		{
			return false;
   		}			
	}	

    function replaceStr(string,text,by) 
    {
      var stringLength = string.length
      var textLength = text.length;
      if ((stringLength == 0) || (textLength == 0)) return string;

      var i = string.indexOf(text);
      if ((!i) && (text != string.substring(0,textLength))) return string;
      if (i == -1) return string;

      var newstr = string.substring(0,i) + by;

      if ( (i+textLength) < stringLength)
        newstr += replaceStr(string.substring(i+textLength,stringLength),text,by);

      return newstr;
    }       

	function hinuhit()
	{ 
		var use800 = 0; 

		if (screen.height == 600)
		{	
			if (screen.width == 800)
			{
				use800 = 1;
			}
		}
		if (screen.height == 480)
		{
			if (screen.width == 640)
			{
				use800 = 1;
			}
		}
					
		if (use800 == 1)
		{
			NewBrowserMax('http://eduradio.iba.org.il/hinuhit_800.htm');
		}
		else
		{
			NewBrowserMax('http://eduradio.iba.org.il/hinuhit_1024.htm');
		}
	} 

	var currentColor;

	function changeColor(whichOne,color1,color2,speed)
	{
		currentColor = color1;
		setInterval("doChangeColor('" + whichOne + "','" + color1 + "','" + color2 + "')",speed);
	}

	function doChangeColor(whichOne,color1,color2) 
	{
		if ( currentColor == color1 )
		{
			document.getElementById(whichOne).style.color = color2;
			currentColor = color2;
		}
		else
		{
			document.getElementById(whichOne).style.color = color1;
			currentColor = color1;
		}	
	}

	var oldContent;
	
	function blinkTxt(whichOne,speed)
	{
		oldContent = document.getElementById(whichOne).innerHTML;
		setInterval("doBlinkTxt('" + whichOne + "')",speed);
	}

	function doBlinkTxt(whichOne) 
	{ 
		if ( document.getElementById(whichOne).innerHTML == '&nbsp;' )
		{
			document.getElementById(whichOne).innerHTML = oldContent;
		}
		else
		{
			document.getElementById(whichOne).innerHTML = '&#160;';
		}	
	}

