String.prototype.lenB=function(){
	return this.replace(/[^\x00-\xff]/g,"**").length;
}
function CheckIfEnglish(String)
{
    var Letters = "(!@$%^&*;':";
     var i;
     var c;
      if(String.charAt(0)=='-')
 return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
 for(i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
   if (Letters.indexOf( c ) > 0)
    return false;       
     }
     return true;
}
function checklen(info)
{
	return info.lenB();
}
function getContentLen()
{
	var con=$("#content").val();
	$("#loglength").html((140-con.length)+"字")
	if(con.length>140)
	{
		var subc=con.substring(0,140);
		$("#content").val(subc);
	}
}
function showreplay(k)
{
	$("#replay_box"+k).show();
}
function hiddenbox(k)
{
	$("#replay_box"+k).hide();
}
 
(function($){ 
$.fn.extend({ 
insertAtCaret: function(myValue){ 
var $t=$(this)[0]; 
if (document.selection) { 
this.focus(); 
sel = document.selection.createRange(); 
sel.text = myValue; 
this.focus(); 
} 
else 
if ($t.selectionStart || $t.selectionStart == '0') { 
var startPos = $t.selectionStart; 
var endPos = $t.selectionEnd; 
var scrollTop = $t.scrollTop; 
$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length); 
this.focus(); 
$t.selectionStart = startPos + myValue.length; 
$t.selectionEnd = startPos + myValue.length; 
$t.scrollTop = scrollTop; 
} 
else { 
this.value += myValue; 
this.focus(); 
} 
} 
}) 
})(jQuery);
//
function closediv(div)
{
	$("#"+div).hide(200);
}
function choseicon(k)
{
	$("#content").insertAtCaret("icon"+k+".gif");
}
function showtopic()
{
	$("#content").val("#请在这里输入话题名称#").focus();
}
function showshare()
{
	var html="<div class='share_title'><div class='close' onclick=\"closediv('moreContent');\"><span>分享视频，FLASH，音乐，图片等等媒体文件！</span><em>X</em></div>URL地址：<input type='text' name='s_title' id='s_title' style='width:350px;' value='http://'><Br/>说明内容：<input type='text' name='s_content' id='s_content' style='width:350px;'><input type='button' name='btn_s_send' id='btn_s_send' value='确认分享' onclick=\"btn_s_send_click();\"/></div>";
	$("#moreContent").show(300).html(html);
}
function btn_s_send_click()
{
	var s_title=$.trim($("#s_title").val());
	var s_content=$.trim($("#s_content").val());
	if((s_title=="")||(s_content==""))
	{
		alert('请输入您要分享的内容');
	}
	else
	{
		var share="@@"+s_title+"@@"+s_content;
		$("#content").val(share);
		closediv("moreContent");
	}
}
function isEmail(vEMail)
{
var regInvalid=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
var regValid=/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
return (!regInvalid.test(vEMail)&&regValid.test(vEMail));
}