// JavaScript Document
var xmlHttp;
function  createXMLHTTP()//创建对像
{
       if (window.XMLHttpRequest)
        {
        xmlHttp=new XMLHttpRequest();//mozollia
        }
        else if(window.ActiveXObject)
        {
           try
             {
             xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");//ie老版本
             }
           catch(e)
             {
             }
           try
             {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");//ie新版本
             }
           catch(e)
             {
             }
            if(!xmlHttp)
              {
               window.alert("不能创建XMLHTTPRequset对象实例");
               return false;
              }
      } 
}
//列出选择的日期对联
function change_list()
{
   createXMLHTTP();//
   var year=document.date.year.value;//
   var month=document.date.month.value;
   var day=document.date.day.value;//
   var date=year+"-"+month+"-"+day;//
   var url="change_list.php?date="+date;
   xmlHttp.open("GET",url,true);//用GET方式进行提交
   xmlHttp.onreadystatechange=pro_back;
   //xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
}
function list_show()
{
   createXMLHTTP();//
   var url="change_list.php?date=";
   xmlHttp.open("GET",url,true);//用GET方式进行提交
   xmlHttp.onreadystatechange=pro_back;
   //xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
}
function pro_back()
{
   	if(xmlHttp.readyState==1){
	document.getElementById('date_show').innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	  }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById('date_show').innerHTML=stat;
	 }
	 }	
}
//罗列所选月份天数处理
function change_day(i)
{
   createXMLHTTP();//
   var url="change_list_day.php?v="+encodeURIComponent(i);
   xmlHttp.open("GET",url,true);//用GET方式进行提交
   xmlHttp.onreadystatechange=daylist;
   xmlHttp.send(null);//
}
function daylist()
{
   	if(xmlHttp.readyState==1){
	document.getElementById('daylist').innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById('daylist').innerHTML=stat;
	 }
	 }	
}
//准确日子对联列表
//列表分页
function goto(i)
{
   createXMLHTTP();//
   var url="change_list.php?page="+encodeURIComponent(i);
   xmlHttp.open("GET",url,true);//用GET方式进行提交
   xmlHttp.onreadystatechange=pro_back;
   //xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
}
//检测评论
function chk_comment()
{
   if(document.comment.comment_user.value.replace(/\s/g,"")==""){
	  document.comment.comment_user.value='';//
	  document.getElementById('sub_note').innerHTML='<font color=\"#993030\">评论人不可以为空格</font>';
	  setTimeout("document.getElementById('sub_note').innerHTML=''",3000);//
	  return false;//
	  }
   if(document.comment.comment_user.value.length<2){
	  document.getElementById('sub_note').innerHTML='<font color=\"#993030\">评论人不可以少于2个字符</font>';
	  setTimeout("document.getElementById('sub_note').innerHTML=''",3000);//
	  return false;//
	 }
	if(document.comment.comment_content.value.replace(/\s/g,"")==""){
	  document.comment.comment_content.value='';//
	  document.getElementById('sub_note').innerHTML='<font color=\"#993030\">评论内容不可以为空格</font>';
	  setTimeout("document.getElementById('sub_note').innerHTML=''",3000);//
	  return false;//
	  }
   if(document.comment.comment_content.value.length<5||document.comment.comment_content.value.length>500){
	  document.getElementById('sub_note').innerHTML='<font color=\"#993030\">评论内容长度不可以少于5个字符与大于500个字符</div>';
	  setTimeout("document.getElementById('sub_note').innerHTML=''",3000);
	  return false;//
	 }
 /*
   if(document.comment.vcode.value.length!=4){
	  document.getElementById('sub_note').innerHTML='<font color=\"#993030\">验证码格式错误</div>';
	  setTimeout("document.getElementById('sub_note').innerHTML=''",3000);
	  return false;//
	 }
*/
  //以上都通过时
  var c_user=document.comment.comment_user.value;
  var c_content=document.comment.comment_content.value;//
  var comment_id=document.comment.did.value;//
  var url="sub_dl_comment.php";//
  createXMLHTTP();//
  xmlHttp.open("POST",url,true);//
  xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlHttp.onreadystatechange=sub_dl_comment;
  xmlHttp.send("user="+c_user+"&content="+c_content+"&did="+comment_id);
  function sub_dl_comment()
{
   	if(xmlHttp.readyState==1){
	document.getElementById('comment_note').innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById('comment_note').innerHTML=stat;
	document.getElementById('comment_user').value='';
	document.getElementById('comment_content').value='';
	//document.getElementById('vcode').value='';
	 }
	 }	
}
}
//顶评论的内容
<!-- 屏蔽所有JS错误提示
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
function ding(id)
{
   var url='comment_ding.php?id='+id;
   var note='ding'+id;//
   createXMLHTTP();//
   xmlHttp.open("GET",url,true);//
   xmlHttp.onreadystatechange=pro_ding;//
   //xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
   function pro_ding(){
    if(xmlHttp.readyState==1){
	document.getElementById(note).innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById(note).innerHTML=stat;
    }
	}
    }
}
//引用 回复 js //
function quote(i)
{
   document.getElementById('comment_content').value="<font color='#FF0000'>引用 "+i+" 楼的评论说</font><br>";//
   document.getElementById('comment_content').focus();//
}
function reply(i)
{
   document.getElementById('comment_content').value="<font color='#FF0000'>回复 "+i+" 楼的评论说</font><br>";//
   document.getElementById('comment_content').focus();//
}
/*对联支持*/
function sding(id)
{
   var url='couplet_ding.php?sid='+id;
   var note='sding'+id;//
   createXMLHTTP();//
   xmlHttp.open("GET",url,true);//
   xmlHttp.onreadystatechange=pro_sding;//
   //xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
   function pro_sding(){
    if(xmlHttp.readyState==1){
	document.getElementById(note).innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById(note).innerHTML=stat;
    }
	}
    }
}
/*对联反对*/
function ading(id)
{
   var url='couplet_ding.php?aid='+id;
   var note='ading'+id;//
   createXMLHTTP();//
   xmlHttp.open("GET",url,true);//
   xmlHttp.onreadystatechange=pro_ading;//
   //xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
   function pro_ading(){
    if(xmlHttp.readyState==1){
	document.getElementById(note).innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById(note).innerHTML=stat;
    }
	}
    }
}

/*首页对联列表切换*/
function newgoto(i)
{
   var url='change_index.php?page='+i;
   createXMLHTTP();//
   xmlHttp.open("GET",url,true);//
   xmlHttp.onreadystatechange=pro_new;//
   xmlHttp.setRequestHeader("If-Modified-Since","0"); 
   xmlHttp.send(null);//
}
   function pro_new(){
    if(xmlHttp.readyState==1){
	document.getElementById('newlist').innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById('newlist').innerHTML=stat;
    }
	}
}
/*对联是否重复检测*/
function chk_repeat(a)
{
   	var url='couplet_repeat.php?key='+encodeURIComponent(a);
	//var word=document.getElementById('couplet').value;//
	createXMLHTTP();//
	xmlHttp.open("GET",url,true);//
	xmlHttp.onreadystatechange=repeat;//
	xmlHttp.setRequestHeader("If-Modified-Since","0");//不调用缓存
	xmlHttp.send(null);//
	//
	function repeat(){
	if(xmlHttp.readyState==1){
	document.getElementById('mg').innerHTML="<img src='http://www.liantianhong.com/templets/images/loading.gif'>";
	 }
	if(xmlHttp.readyState==4){
	if(xmlHttp.status == 200){
	var stat= xmlHttp.responseText;
	document.getElementById('mg').innerHTML=stat;
    }
	}
    }
	
}













