function getElement(id){
	return typeof id == "string" ? document.getElementById(id) : id ;
}

var changeClass=function(id,c,tag) {
	var el=getElement(id).getElementsByTagName(tag),
	len=el.length,
	j=[];
	for(var i=0; i<len; i++){
		var reg=new RegExp(c,"g");
		if(reg.test(el[i].className)){
			j.push(i);
			with({i:i}){
				el[i].onmouseover=function(){
					for(var n=0,nn=j.length;n<nn;n++){
						el[j[n]].className=c+"_nor";
					}
					this.className=c+"_cur";
				}
			}
		}
	}
};

var adv = function(id) {
    var interv = 2000,
    interv2 = 10,
    opac1 = 80,
    source = id;
    function getTag(tag, obj) {
        if (obj == null) {
            return document.getElementsByTagName(tag)
        } else {
            return obj.getElementsByTagName(tag)
        }
    }
    function getid(id) {
        return document.getElementById(id)
    };
    var opac = 0,
    j = 0,
    t = 63,
    num,
    scton = 0,
    timer,
    timer2,
    timer3;
    var id = getid(source);
    id.removeChild(getTag("div", id)[0]);
    var li = getTag("li", id),
    div = document.createElement("div"),
    title = document.createElement("div"),
    span = document.createElement("span"),
    button = document.createElement("div");
    button.className = "button";
    for (var i = 0; i < li.length; i++) {
        var a = document.createElement("a");
        a.innerHTML = i + 1;
        a.onclick = function() {
            clearTimeout(timer);
            clearTimeout(timer2);
            clearTimeout(timer3);
            j = parseInt(this.innerHTML) - 1;
            scton = 0;
            t = 63;
            opac = 0;
            fadeon()
        };
        a.className = "b1";
        a.onmouseover = function() {
            this.className = "b2"
        };
        a.onmouseout = function() {
            this.className = "b1";
            sc(j)
        };
        button.appendChild(a)
    }
    function alpha(obj, n) {
        if (document.all) {
            obj.style.filter = "alpha(opacity=" + n + ")"
        } else {
            obj.style.opacity = (n / 100)
        }
    }
    function sc(n) {
        for (var i = 0; i < li.length; i++) {
            button.childNodes[i].className = "b1"
        };
        button.childNodes[n].className = "b2"
    }
    title.className = "num_list";
    title.appendChild(span);
    alpha(title, opac1);
    id.className = "d1";
    div.className = "d2";
    id.appendChild(div);
    id.appendChild(title);
    id.appendChild(button);
    var fadeon = function() {
        opac += 5;
        div.innerHTML = li[j].innerHTML;
        span.innerHTML = getTag("img", li[j])[0].alt;
        alpha(div, opac);
        if (scton == 0) {
            sc(j);
            num = -2;
            scrolltxt();
            scton = 1
        };
        if (opac < 100) {
            timer = setTimeout(fadeon, interv2)
        } else {
            timer2 = setTimeout(fadeout, interv)
        }
    };
    var fadeout = function() {
        opac -= 5;
        div.innerHTML = li[j].innerHTML;
        alpha(div, opac);
        if (scton == 0) {
            num = 2;
            scrolltxt();
            scton = 1
        };
        if (opac > 0) {
            timer = setTimeout(fadeout, interv2)
        } else {
            if (j < li.length - 1) {
                j++
            } else {
                j = 0
            };
            fadeon()
        }
    };
    var scrolltxt = function() {
        t += num;
        span.style.marginTop = t + "px";
        if (num < 0 && t > 3) {
            timer3 = setTimeout(scrolltxt, interv2)
        } else if (num > 0 && t < 62) {
            timer3 = setTimeout(scrolltxt, interv2)
        } else {
            scton = 0
        }
    };
    fadeon()
}

/*var scrollEl=document.compatMode!="BackCompat" ? document.documentElement: document.body,
t=0,
h=function(msg,top){
	var d=document.createElement("div");
	d.style.cssText="width:120px; min-height:200px; _height:200px; background:#ffffff; border:1px solid #c5c5c5; position:absolute; top:0px; right:5px; ";
	d.innerHTML=msg;
	d.id="$ms";
	document.body.appendChild(d);
	setInterval(function(){t=top; move(t)},20)
},
move=function(t){
	var s=scrollEl.scrollTop,
	_top=getElement("$ms").offsetTop,
	dist=dis(_top,t+s);
	if(t < _top+s){
		getElement("$ms").style.top=_top+dist+"px";
		setTimeout(arguments.callee,20);
	}else {
		t=getElement("$ms").offsetTop
	}
};
function dis(st,end){
	return st<end ? Math.ceil((end-st)/10) : Math.ceil((st-end)/10)
}*/
		











