﻿
    function isComment(){
       
        if( document.xform.nickname.value.trim().length == 0){
        
            alert('請輸入暱稱！');
            document.xform.nickname.focus();
            return false;
        
        }
        
        if( document.xform.verifycode.value.trim().length == 0){
            
            alert('請輸入驗證碼！');
            document.xform.verifycode.focus();
            return false;
            
        }
        
        if( document.xform.verifycode.value != document.xform._verify.value){
            
            alert('驗證碼錯誤，請重新輸入！');
            document.xform.verifycode.focus();
            return false;
            
        }
        
        if( document.xform.content.value.trim().length == 0){
            
            alert('請輸入回應內容！');
            document.xform.content.focus();
            return false;
            
        }        
        
        if( document.xform.content.value.trim().length > 1000){
            
            alert('回應內容最為為 1000 字！');
            document.xform.content.focus();
            return false;
            
        }        
        
        if( ! confirm('您確定要送出此回應內容！')){
            
            return false;             
            
        }
        
    }
    
    function insertEmoticon( txt){
        
        document.xform.content.focus();
        document.selection.createRange().text = '[' + txt + ']';
        
        document.getElementById('EmoticonMenu').style.display = 'none';
        
    }
    
    function openEmoticonMenu(){
    
        var layer;
        var html;

        html = '<table border="0" cellpadding="5" cellspacing="1" bgcolor="#A6A6A6">';
        html += ' <tr>';
        html += '  <td width="100%" align="center" valign="middle" bgcolor="#FFFFFF">';
        html += document.getElementById('Emoticon').innerHTML;
        html += '  </td>';
        html += ' </tr>';
        html += '</table> ';
        
        layer = document.getElementById("EmoticonMenu");

    	layer.onmouseover = function(){
    	    
    		this.style.display = 'block';
    	}
    	
    	layer.onmouseout = function(){
    	
    		this.style.display = "none";
    	
    	}

        layer.style.position = 'absolute';
        layer.style.top = GetPosition( document.getElementById('face-icon')).top + 23;
        layer.style.left = GetPosition( document.getElementById('face-icon')).left - 205;
        layer.innerHTML = html;
        
        layer.style.display = 'block';
        
    }
    