﻿// 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]).onclick = 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 scrollDoor2() {
}
scrollDoor2.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;
    }
}
window.onload=function(){
var SDmodel = new scrollDoor();
	SDmodel.sd(["m01","m02","m03","m04","m05","m06","m07"],["c01","c02","c03","c04","c05","c06","c07"],"asd01","asd02");
	SDmodel.sd(["n01","n02"],["s01","s02"],"sn01","sn02");
	SDmodel.sd(["n03","n04"],["s03","s04"],"sn01","sn02");
	SDmodel.sd(["n05","n06"],["s05","s06"],"sn01","sn02");
	SDmodel.sd(["n07", "n08"], ["s07", "s08"], "sn01", "sn02");
var SDmodel2 = new scrollDoor2();
	SDmodel2.sd(["n01", "n02"], ["s01", "s02"], "sn01", "sn02");
	SDmodel2.sd(["n03", "n04"], ["s03", "s04"], "sn01", "sn02");
	SDmodel2.sd(["n05", "n06"], ["s05", "s06"], "sn01", "sn02");
	SDmodel2.sd(["n07", "n08"], ["s07", "s08"], "sn01", "sn02");
}
