/*
 * Copyright (c) 2007 Atwind (cszi.com)
 * $Date: 2008 1-12 23:42:06 -0400 (Sun, 16 Sep 2007) $
 */

// Post Comment -Atwind 2008-1-12
function postMyComment(frm)
{
    frm.btnSubmit_comment.disabled = true;
   var content = frm.Content.value.replace(/\[([.\n]*)\]/m,"");
   var isVerify = frm.IsVerify.value;
   //window.clipboardData.setData('text',content);
   if(content.length < 5)
   {
        showMessage("1. 内容最少5个字，请返回填写。");
        frm.Content.focus();
        frm.btnSubmit_comment.disabled = false;
        return false;
   }
   else if(content.length > 8000)
   {
        showMessage("1. 内容超过8000个字。\n2. 你想一次发多少呢?");
        frm.Content.focus();
        frm.btnSubmit_comment.disabled = false;
        return false;
   }
   else if(isVerify ==1)
   {
     var code = frm.verifyCode_comment.value;
     if(code.length<2)
     {
         showMessage("1. 请填写验证码。");
         frm.verifyCode_comment.focus();
         frm.btnSubmit_comment.disabled = false;
         return false;
     }
   }
   else
   {
        return true;
    }
}

// Quote Atwind 2008-11-24  SiC/CYAN 2004-2005
function doQuoteThis(autId,cotId)
{
  var aut = document.getElementById(autId);
  var autName=aut.innerHTML;
  var obj=document.getElementById(cotId);
  var text=obj.innerHTML;
  text=text.replace(/alt\=(\"|)([^\"\s]*)(\"|)/g,"> $2 <");
  text=text.replace(/\<[^\<\>]+\>/g,"\n");
  text=text.replace(/ +/g," ");
  text=text.replace(/\n+/g,"\n");
  text=text.replace(/^\n*/gm,"");
  text=text.replace(/^\s*/gm,"");
  text=text.replace(/\n*$/gm,"");
  text=text.replace(/\s*$/gm,"");
	document.commentForm.Content.value += "[quote="+ autName +" said:"+"]"+text+"[/quote]\n";
	window.location.hash="commentbox";
}

