function docGetId(divId){
    return document.getElementById(divId);
}
function confirmInfo(info){
    if(confirm(info,false)){
        return true;
    }else{
        return false ;
    }
}
function stop(info){
	if(confirm("确认要结束"+info+"吗?",false))
	{
	   return true;
	}else{
	    return false ;
	}
}
function searchCheck(searchKeyword){
    searchId = document.getElementById(searchKeyword);
	if(searchId.value == searchId.defaultValue){

		alert("请输入要查找的内容！！！");
		return false;

	}

}
function inputBCheck(input){
	if(input.value == input.defaultValue || input.value == false){
		input.value = "";
		input.style.color = "#000000";
	}
}
function inputACheck(input){
	if(input.value == "" || input.value == false ){
		input.value = input.defaultValue;
		input.style.color = "#B8B8B8";
	}
}
function displayInfo(divId, info){
	var targetDivId = divId + 'Err';
	var targetDiv = document.getElementById(targetDivId);
	targetDiv.style.visibility = "visible";
	targetDiv.innerHTML = info;
}
function undisplayInfo(divId){
	var targetDivId = divId + 'Err';
	var targetDiv = document.getElementById(targetDivId);
	targetDiv.style.visibility = "hidden";
	targetDiv.innerHTML = "";
}
function checkNull(divId, info){
	if(!docGetId(divId)) return true;
	subject = docGetId(divId);
	if(subject){
	     if(subject.value == "" || subject.value == false){
	         displayInfo(divId, info+'不能为空！');
	         return false;
	     }
	}
	return true;
}
function checkNum(divId, info){
	if(!docGetId(divId)) return true;
	subject = docGetId(divId);
	if(subject){
	     if(subject.value.match(/[^\d+$]/)){
	         displayInfo(divId, info+'请输入数字！');
	         return false;
	     }
	}
	return true;
}
function checkPoint(pointId, limitPoint, myYulingbi){
	str = document.getElementById(pointId).value;
	if(!checkNull(pointId,'预灵币')) return false;
	if(!checkNum(pointId,'预灵币')) return false;
	if(str < limitPoint){
		displayInfo(pointId, '预灵币请输入'+limitPoint+'以上！');
	    return false;
	}
	if(str > myYulingbi){
		displayInfo(pointId, '你的预灵币不足'+ str + '！');
	    return false;
	}
	return true;
}

function checkDate(dateId){
	str = document.getElementById(dateId).value;
	str = str.replace("-","");
	str = str.replace("-","");

	var date = new Date();
	var now = "";
	year = date.getFullYear();
	now= now + year;
	month =(date.getMonth()+1);
	if(month>=10){
		now= now + month;
	}
	else{
		now= now +"0"+ month;
	}
	day =date.getDate();
	if(day<10){
		now= now +"0"+ day;
	}
	else{
		now= now + day;
	}
	nextyear=date.getTime()+(365*24*60*60*1000);

	if(parseInt(str) <= parseInt(now)){
		alert("结束日期不能早于今天！！！");
		return false;
	}
	date.setTime(nextyear);
	var now = "";
	year = date.getFullYear();
	now= now + year;
	month =(date.getMonth()+1);
	if(month>=10){
		now= now + month;
	}
	else{
		now= now +"0"+ month;
	}
	day =date.getDate();
	if(day<10){
		now= now +"0"+ day;
	}
	else{
		now= now + day;
	}
	if(parseInt(str) >= parseInt(now)){
		alert("结束日期不能超过一年！！！");
		return false;
	}
	return true;
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
	  func();
      oldonload();
    }
  }
}
function replyMember(memberName ,memberId){
	docGetId('to_member_id').value = memberId;
	docGetId('comment_message').value = '回复'+memberName + ':';
}
function replyMemberStatus(memberName ,memberId, key){
	docGetId('to_member_id'+key).value = memberId;
	docGetId('comment_message'+key).value = '回复'+memberName + ':';
}
//支持(N>=0)楼
//function supportMember(memberName, memberNumber, memberId, c_commu_category_id, c_commu_topic_id){
//	docGetId('to_member_id').value = memberId;
//	if(memberNumber==0){
//		content = '支持楼主 ' +memberName + '!';
//		alert(content);
//		$.ajax( {
//		   type: "POST",
//		   url: "?m=pc&a=page_c_topic_write_insert_c_commu_topic_comment",
//		   data: "c_member_id=" + memberId + "&target_c_commu_category_id=" + c_commu_category_id + "&target_c_commu_topic_id=" + c_commu_topic_id + "&body=" + content,
//		   cache: false,
//		   dataType: "text",
//		   success: function(msg){
//               window.location="?m=pc&a=page_c_topic_detail&c_commu_category_id="+ c_commu_category_id +"&target_c_commu_topic_id=" + c_commu_topic_id;
//		   }
//		} );
//	}else{
//		content = '支持'+ memberNumber + '楼 ' +memberName + '!';
//		alert(content);
//		alert(memberId);
//		alert(c_commu_category_id);
//		alert(c_commu_topic_id);
//		$.ajax( {
//		   type: "POST",
//		   url: "?m=pc&a=page_c_topic_write_insert_c_commu_topic_comment",
//		   data: "c_member_id=" + memberId + "&target_c_commu_category_id=" + c_commu_category_id + "&target_c_commu_topic_id=" + c_commu_topic_id + "&body=" + content,
//		   cache: false,
//		   dataType: "text",
//		   success: function(msg){
//               window.location="?m=pc&a=page_c_topic_detail&target_c_commu_category_id="+ c_commu_category_id +"&target_c_commu_topic_id=" + c_commu_topic_id;
//		   }
//		} );
//	}
//}
//反对楼主
function opposeMember(memberName, memberNumber, memberId){
	docGetId('to_member_id').value = memberId;
	if (memberNumber == 0) {
		docGetId('comment_message').value = '反对' + '楼主 ' + memberName + ':';
	}else{
		docGetId('comment_message').value = '反对'+ memberNumber + '楼 ' + memberName + ':';
	}
}
//支持(N>=0)楼
//function supportMember(memberName, memberNumber, memberId){
//	docGetId('to_member_id').value = memberId;
//	if(memberNumber==0){
//		docGetId('comment_message').value = '支持'+ '楼主 ' +memberName + ':';
//	}else{
//		docGetId('comment_message').value = '支持'+ memberNumber + '楼 ' +memberName + ':';
//	}
//}
//反对楼主
//function opposeMember(memberName, memberNumber, memberId){
//	docGetId('to_member_id').value = memberId;
//	if (memberNumber == 0) {
//		docGetId('comment_message').value = '反对' + '楼主 ' + memberName + ':';
//	}else{
//		docGetId('comment_message').value = '反对'+ memberNumber + '楼 ' + memberName + ':';
//	}
//}
function klol(){
	alert('this is test');
}
function changeHeight(obj){
	obj.style.border = '1px solid #FFCC00 ';
	obj.value="";
}
function revertHeight(obj){
	obj.style.border = '1px solid #D7F3FF';

}
function displayCategory(category_list3){
	dlsplayStu = document.getElementById(category_list3);
	if(dlsplayStu.style.display == 'none'){
		dlsplayStu.style.display = '';
	}else{
		dlsplayStu.style.display = 'none';
	}
}
// 检测评论，留言内容是否为空
function checkComment(){
	    var comment_message =  document.getElementById("comment_message");
		var commentValue = comment_message.value;
		if(commentValue == ""){
		   alert("评论内容不能为空！");
                   return false;
		}
	}