//留言
function messageAdd(message){
	if(message=="")
	{
		alert("你忘记写留言内容了吧？~呵呵");
	}
	else
	{
		$("#newSuggestion input").attr("disabled","disabled");
		$("#newSuggestion textarea").attr("disabled","disabled");
		$("#newSuggestion h4").html("正在提交留言数据...");
		$.ajax({
			type: "POST",
			url: "ajax/message_add.php",
			data: "message="+message+"",
			success: function(data){
				$("#newSuggestion h4").fadeIn(1000).html("留言成功！你可以再写一条留言~");
				$("#newSuggestion input").removeAttr("disabled");
				$("#newSuggestion textarea").removeAttr("disabled").val("");
				tmp_html = $("#suggestionList ol").html();
				$("#suggestionList ol").html(data).append(tmp_html);
			},
			error: function(){
				$("#newSuggestion h4").html("留言失败，请重试！");
				$("#newSuggestion input").removeAttr("disabled");
				$("#newSuggestion textarea").removeAttr("disabled");
			}
		});
	}
}
//评论
function commentAdd(comment,id){
	if(comment=="")
	{
		alert("你忘记写评论内容了吧？~呵呵");
	}
	else
	{
		$("#newSuggestion input").attr("disabled","disabled");
		$("#newSuggestion textarea").attr("disabled","disabled");
		$("#newSuggestion h4").html("正在提交留言数据...");
		$.ajax({
			type: "POST",
			url: "ajax/comment_add.php",
			data: "message="+comment+"&id="+id,
			success: function(data){
				$("#newSuggestion h4").fadeIn(1000).html("评论成功！你可以再写一条留言~");
				$("#newSuggestion input").removeAttr("disabled");
				$("#newSuggestion textarea").removeAttr("disabled").val("");
				tmp_html = $("#suggestionList ol").html();
				$("#suggestionList ol").html(data).append(tmp_html);
			},
			error: function(){
				$("#newSuggestion h4").html("评论失败，请重试！");
				$("#newSuggestion input").removeAttr("disabled");
				$("#newSuggestion textarea").removeAttr("disabled");
			}
		});
	}
}
//搜索验证
function checkSearch()
{
	tmp_val = $("#sugSearch input[type=text]").val();
	if(tmp_val == "" || tmp_val == "再此输入意见反馈关键字...")
	{
		alert("请输入一些你要搜索的文字");
		return false;
	}
}

   function vote(){
	alert("xxxxxx");
   }

//交通位置图 最大宽度设定
function set_image_width(fix_width)
{
	var image=new Image();
	image.src=$(".traffic_image img").attr("src");
	if( image.width > fix_width )
	{
		$(".traffic_image").html("<a href=\""+image.src+"\" target=\"_blank\"><img width=\""+fix_width+"\" src=\""+image.src+"\" title=\"点击查看完整交通位置图\" alt=\"点击查看完整交通位置图\" \/><\/a>");	
	}
}

//滚动专家照片
function startScroll(speed,li_width,liCount_fix){
	//var speed=2 //速度数值越大速度越慢
	//var li_width=83 //滚动元素LI占用的像素宽度
	//var liCount_fix=7 //一行同时能容纳的LI数
	var scrollWarp1=document.getElementById("scrollWarp1");
	var scrollWarp2=document.getElementById("scrollWarp2");
	var scrollWarp=document.getElementById("scrollWarp");
	var liCount = $("#scrollWarp2 ul li").length;
	var scrollWarp1_width = (liCount*li_width)*2;
	var scrollWarp2_width = liCount*li_width;
	var scrollWarp_width = parseFloat(scrollWarp.style.width);
	scrollWarp1.style.width=scrollWarp1_width+"px";
	scrollWarp2.style.width=scrollWarp2_width+"px";
	if(liCount>liCount_fix){
		scrollWarp1.innerHTML+=scrollWarp1.innerHTML;
		scrollWarp.scrollLeft=0;
		function Marquee(){
			if(scrollWarp.scrollLeft>=(scrollWarp1_width-scrollWarp_width)){
				scrollWarp.scrollLeft=(scrollWarp2_width-scrollWarp_width);
			}
			scrollWarp.scrollLeft++;
		}
		var MyMar=setInterval(Marquee,speed)
		scrollWarp1.onmouseover=function() {clearInterval(MyMar)}
		scrollWarp1.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
	}
}
