// JavaScript Document
// tab
function tab(num){
	for(var id = 0;id<=6;id++)
	{
		if(id==num)
		{
			document.getElementById("tab_con"+id).style.display="block";
			document.getElementById("tab_option"+id).className="tab_on";
		}
		else
		{
			document.getElementById("tab_con"+id).style.display="none";
			document.getElementById("tab_option"+id).className="tab_off";
		}
	}
}

function doSubmit(){
	window.location.href = "/sc/searchByKeyWord.action?comment="+encodeURI(encodeURI($('#comment').val()))+"&currentNo="+$('#currentNo').val();
}

$(function(){
	$('#search').click(function(){
		doSubmit();
	});
});
// 文本域限制字数，显示剩余字数
function checkLen(obj)  
{ 
    var maxChars = 100;//最多字符数 
    if (obj.value.length > maxChars) 
    obj.value = obj.value.substring(0,maxChars); 
    var curr = maxChars - obj.value.length; 
    document.getElementById("count").innerHTML = curr.toString();
    if(curr<=0){
    	alert("请不要超过100个字符");
    	event.returnValue=false;
    }
} 



function ajaxAddtoAdvice(){
		$.ajax({
			//用POST方式传输
			type : "POST",
			//数据格式:JSON
			dataType : "json",
			//目标地址
			url : '/sc/ajaxSaveAdviceTwo.action',
			data : {
						"advice.adviceNo":$('#adviceNo').val(),
						"advice.adviceComment":$('#adviceCommon').val(),
						"advice.srand":$('#random').val(),
					},
			success : function(json) {
				if(json.success){
					window.location.reload();
					return true;
				}else{
					alert(json.instance);
					return false;
				}
			}
		});
		}

function ajaxUpdateStatus(){
	if(confirm('感谢您对7881的支持！满意后此问题即将关闭。')){
		$.ajax({
			//用POST方式传输
			type : "POST",
			//数据格式:JSON
			dataType : "json",
			//目标地址
			url : '/sc/ajaxUpdateStatus.action',
			data : {
						"advice.adviceNo":$('#adviceNo').val(),
					},
			success : function(json) {
				if(json.success){
					window.location.reload();
					return true;
				}else{
					alert(json.instance);
					return false;
				}
			}
		});
	}
	}