
document.write("<script language=javascript src='js/utils.js'></script>");
var xmlhttp;
function createXMLhttp() {
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (oc) {
			xmlhttp = null;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function getOs() {
	var OsObject = "";
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		return "MSIE";       //IE浏览器
	}
	if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
		return "Firefox";     //Firefox浏览器
	}
	if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
		return "Safari";      //Safan浏览器
	}
	if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
		return "Camino";   //Camino浏览器
	}
	if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) {
		return "Gecko";    //Gecko浏览器
	}
}
function sendAdvice(){
var content = document.getElementById("content");
var email = document.getElementById("email");

updateAdviceAjax(email.value,content.value);
}
function inputMouse(obj,word){

if(obj.value == word){
	obj.value = "";
}

}
function inputOverMouse(obj,word){
	if(obj.value == ""){
		obj.value = word;
	}
}
function updateAdviceAjax(email,content) {
	var url = baseUrl + "/ajax/Advice.sl?email="+email+"&content="+content+"";
	var btype = getOs();
	xmlhttp = createXMLhttp();
	xmlhttp.open("POST", url, false);
	xmlhttp.onreadystatechange = (btype != "Firefox") ? (updateAdvice) : (updateAdvice());
	xmlhttp.send(null);
	xmlhttp.onreadystatechange = (btype != "Firefox") ? (updateAdvice) : (updateAdvice());
}
function updateAdvice() {
	if (xmlhttp.readyState == 4) {
		var message = "";
		var email = xmlhttp.responseXML.getElementsByTagName("email")[0].firstChild.nodeValue;
	
		var content = xmlhttp.responseXML.getElementsByTagName("content")[0].firstChild.nodeValue;
		var ip = xmlhttp.responseXML.getElementsByTagName("ip")[0].firstChild.nodeValue;
		if(email=="true"&&content=="true"&&ip=="true"){
			window.alert("提交成功!");
		}else{
		
			if(email == "false"){
				message = "邮箱格式错误！\n";
			}
			if(content == "false"){
				message += "内容部能为空且不能大于100！\n";
			}
			if(ip == "false"){
				message += "一天内不能重复提交！";
			}
				window.alert(message);	
		}
		
	}
}
	function refreshUpdateTimeAjax(){
		var url = baseUrl + "/ajax/RefreshUpdateTime.sl";
		var btype = getOs();
		xmlhttp = createXMLhttp();
		xmlhttp.open("POST", url, false);
		xmlhttp.onreadystatechange = (btype != "Firefox") ? (refreshUpdateTime) : (refreshUpdateTime());
		xmlhttp.send(null);
		xmlhttp.onreadystatechange = (btype != "Firefox") ? (refreshUpdateTime) : (refreshUpdateTime());
	}
	function refreshUpdateTime(){
		if (xmlhttp.readyState == 4) {
			var times = xmlhttp.responseXML.getElementsByTagName("times")[0].firstChild.nodeValue;
			var uptimes = xmlhttp.responseXML.getElementsByTagName("uptimes")[0].firstChild.nodeValue;
			document.getElementById("times").innerHTML=times;
			document.getElementById("uptimes").innerHTML=uptimes;
		}
	}