// JavaScript Document
function scrollDoor(){
}
scrollDoor.prototype = {
sd : function(menus,divs,openClass,closeClass){
 var _this = this;
 if(menus.length != divs.length)
 {
  alert("菜单层数量和内容层数量不一样!");
  return false;
 }    
 for(var i = 0 ; i < menus.length ; i++)
 { 
  _this.$(menus[i]).value = i;    
  _this.$(menus[i]).onmouseover = function(){
     
   for(var j = 0 ; j < menus.length ; j++)
   {      
    _this.$(menus[j]).className = closeClass;
    _this.$(divs[j]).style.display = "none";
   }
   _this.$(menus[this.value]).className = openClass; 
   _this.$(divs[this.value]).style.display = "block";    
  }
 }
 },
$ : function(oid){
 if(typeof(oid) == "string")
 return document.getElementById(oid);
 return oid;
}
}
function scrollImg(){
	var speed=20
	var scroll_begin = document.getElementById("scroll_begin");
	var scroll_end = document.getElementById("scroll_end");
	var scroll_div = document.getElementById("scroll_div");
	scroll_end.innerHTML=scroll_begin.innerHTML
	  function Marquee(){
		if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
		  scroll_div.scrollLeft-=scroll_begin.offsetWidth
		else
		  scroll_div.scrollLeft++
		
	  }
	var MyMar=setInterval(Marquee,speed)
	scroll_div.onmouseover=function() {clearInterval(MyMar)}
	scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}

function scrollImgdoc(container,content,speed,distance,pause,direction){
	var $ = function(id){ return document.getElementById(id);};
	var direction = +!!direction;
	container = $(container);
	content = container.getElementsByTagName(content);
	var totalheight = content[0].offsetHeight * content.length;
	container.innerHTML += container.innerHTML;
	var currentlocation = [0,totalheight][direction];
	+function(){
		var interval = container.scrollTop % distance ? speed:pause;
		currentlocation+=[1,-1][direction];
		currentlocation == [totalheight,0][direction] ? currentlocation = [0,totalheight][direction]:'';
		container.scrollTop = currentlocation;
		setTimeout(arguments.callee,interval);
	}()
	return arguments.callee;
}
