function cleanText(currObj, textToClean)
        {
            if (currObj.value == textToClean)
            {
                currObj.value = "";
                currObj.style.color = "#000000";
            }
        }
        function setText(currObj, textToSet)
        {
            if (currObj != null)
            {
                if (currObj.value == "" || currObj.value == textToSet)
                {
                    currObj.value = textToSet;
                    currObj.style.color = "#a9a9a9";
                }
            }
        }
        function changeToBlack(currObj)
        {
            currObj.style.color = "#000000";
        }
        
        function AllowOnlyNumeric(e)
        {
            var key;
            if(window.event)
                key = window.event.keyCode; // IE hack
                else
                key = e.which;

            // Verify if the key entered was a numeric character (0-9) or a decimal (.)
            if ( (key > 47 && key < 58) || key == 46 || key == 127 || key == 8)
                // If it was, then allow the entry to continue
                return;
            else
                // If it was not, then dispose the key and continue with entry
                //window.event.returnValue = null;
                return false;
        }
        function AllowOnlyNotViolentChars(e,errorBoxName)
        {
            var key;
            if(window.event)
                key = window.event.keyCode; // IE hack
                else
                key = e.which;

            var currChar = String.fromCharCode(key);


            // Verify if the key entered was a numeric character (0-9) or a decimal (.)
            if (currChar != '/' && currChar != '\\' && currChar != '!' && currChar != '.' && currChar != ':' && currChar != ';' && currChar != ',' && currChar != '\'' && currChar != '"' && currChar != '?' && currChar != '@' && currChar != '#' && currChar != '$' && currChar != '%' && currChar != '&' && currChar != '*')
            {
                // If it was, then allow the entry to continue
                if (errorBoxName != null)
                {
                
                    document.getElementById(errorBoxName).style.visibility = 'hidden'; 
                    document.getElementById(errorBoxName).style.display = 'none';
                }
                return true;
            }
            else
            {
                // If it was not, then dispose the key and continue with entry
                if (errorBoxName != null)
                {
                    document.getElementById(errorBoxName).style.visibility = 'visible'; 
                    document.getElementById(errorBoxName).style.display = 'block';
                }
                //window.event.returnValue = false;
                return false;
            }
        }
        function charsNumLimit(currTextBox, maxLenght, errorBoxName)
        {
            var currText = currTextBox.value;
            var len = currText.length;
            
            if (errorBoxName != null)
            {
                document.getElementById(errorBoxName).style.visibility = 'hidden'; 
                document.getElementById(errorBoxName).style.display = 'none';
            }
            
            if(len >= maxLenght)
            {
                //currText = currText.substring(0,maxLenght);
                currTextBox.value = currText;
                if (len > maxLenght + 1)
                {
                    currTextBox.value = currText.substr(0, maxLenght);
                }
                
                if (errorBoxName != null)
                {
                    document.getElementById(errorBoxName).style.visibility = 'visible'; 
                    document.getElementById(errorBoxName).style.display = 'block';
                }
                
                return false;
            }
            //document.myform.limit.value = count-len;
        }
        function charsNumAndRowsNumLimit(e, currTextBox, maxLenght, errorBoxName, maxRows)
        {
            var key;
            if(window.event)
                key = window.event.keyCode; // IE hack
                else
                key = e.which;
                
            var currText = currTextBox.value;
            var allowAction = true;
        
            if (charsNumLimit(currTextBox, maxLenght, errorBoxName) == false)
            {
                allowAction = false;
            }
            else
            {
                if (lineBreakCount(currText) > maxRows)
                {
                    currTextBox.value = currText;
                    
                    if (errorBoxName != null)
                    {
                        document.getElementById(errorBoxName).style.visibility = 'visible'; 
                        document.getElementById(errorBoxName).style.display = 'block';
                    }
                    
                    allowAction = false;
                }
            }
            
            if (!allowAction && (key >= 32 || key == 13 || key == 32))
            {
                currTextBox.value = currText.substr(0, maxLenght);
                return false;
            }
        }
        function lineBreakCount(str){
	        /* counts \n */
	        try {
		        return((str.match(/[^\n]*\n[^\n]*/gi).length));
	        } catch(e) {
		        return 0;
	        }
        }
        function charsNumLimitWithowtBreak(e, currTextBox, maxBreakLenght)
        {
            var key;
                if(window.event)
                key = window.event.keyCode; // IE hack
                else
                key = e.which;
                
            var currText = currTextBox.value;
            
            if (currText.length >= maxBreakLenght)
            {
                var lastCharsToCheck = currText.substr(currText.length - maxBreakLenght - 1);
            }
            else
            {
                var lastCharsToCheck = currText;
            }
            
            if (currText.length > maxBreakLenght && lastCharsToCheck.match(String.fromCharCode(13)) == null && lastCharsToCheck.match(String.fromCharCode(10)) == null && lastCharsToCheck.match(String.fromCharCode(32)) == null)
            {
                currTextBox.value = currText.substring(0,currText.length - 1);
                var lastBreakIndex = Math.max(currTextBox.value.lastIndexOf(String.fromCharCode(10)), currTextBox.value.lastIndexOf(' '));
                if (currText.length - lastBreakIndex > maxBreakLenght + 2)
                {
                    currTextBox.value = currTextBox.value.substring(0, lastBreakIndex + maxBreakLenght);
                }
                
                popup(1,'לא ניתן להזין מילה שאורכה מעל ' + maxBreakLenght + ' תווים');
                document.getElementById('divpopup').focus();
                
                if (key >= 32)
                    return false;
            }
        }
        function setHtmlSpaces(text)
        {
            return text.replace(/\n/g, "<br/>");
        }
    
        function popup(sw, popupText) 
        {
            if (sw == 0 || (popupText != "" && popupText != null))
            {
                anyPopup(sw, popupText, 'divpopup');
            }
            ShowPopupDiv('divpopup');
        }
        function anyPopup(sw, popupText, popupElementName)
        {
            anyPopupSetTop(sw, popupText, popupElementName, f_scrollTop() + 300);
        }
        function coverScrenn(startHeight)
        {
            document.getElementById('blackout').style.visibility = 'visible';
			document.getElementById('blackout').style.zIndex = 0;
			document.getElementById('blackout').style.top = startHeight  + "px";
			document.getElementById('blackout').style.height = (docHeight() - startHeight) + "px";
			document.getElementById('blackout').style.opacity = "0.1"
        }
        function anyPopupSetTop(sw, popupText, popupElementName, top) {
            try { var local_popup_may_be_closed = popup_may_be_closed } catch (e) { var local_popup_may_be_closed = true}
            // Show popup
            if (sw == 1) 
            {
                document.getElementById('blackout').style.visibility = 'visible';
				document.getElementById('blackout').style.zIndex = 0;
				
				 
                document.getElementById(popupElementName).style.visibility = 'visible';
                document.getElementById(popupElementName).style.display = 'block';
                if (popupText != null)
                {
                    document.getElementById('pop_content').innerHTML = popupText;
                }
                var pxAprearCheck = top.toString().substr(top.toString().length - 2,2);
                if (pxAprearCheck != "px")
                {
                    top = top + "px";
                }
                document.getElementById(popupElementName).style.top = top;
                
                document.getElementById('blackout').style.height = docHeight() + "px";
                //document.title= docHeight() + "px";
                
                //document.getElementById('blackout').style.display = 'block';    
                //document.getElementById('blackout').style.width = myWidth;
				//ShowPopupDiv(popupElementName);
            } 
            // Hide popup. popup_may_be_closed - relevant only for popups closing automaticly on Personal page
            else if (local_popup_may_be_closed != false)
            {
                document.getElementById('blackout').style.visibility = 'hidden';
                document.getElementById(popupElementName).style.visibility = 'hidden';
                //document.getElementById('blackout').style.display = 'none';
                document.getElementById(popupElementName).style.display = 'none';
				
				HidePopupDiv(popupElementName);
            }
        }
        
        var myWidth = 0, myHeight = 0;
        function docHeight() {
			return getDocHeight();
			//if (document.all) 
			//	return( document.body.offsetHeight);
			//else if (document.layers)
			//	return( document.body.document.height);
		}
		function getDocHeight() {
			var D = document;
			return Math.max(
				Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
				Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
				Math.max(D.body.clientHeight, D.documentElement.clientHeight)
			);
		}
		function f_filterResults(n_win, n_docel, n_body) {
			var n_result = n_win ? n_win : 0;
			if (n_docel && (!n_result || (n_result > n_docel)))
				n_result = n_docel;
			return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
		}
		function f_scrollTop() {
			return f_filterResults (
				window.pageYOffset ? window.pageYOffset : 0,
				document.documentElement ? document.documentElement.scrollTop : 0,
				document.body ? document.body.scrollTop : 0
			);
		}
		
		// Popup iframe start
		var g_PopupIFrame;
        function IsIE()
        {
	        return ( navigator.appName=="Microsoft Internet Explorer" ); 
        }
            
         
        function HidePopupDiv(divID)
        {
            //var divpopup2;
            //divpopup2=document.getElementById(divID);
            //divpopup2.style.visibility = "hidden";
            var frames=document.getElementsByTagName("IFRAME");
            
            for(i=0;i<frames.length;i++)
            {
                try
                {
                    document.body.removeChild(frames[i]);
                    frames[i].style.display='none';
                }
                catch(e)
                {

                }
            }
            //if (IsIE())
            //{
            //// document.body.removeChild(g_PopupIFrame);
            //// g_PopupIFrame=null;
            //}
        }
        
        
        function ShowPopupDiv(divID)
        {
			
            var divpopup2=document.getElementById(divID);
           
            if (!IsIE()) 
            {
                //Just display the div
                divpopup2.style.visibility ="visible";
                return;
		    }
		    		    
            //Increase default zIndex of div by 1, so that DIV appears before IFrame
            divpopup2.style.zIndex=divpopup2.style.zIndex+1;
            divpopup2.style.visibility  ="hidden";
		    var iFrame = document.createElement("IFRAME");
		    document.body.appendChild(iFrame);
	       
	       iFrame.setAttribute("src", "");
	        //Match IFrame position with divpopup2
	        iFrame.style.position="absolute";
	        iFrame.style.left   =divpopup2.offsetLeft + 'px';
			iFrame.style.top    =divpopup2.offsetTop + 'px';
		    iFrame.style.width  =divpopup2.offsetWidth + 'px';
			iFrame.style.height =divpopup2.offsetHeight + 'px';
			iFrame.style.border="none 1px black";

		    iFrame.style.zIndex = 100;
		    //Store iFrame in global variable, so it can get removed when divpopup2 is hidden
		    g_PopupIFrame=iFrame;
		    
	        divpopup2.style.visibility ="visible";
			divpopup2.style.zIndex = 101;
			
	    }	
	    // Popup iframe end
	    
	    function addBookmark(url,title){
          if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
          window.external.AddFavorite(url,title);
          } else if (navigator.appName == "Netscape") {
            if (window.sidebar)
            {    window.sidebar.addPanel(title,url,"");
            }
            else
            {
                alert("אופציה זו אינה זמינה אוטומטית עבור הדפדפן שלך, אנא סגור הודעה זו והקש ctrl + D.");
            }
          } else {
            alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
          }
        }