﻿function $(id) {
	return document.getElementById(id);	
}
function echo(obj,text) {
	$(obj).innerHTML=text;
}
var xmlhttp;
function createxmlhttp() {
	xmlhttp = false;
	if(window.XMLHttpRequest) { 
		xmlhttp = new XMLHttpRequest();
		if (xmlhttp.overrideMimeType) {
			xmlhttp.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	return xmlhttp;
}
function getdata(url,obj,fun)
{
	xmlhttp=createxmlhttp();
	if(!xmlhttp) {
		alert("请更新你的IE浏览器");
		return;
	}
	if(fun=="") {
		xmlhttp.onreadystatechange=requestdata;
	} else {
		xmlhttp.onreadystatechange=fun;
	}
	xmlhttp.open("get",url,true);
	xmlhttp.setRequestHeader("If-Modified-Since","0");
	xmlhttp.send(null);
	function requestdata() {		
		if(xmlhttp.readyState==4) {
			if(xmlhttp.status==200) {
				echo(obj,xmlhttp.responseText);
			}
			else { 
				alert('访问的页面有问题');
			}
		}		
	}
}
function Goto(id,type,index,rcount) {
	getdata("/news/Comment.aspx?id="+id+"&type="+type+"&page="+index+"&recordcount="+rcount,"comment","");
}
function checkComment(form) {
  form.action="http://www1.kugou.com/news/commenting.aspx";
  if(form.Content.value.length==0) {
    alert("内容不能为空！");
    form.Content.focus();
    return false;
  }
  if(form.Content.value.length>300) {
    alert("内容太长了！");
    return false;
  }
  return true;
}
