//兼容火狐
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
    if (window.ActiveXObject)
        Sys.ie = ua.match(/msie ([\d.]+)/)[1]
    else if (document.getBoxObjectFor)
        Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
    else if (window.MessageEvent && !document.getBoxObjectFor)
        Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
    else if (window.opera)
        Sys.opera = ua.match(/opera.([\d.]+)/)[1]
    else if (window.openDatabase)
        Sys.safari = ua.match(/version\/([\d.]+)/)[1];

if(Sys.firefox){
    HTMLElement.prototype.__defineGetter__("children",
         function () {
             var returnValue = new Object();
             var number = 0;
             for (var i=0; i<this.childNodes.length; i++) {
                 if (this.childNodes[i].nodeType == 1) {
                     returnValue[number] = this.childNodes[i];
                     number++;
                 }
             }
             returnValue.length = number;
             return returnValue;
         }
     );
}

//点击切换效果
//function ChangeDiv(obj1, obj2) {
//    for (i = 0; i < obj2.children.length; i++) {
//        obj2.children[i].style.display = 'none';
//        if (i == obj1.id) {
//            obj2.children[i].style.display = '';
//        }
//    }
//}
//function Divfff(fidd, ffidd) {
//    var t = document.getElementById(fidd);
//    var i = 0;
//    var tt = document.getElementById(ffidd);
//    tt.children[0].style.display = 'block';
//    t.children[0].className = 'on';
//    for (i = 0; i < t.children.length; i++) {
//        t.children[i].id = i;
//        t.children[i].onclick = function() {
//            ChangeDiv(this, tt);
//        }

//    }
//}
Divff("mod", "changeBox");


//版面切换效果  

function switchmodTag(modtag,b) {
var r=modtag.parentNode;
var t = b;
for(var i=0;i< r.children.length;i++)
	{
		r.children[i].className='';
	}
	for(var j=0;j< t.children.length;j++)
	{
		t.children[j].style.display='none';
		if(modtag.id==j)
		{
			t.children[j].style.display='';
		}
	}
	modtag.className='on';
  }
function Divff(fid,ffid) {
    if (document.getElementById(fid)) {
	var t=document.getElementById(fid);
	var i = 0;
	
	    var tt = document.getElementById(ffid);
	    tt.children[1].style.display = 'block';
	    t.children[1].className = 'on';
	    for (i = 0; i < t.children.length; i++) {
	        t.children[i].id = i;
	        t.children[i].onmouseover = function() {
	            switchmodTag(this, tt);
	        }

	    }
	}
}

Divff("changebnt", "infotopbox");
  
//图片切换效果

//var n = 0;
function Mea(value) {
    n = value.id;
    setBg(value);
    plays(value.id);
}
function setBg(value) {
    var r = value.parentNode;
    for (var i = 0; i < r.children.length; i++) {
        r.children[i].className = '';
    }
    value.className = 'on';
}

function setBgp(s)
{
	
	var t = document.getElementById("imgbox");
	for (var i = 0; i < t.children.length; i++) {
		t.children[i].className = '';
    }
	t.children[s].className='on';
}

function plays(value) {
    var t = document.getElementById("fc");
    for (i = 0; i < t.children.length; i++) {
        i == value ? t.children[i].style.display = "block" : t.children[i].style.display = "none";
    }
}
var n = 0;
function clearAuto() { clearInterval(autoStart) }
function setAuto() { autoStart = setInterval(function() { auto() }, 3000) }
function auto() {
    n++;
    if (n > 3) n = 0;
	
	 setBgp(n);
	 plays(n);
}
//function sub() {
//    n--;
//    if (n < 0) n = 2;
//	setBg(value);
//    plays(value.id);
//}

function f(fid) {
    if (document.getElementById(fid)) {
        var t = document.getElementById(fid);
        var i = 0;
        t.children[0].className = 'on';
        plays(0);
        for (i = 0; i < t.children.length; i++) {
            t.children[i].id = i;
            t.children[i].onmouseover = function() {
                clearAuto();
                Mea(this);
            }
            t.children[i].onmouseout = function() {
                setAuto();
            }
        }
    }
}
f("imgbox");
setAuto();




