﻿// JavaScript Document
//复制内容自动添加版权信息
document.body.oncopy = function ()
{
    setTimeout(
        function ()
        {
            var text = clipboardData.getData("text");
            if (text)
            {
				
				var ins=jmz.GetLength(text);
				var inst=ins
				if (ins>10)
				{
				ins=parseInt(ins/4);
				aa=text.substring(0,ins);
				bb=text.substring(ins,inst);//substring
				text=aa+" from："+ location.href + " " + bb;
				}
				
                text = text + "\r\nfrom："+location.href;
                clipboardData.setData("text", text);
            }
        },
        100
    )
}
window.onload = function()
{
    this.focus();
}

var jmz = {};
jmz.GetLength = function(str) {
    var realLength = 0, len = str.length, charCode = -1;
    for (var i = 0; i < len; i++) {
        charCode = str.charCodeAt(i);
        if (charCode >= 0 && charCode <= 128) realLength += 1;
        else realLength += 2;
    }
    return realLength;
};

function saveTXT2()
{
	var i=1;
	if (trim(document.getElementById("title1").value) == "")
		{
			alert("问题分类不能为空") ;
			i=0;
			return;
			
		}
		if (trim(document.getElementById("tel").value) == "")
		{
			alert("电话不能为空") ;
			i=0;
			return;
		}
		if (trim(document.getElementById("username").value) == "")
		{
			alert("联系人不能为空") ;
			i=0;
			return;
		}
		if (trim(document.getElementById("words").value) == "")
		{
			alert("留言不能为空") ;
			i=0;
			return;
		}
	if(i==1){document.getElementById("forn1").submit();}
	else{return;}
}
function trim(string) {
    return string.replace(/(^\s*)|(\s*$)/g, "");

}
