/*新闻信息*/
function initIndex()
{
  //showNews("news_sq",49,20);
  loadUserTop("E",1);
}

function loadUserTop(orderType,orderT)
{
    Ajax("post","/data.php?type=loadUserTop&orderType="+orderType+"&orderT="+orderT,showData);
	function showData(xmlHttp){
		if(xmlHttp.readyState==4){
		    var re=xmlHttp.responseText;
			$("userIndex").innerHTML=re;
		}else{
			$("userIndex").innerHTML="<img src='/style/images/ico/loading.gif' align=absmiddle />loading...";
		}
	}
}

function showNews(obj,classid,num)
{
	Ajax("post","news/data.php?type=shownews&classid="+classid+"&num="+num,showData);
	function showData(xmlHttp){
		if(xmlHttp.readyState==4){
			var root=xmlHttp.responseXML.documentElement;
			if(root.hasChildNodes)
			{	
				var htmlStr="<div class='newsList'><ul>";
				var items=root.childNodes;
				for(var i=0;i<items.length;i++)
				{
					var title=items[i].getElementsByTagName("title")[0].firstChild.nodeValue.substr(0,27);
					var id=items[i].getElementsByTagName("id")[0].firstChild.nodeValue;
					var addTime=items[i].getElementsByTagName("addTime")[0].firstChild.nodeValue;
					htmlStr+="<li id='t'><a target='_blank' href='/news/"+id+".shtml'>"+title+"</a></li><li id='d'>"+addTime+"</li>";
				}
				htmlStr+="</ul></div>";
				$(obj).innerHTML=htmlStr;
			}
		}else{
			$(obj).innerHTML="<img src='/style/images/ico/loading.gif' align=absmiddle />loading...";
		}
	}
}

function go_SearchD()
{
    var keyword=encodeURIComponent($("keyword").value);
	if($("keyword").value==null||$("keyword").value=="关键字如 欧洲杯、C罗等") {alert("请输入关键！");return false;};
	self.location="/video/download.php?keyword="+keyword;	
}

function SlideBox(container, frequency, direction) {
  if (typeof(container) == 'string') {
    container = document.getElementById(container);
  }
  this.container = container;
  this.frequency = frequency;
  this.direction = direction;
  this.films = [];
  var divs = this.container.getElementsByTagName('div');
  for (var i = 0; i < divs.length; i++) {
    if (divs[i].className == 'slideFilm') {
      divs[i].onmouseover = function(self){return function(){self._mouseover()};}(this);
      divs[i].onmouseout = function(self){return function(){self._mouseout()};}(this);
      this.films[this.films.length] = divs[i];
    }
  }
  this._playTimeoutId = null;
  this._slideTimeoutId = null;
  this._slidable = true;
 
  this._loop();
}
 
SlideBox.prototype = {
  _loop : function() {
    var sb = this;
    this._playTimeoutId = setTimeout(function(){sb._slide()}, this.frequency);
  },
 
  _slide : function() {
    var sb = this;
    var _slide = function() {
      if (!sb._slidable) return;
      var c = sb.container;
      if (sb.direction == 'top') {
        if (c.scrollTop < c.offsetHeight-2) {
          c.scrollTop += 2;
        } else {
          clearInterval(sb._slideTimeoutId);
          sb._loop();
          var ul = c.getElementsByTagName('ul')[0];
          ul.appendChild(c.getElementsByTagName('li')[0]);
          c.scrollTop = 0;
        }
      } else if (sb.direction == 'left') {
        if (c.scrollLeft < c.offsetWidth-2) {
          c.scrollLeft += 2;
        } else {
          clearInterval(sb._slideTimeoutId);
          sb._loop();
          var ul = c.getElementsByTagName('ul')[0];
          ul.appendChild(c.getElementsByTagName('li')[0]);
          c.scrollLeft = 0;
        }
      }
    }
    this._slideTimeoutId = setInterval(_slide, 10);
  },
 
  _mouseover : function() {
    this._slidable = false;
  },
 
  _mouseout : function() {
    this._slidable = true;
  }
}


