function Trim(Str){
	return Str.replace(/(^\s*)|(\s*$)/g, "");
}

function InputCheck(){
	InfoForm.ClientName.value=Trim(InfoForm.ClientName.value);
	InfoForm.Title.value=Trim(InfoForm.Title.value);
	InfoForm.Telephone.value=Trim(InfoForm.Telephone.value);
	InfoForm.Email.value=Trim(InfoForm.Email.value);
	InfoForm.Address.value=Trim(InfoForm.Address.value);
	InfoForm.ID_Card.value=Trim(InfoForm.ID_Card.value);
	InfoForm.Industry.value=Trim(InfoForm.Industry.value);

	if (InfoForm.ClientName.value==''){InfoForm.ClientName.focus();return false;}
	if (InfoForm.Title.value==''){InfoForm.Title.focus();return false;}
	if (InfoForm.QCID.value==''){alert('反馈类别为空');return false;}

	if (InfoForm.Telephone.value==''){InfoForm.Telephone.focus();return false;}
	reg=/^\w+@\w+\.\w{2,3}/;
	str=InfoForm.Email.value;
	r=str.match(reg);
	if (r==null){
		alert("请填写合法的email eg:Yourname@domain.com!");
		InfoForm.Email.focus();
		return false;
	}

	InfoForm.Content.value = document.all.htmlletter.contents;
	if (InfoForm.Content.value == "") {
		alert("信息内容不能为空");
		return false;
	}
	return true;
}

function InfoForm_onsubmit() {
	if (!InputCheck()){
		alert('输入信息不完整');
		return false;
	}
	return true;
}

function window_onload() {
	InfoData.async=false;
	InfoStyle.async=false;
	ListData.async=false;
	ShowUserClass.innerHTML=InfoData.transformNode(InfoStyle.documentElement);
	InfoData.src='Xml/Industry.xml';
	ShowIndustry.innerHTML=InfoData.transformNode(InfoStyle.documentElement);
	
	//加载信息类别列表部分
	InfoData.src="Xml/QClassList.jsp?Enable=true";
	InfoStyle.src="Xsl/QClassList.xsl";
	FirstPart.innerHTML=InfoData.transformNode(InfoStyle.documentElement);
	//加载信息标题列表部分
	InfoStyle.src="Xsl/CTableList.xsl";
	ThirdPart.innerHTML=InfoData.transformNode(InfoStyle.documentElement);
	WriteCurrPosition();
	FillTitleInfo();
	OtherFun();
}

function WriteCurrPosition(){
	Nodes=InfoData.documentElement;

	node=Nodes.selectNodes("//Item");
	Item=node.item(0);
	RedirectInfo(Item.attributes.getNamedItem('ID').text,Item.text);
}

function FillTitleInfo(){
	Nodes=InfoData.documentElement;
	nodes=Nodes.selectNodes("//Item");
	Count=Number(nodes.length);
	for(i=0;i<Count;i++){
		QCID=nodes.item(i).attributes.getNamedItem('ID').text;
		Url="Xml/QuestionList.jsp?PageSize=3&QCID=" + QCID;
		ListData.src=Url;
		ListNode=eval("TitleList" + QCID);
		ListNode.innerHTML=ListData.transformNode(ListStyle.documentElement);
		
		ShowMore=eval("ShowMore" + QCID);
		if (ListData.selectNodes("//总页数").item(0).text!='1'){
			ShowMore.style.display='block';
		}else{//没有更多信息
			ShowMore.style.display='none';
		}
	}
}

function RedirectInfo(ID,ItemName){
	CurrPosition.innerHTML=ItemName;
	InfoForm.QCID.value=ID;
}

