﻿            function openIconPicker() {
                
                winInstance = null;
                openPopupWindow(800,485,"icon_picker.php","PickerWin",winInstance);
            }
            
            function updateIconPickerImage(id) {
            
                var ip = document.getElementById("iconPicker");
                ip.src= "images/avatars/" + id + ".png";
                document.forms[0].iconId.value = id;
            }
            
            function submitCommentForm() {
                
                if (validateCommentForm()) {            
                    document.forms[0].submit(); 
                }
            }
            
            function validateCommentForm() {
                
                form = document.forms[0];
                
                if (form.nickNameText.value == "") {
                    
                    alert("Please, supply your nickname!");
                    return false;
                }
                
                if (form.commentText.value == "") {
                    
                    alert("Please, supply your comment!");
                    return false;
                }
                
                if (form.commentText.value.length > 2000) {
                    
                    alert("Your comment is too long [" + form.commentText.value.length + "] characters. Maximum 2000 are allowed!");
                    return false;
                }
                
                return true;
            }       