        function smilie(emotionicon)
        {
             document.getElementById("topic_content").value += emotionicon+" ";
             document.getElementById("topic_content").focus();
        }

        function change_lastUpdates(showThis)
        {
            document.getElementById(showThis).className = "lastUpdates_button_selected";
            var theType;

            if(showThis != "showAll")
            {
                document.getElementById("showAll").className = "lastUpdates_button";
            }else{
                theType = 3;
            }

            if(showThis != "showMovies")
            {
                document.getElementById("showMovies").className = "lastUpdates_button";
            }else{
                theType = 1;
            }

            if(showThis != "showSeries")
            {
                document.getElementById("showSeries").className = "lastUpdates_button";
            }else{
                theType = 2;
            }

            makeAjaxRequest("ajax/getLastInfo.php?show=" + theType, "update_lastUpdates(XML_OBJECT);");
        }

        function getNode(obj,pos)
        {
        	if (window.XMLHttpRequest)
        		return obj[pos];
        	else
        		return obj.item(pos);
        }

        function getSingleNode(obj,tagName)
        {
        	if (window.XMLHttpRequest)
        		return getRawNode(obj,tagName).selectSingleNode("text()").nodeValue;
        	else
        		return getRawNode(obj,tagName).text;
        }

        function getRawNode(obj,tagName)
        {
        	return obj.selectSingleNode(tagName);
        }

        function getAttribute(obj,attName)
        {
        	if (window.XMLHttpRequest)
        		return obj.selectSingleNode("@" + attName).nodeValue;
        	else
        		return obj.getAttribute(attName);
        }

        function makeAjaxRequest(url,callback)
        {
        	if (window.XMLHttpRequest)
        	{
        		var http_request = new XMLHttpRequest();
        	}
        	else
        	{
        		if (window.ActiveXObject)
        		{
        			var http_request = new ActiveXObject("Microsoft.XMLHTTP");
        		}
        	}
        	http_request.onreadystatechange = function()
        	{
        		if (http_request.readyState == 4)
        		{
        			if (http_request.responseXML != null)
        			{
        				eval(callback.replace("XML_OBJECT","http_request.responseXML"));
        			}else{
                        stateChange();
                    }
        		}else{
                    stateChange();
                }
        	}
        	http_request.open("GET",url,true);
        	http_request.send("");
        }


        function stateChange()
        {
                document.getElementById("lastUpdates_place2").style.display= "none";
                document.getElementById("lastUpdates_place3").style.display= "none";
                document.getElementById("lastUpdates_place4").style.display= "none";
                document.getElementById("lastUpdates_place1").style.display= "none";
                document.getElementById("loadingUpdates").style.display = "block";
        }

        function update_lastUpdates(xmlObj)
        {
            var updates = xmlObj.selectNodes("//updates/update");
            var count = 1;
            var imgFile;
            var hebrewName;
            var englishName;
            var theID;
            var lastUpdate;

            for (var i=0;i<updates.length;i++)
            {
                imgFile = getSingleNode(getNode(updates,i),"imgFile");
                hebrewName = getSingleNode(getNode(updates,i),"hebrewName");
                lastUpdate = getSingleNode(getNode(updates,i),"lastUpdate");
                theID = getSingleNode(getNode(updates,i),"id");

                document.getElementById("image_" + count).src = imgFile;
                document.getElementById("image_" + count).alt = englishName + " / " + hebrewName;
                document.getElementById("names_" + count).innerHTML = hebrewName;
                document.getElementById("link_" + count).href = "index.php?page=view&viewId=" + theID;
                document.getElementById("link2_" + count).href = "index.php?page=view&viewId=" + theID;
                document.getElementById("update_" + count).innerHTML = lastUpdate;

                count++;
            }

            document.getElementById("loadingUpdates").style.display = "none";
            document.getElementById("lastUpdates_place2").style.display= "block";
            document.getElementById("lastUpdates_place3").style.display= "block";
            document.getElementById("lastUpdates_place4").style.display= "block";
            document.getElementById("lastUpdates_place1").style.display= "block";
        }

        function submitForm(formID)
        {
            document.getElementById(formID).submit();
        }

        function enterButton(obj)

        {

                obj.style.backgroundPosition = "0px 21px";

        }



        function exitButton(obj)

        {

                obj.style.backgroundPosition = "0px 0px";

        }



        function navigate(url)
        {
            location.href=url;
        }

        function show_more(id_to_show)
        {
            var obj = document.getElementById(id_to_show + "_div");
            var updated = false;

            if(obj.style.display == "none")
            {
                obj.style.display = "block";
                updated = true;
            }

            if(obj.style.display == "block" && updated == false)
            {
                obj.style.display = "none";
            }
        }

        function changeSelection(val)
        {
            if(val == 1)
            {
                document.getElementById("moviesSearch_1").style.display = "block";
                document.getElementById("moviesSearch_2").style.display = "block";
                document.getElementById("moviesSearch_3").style.display = "block";
                document.getElementById("moviesSearch_4").style.display = "block";
                document.getElementById("moviesSearch_5").style.display = "block";
            }else{
                document.getElementById("moviesSearch_1").style.display = "none";
                document.getElementById("moviesSearch_2").style.display = "none";
                document.getElementById("moviesSearch_3").style.display = "none";
                document.getElementById("moviesSearch_4").style.display = "none";
                document.getElementById("moviesSearch_5").style.display = "none";
            }
        }

            function doublenewlines(text)
            {
                return text.replace(/([^\n])(?:\r?\n|\r){1}([^\n])/g, '$1\r\n$2');
            }

            function showPreview()
            {
                var previewText = ajax.response;
                //previewText = doublenewlines(previewText);
                document.getElementById("previewTextarea").style.display = "block";
                document.getElementById("previewTextarea").value = previewText;
            }

            function closePreview()
            {
                document.getElementById("previewTextarea").innerHTML = "";
                document.getElementById("previewTable").style.display = "none";
            }

            function showAddForm()
            {
                document.getElementById("newCommentTable").style.display = "";
                document.getElementById("commentsTable").style.display = "none";
            }

            function showLastComments()
            {
                document.getElementById("newCommentTable").style.display = "none";
                document.getElementById("commentsTable").style.display = "";
            }

            function showActors()
            {
                var table = document.getElementById("allActors");

                if(table.style.display == "none")
                {
                    table.style.display = "block";
                }else{
                    table.style.display = "none";
                }
            }

            function commentView(commnetId)
            {
                commentTr = document.getElementById("comment" + commnetId);

                if(commentTr.style.display == "none" || commentTr.style.display == "")
                {
                    commentTr.style.display = "block";
                }else{
                    commentTr.style.display = "none";
                }

            }

            function toggleVisibility()
            {
                obj0=document.getElementById('files4');
                obj1=document.getElementById('files1');
                obj2=document.getElementById('files2');
                obj3=document.getElementById('files3');
                obj6=document.getElementById('files5');
                obj4=document.getElementById('percent');
                if (obj1.style.display=="none")
                {
                    obj0.style.display="block";
                    obj1.style.display="block";
                    obj2.style.display="block";
                    obj3.style.display="block";
                    obj6.style.display="block";
                    obj4.style.display="none";
                }
                else
                {
                    obj0.style.display="none";
                    obj1.style.display="none";
                    obj2.style.display="none";
                    obj3.style.display="none";
                    obj4.style.display="block";
                    obj6.style.display="none"; 
                }
            }

            function change_movieContent(showThis)
            {
                document.getElementById(showThis + "_Table").style.display = "block";
                document.getElementById(showThis).className = "lastUpdates_button_selected";

                if(showThis != "showComments" && document.getElementById("showComments") != undefined)
                {
                    document.getElementById("showComments").className = "lastUpdates_button";
                    document.getElementById("showComments_Table").style.display = "none";
                }

                if(showThis != "showPlayers" && document.getElementById("showPlayers") != undefined)
                {
                    document.getElementById("showPlayers").className = "lastUpdates_button";
                    document.getElementById("showPlayers_Table").style.display = "none";
                }

                if(showThis != "showTrailers" && document.getElementById("showTrailers") != undefined)
                {
                    document.getElementById("showTrailers").className = "lastUpdates_button";
                    document.getElementById("showTrailers_Table").style.display = "none";
                }

                if(showThis != "showReviews" && document.getElementById("showReviews") != undefined)
                {
                    document.getElementById("showReviews").className = "lastUpdates_button";
                    document.getElementById("showReviews_Table").style.display = "none";
                }

            }

            function ChangeSeason(SeasonIdToShow, SeasonNumber)
            {
                var maxSeason = document.getElementById("maxSeason").value;

                for(var i=1; i<=maxSeason; i++)
                {
                        document.getElementById("season_" + i).style.display = "none";
                        document.getElementById("arrow_" + i).style.display = "none";

                    if(document.getElementById("manageSeason_" + i) != undefined)
                    {
                        document.getElementById("manageSeason_" + i).style.display = "none";
                    }
                }

                document.getElementById("season_" + SeasonNumber).style.display = "block";
                document.getElementById("arrow_" + SeasonNumber).style.display = "block";

                if(document.getElementById("manageSeason_" + SeasonNumber) != undefined)
                {
                    document.getElementById("manageSeason_" + SeasonNumber).style.display = "block";
                }
            }

            function showOptionsOfEpisode(episodeId)
            {
                document.getElementById("options_" + episodeId).style.display = "block";
            }

            function forumComment(commentId)
            {
                var commentTD = document.getElementById("comment_" + commentId);

                if(commentTD.style.display == "none")
                {
                    commentTD.style.display = "block";
                }else{
                    commentTD.style.display = "none";
                }
            }

            function markComment(toMark, subComment)
            {
                var theImg = document.getElementById("commentMark_" + toMark);

                if(subComment == "true")
                {
                    if(theImg.src == "http://www.subscenter.net/images/comment_to_comment_off.gif")
                    {
                        theImg.src = "http://www.subscenter.net/images/comment_to_comment_on.gif";
                    }else{
                        theImg.src = "http://www.subscenter.net/images/comment_to_comment_off.gif";
                    }
                }else{
                    if(theImg.src == "http://www.subscenter.net/images/comment_off.gif")
                    {
                        theImg.src = "http://www.subscenter.net/images/comment_on.gif";
                    }else{
                        theImg.src = "http://www.subscenter.net/images/comment_off.gif";
                    }
                }
            }
			
			function submitLogin(currField,e)
			{
				/*var keyCode;
				if (window.event) keyCode = window.event.keyCode;
				else if (e) keyCode = e.which;
				else return true;

				if (keyCode == 13)
				{
					currField.form.submit();
					return false;
				}
				else
				{
					return true;
				}*/
			}