<!--
//*******	Site and Language related functions 	*********//
	function HebOrEng(strInHebrew, strInEnglish)
		/*Gets a string in Hebrew and a string in English,
		 and returns one of the two according to strLang.*/
	{
		return (strLang == "heb") ? (strInHebrew) : (strInEnglish) ;
	}
	
	function HTMLTag()
	{
		return HebOrEng("<html dir=\"rtl\">", "<html dir=\"ltr\">");
	}
	
	function SiteName()
	{
		return HebOrEng("תל אביב במבט חדש","Tel Aviv In Focus");
	}
//*************************************************************//

//*******	String functions 	*********//
		
	function isHebrew()
	// gets a string and tells if it is hebrew.
	// if the first letter is hebrew, then we return TRUE.
	// otherwise we assume it is not a hebrew string.
	{
		if ((this.charCodeAt(0)>=1488) && (this.charCodeAt(0)<=1514))
		{return true}
		else
		{return false}
	}
	String.prototype.isHebrew = isHebrew; 

	function consonantize(){ 
	// gets a string and strips it of vowels.
	 var consonants =""; 
	 for(i=0;i<this.length;i++){ 
	   var l = this.charAt(i); 
	   if(l!="a" && l!="A" && l!="e" && l!="E" && l!="i" && l!="I" && l!="o" && l!="O" && l!="u" && l!="U" && l!=" "){ 
		 consonants+=l; 
	   } 
	 } 
	 return consonants; 
	}
	String.prototype.consonantize = consonantize; 

	function rGeresh()  // replaces single '-s with ''-s.
	{return this.replace(/\'/g, "\'\'");}
	String.prototype.rGeresh = rGeresh;
	
	function rGereshJs()  //replaces '-s with \'-s (for javascript use)
	{return this.replace(/\'/g, "\\\'");}
	String.prototype.rGereshJs = rGereshJs;
	
	function rQuote() // replaces "-s with html "&quot;"-s
	{return this.replace(/\"/g, "\&quot;");}
	String.prototype.rQuote = rQuote;

	function rQuoteJs() 	//replaces "-s with \"-s (for javascript use)
	{return this.replace(/\"/g, "\\\"");}
	String.prototype.rQuoteJs = rQuoteJs;
	
	function rNewlineJs() 	//replaces new lines with \n-s (for javascript use)
	{return this.replace(/\r\n/g, "\\n");}
	String.prototype.rNewlineJs = rNewlineJs;
		
	function rNewlineBr() 	//replaces new lines with html "<br>" tags.
	{return this.replace(/\r\n/g, "<br>");}
	String.prototype.rNewlineBr = rNewlineBr;
//***************************************//


//*******		Math functions 	*********//
	// the smaller of two numbers.
	function Min(iNum1, iNum2)
	{return (iNum1<=iNum2) ? iNum1 : iNum2;}

	// the larger of two numbers.
	function Max(iNum1, iNum2)
	{return (iNum1>= iNum2) ? iNum1 : iNum2;}
//****************************//


//*******		Array functions 	*********//
function ConvertNumericStringsToIntegers(arrExceptional){
	// gets a 2-dimensional array of strings,
	// and converts the ones that are numeric - to integers.
	for(var i=0; i<this.length; i++){
		for (var j=0; j<this[i].length; j++)
		if ((!isNaN(parseInt(this[i][j])))&&(arrExceptional.indexOf(j)==-1)){
			this[i][j] = parseInt(this[i][j]);
		}
	}
}
Array.prototype.ConvertNumericStringsToIntegers = ConvertNumericStringsToIntegers;

function indexOf(obj){
	// returns the object's index inside the array.
	// if not found returns -1 (like string's indexOf() method);
	for (var i=0; i<this.length; i++){
		if (this[i]==obj){
			return i;
		}
	}
	return -1;
}
Array.prototype.indexOf = indexOf;
//****************************//

//*******		Date functions		*******//
	function ConvertDateToShortLocaleString(strDate)
	{
		//var dtNow = new Date("08/02/2004 00:00:00 GMT");
		// gets a string of a date that came from the server,
		// and formats it according to the client's time zone.
		// the result is a string like "09/11/85 19:22"
		// WE PRESUME THAT THE SERVER TIME OFFSET IS 0.
		// (SERVER IS IN ENGLAND).

		// format date in proper manner (mm/dd/yyyy),
		// then convert it to Date data type.
			strDate = strDate.split(" ");
			var strDatePart = strDate[0];	
			strDatePart = strDatePart.split("/");
			strDatePart = strDatePart[1] + "/" + strDatePart[0] + "/" + strDatePart[2];
			var strTimePart = strDate[1];		
			strDate = strDatePart + " " + strTimePart;
			var dtDate = new Date(strDate);
		// get the getTimezoneOffset of the client.
			var dtNow = new Date();
			var iTzOffset = dtNow.getTimezoneOffset();
		// add the offset to the date, format it shortly and return it.
			dtDate.setMinutes(dtDate.getMinutes() - iTzOffset);
			var iHours = dtDate.getHours();
			if (iHours<10) {iHours = "0" + iHours;};
			var iMinutes = dtDate.getMinutes();
			if (iMinutes<10) {iMinutes = "0" + iMinutes;};
			var strDateFormat = iHours + ":" + iMinutes + " ";
			strDateFormat += dtDate.getDate() + "/" + (dtDate.getMonth()+1) + "/" + dtDate.getFullYear();
			return strDateFormat ;
	}
	
	function MakeDate()
	// takes a string like "2/4/05" and returns a date object according to it.
	{
		var arrDateParts = this.split("/");
		var dt = new Date(arrDateParts[2], arrDateParts[1]-1, arrDateParts[0]);		
		if (isNaN(dt)) 
			{return this;} 
		else
			{return dt;}
	}
	String.prototype.MakeDate = MakeDate;
//****************************//

//*******		Graphic functions		*******//
	// use this function to get the width of the bars (status bars, scrollbars etc.).
	// the window must be a dialog (called from showModalDialog/showModelessDialog methods).
	function getBarsDimensions(){
		var iBarsWidth = parseInt(window.dialogWidth) - document.body.clientWidth;
		var iBarsHeight = parseInt(window.dialogHeight) - document.body.clientHeight;
		return({width:iBarsWidth , height:iBarsHeight});
	}
//****************************//	
//-->