//验证留言内容
function checkContent(){
	var email = document.getElementById("wlemail");
	if(email.value!="" && email.value!="Email"){
	   if(isRightEmail(email.value)==0){
	   		alert("Email格式不正确！");
	   		email.value="";
	   		email.focus();
		   	return false;
	   }
	   if(email.value.length > 20){
	 		alert("email不能超过20个字！");
	 		email.value="";
	 		email.focus();
	 		return false;
	    }
	}else{
		email.value="";
	}
	var title = document.getElementById("wltitle");
	if(title.value==""){
		alert("标题不能为空！");
		title.focus();
		return false;
	}
	if(title.value.length > 10){
	 	alert("标题不能超过10个字！");
	 	title.value="";
	 	title.focus();
	 	return false;
	}
	var content = document.getElementById("wlcontent");
	if(content.value==""){
		alert("留言内容不能为空！");
		content.focus();
		return false;
	}
	if(content.value.length > 500){
	 	alert("留言内容不能超过500个字！");
	 	content.focus();
	 	return false;
	}
	return true;
}
function clearInput(obj){
	obj.value="";
}
function ajaxSubmit(){
	if(checkContent() == false){
		return false;
	}else{
		var d="title="+$j("#wltitle").val()+"&content="+$j("#wlcontent").val()+"&email="+$j("#wlemail").val();
		$j.ajax({
		type:"post",
		url:"./webLwordFrontAction!saveFromIndex.action",
		data:d,
		cache:false,
		datatype:"html",
		success:function(data){
			if(data=="true"){
				alert("留言成功！");
				$j("#wlemail").val("");
				$j("#wltitle").val("");
				$j("#wlcontent").val("");
			}else{
				alert("留言失败！");
			}
	   	}
		});
	}
}
function loadSupply(){
$j.ajax({
		url:"./supplyAction!getSupply.action",
		cache:false,
		datatype:"html",
		success:function(data){
			$j("#mysupply").html(data);
			setTimeout('loadSupply()',300000);
	   	}
		});
}
function loadLevaeMsg(){
$j.ajax({
		url:"./webLwordFrontAction!getIndexList.action",
		cache:false,
		datatype:"html",
		success:function(data){
			$j("#message_a3").html(data);
			setTimeout('loadLevaeMsg()',300000);
	   	}
		});
}
function start(){
	var obj = document.getElementById("tip");
	if(parseInt(obj.style.height)==0){
		obj.style.display = "block";
		handle = setInterval("changeH('up')",2);
	}else{
		handle = setInterval("changeH('down')",2);
	}
}
function changeH(str){
	var obj = document.getElementById("tip");
	if(str=='up'){
		if(parseInt(obj.style.height)>114){
			clearInterval(handle);
		}else{
			obj.style.height =(parseInt(obj.style.height)+8).toString()+"px";
		}
	}
	if(str=='down'){
		if(parseInt(obj.style.height)<8){
			clearInterval(handle);
			obj.style.display="none";
		}else{
			obj.style.height =(parseInt(obj.style.height)-8).toString()+"px";
		}
	}
}
function myTimer(){
	start();
}
function sc(){
	document.getElementById("tip").style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("tip").offsetHeight)+"px";
	document.getElementById("tip").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("tip").offsetWidth)+"px";
}