function changeStyle(){ 
	var bg = document.getElementById("bg");
	bg.style.visibility = "visible"; 
    var bWidth=parseInt(document.documentElement.scrollWidth);
    var bHeight=parseInt(document.documentElement.scrollHeight); 
	bg.style.width = bWidth+"px"; 
	bg.style.height = bHeight+"px"; 
}

function resetStyle(){
	var bg = document.getElementById("bg");
	bg.style.visibility = "hidden";
	bg.style.width = "0px";
	bg.style.height = "0px";
	if(tm){
		clearTimeout(tm);
	}
	var tm = setTimeout(function(){
		clearStyle();
	},50);
}
var objcount=0;
var public_tempid=0;//记录是否移出div外
var index_tempv=0;
function a(v){  
	//document.getElementById("mmline1").style.display="none"; 
	hidediv(0);
	index_tempv=v;
	document.getElementById('nav1Content'+v).style.display='block';  
	//document.getElementById('nav_n'+v).style.background='#FFF';  
	
	document.getElementById('nav_n'+v).getElementsByTagName("a")[0].style.background='url(images/menu0'+(v+1)+'.gif) 0px -42px';  
	changeStyle();
}
function clearStyle(){
	if(document.getElementById("bg").style.visibility == "hidden"){
	    hidediv(1);
		public_tempid=0;//
	}
	clearopacity();
}
function hidediv(v){ 

	
    for(var i=0;i<_objcount;i++)
	{
		document.getElementById("nav1Content"+i).style.display="none";  
	    document.getElementById('nav_n'+i).getElementsByTagName("a")[0].style.background='url(images/menu0'+(i+1)+'.gif)';  
		//document.getElementById("nav_n"+i).style.background=v==0?"#ADADAD":"#FFF"; 
	}
	
	//document.getElementById("mmline1").style.display=v==0?"none":"block"; 
	if(public_tempid==0){
		public_tempid=1;
		clearopacity();
	}
}
function clearopacity(){ 
	var bg = document.getElementById("bg");
    if(bg.style.visibility != "visible"){ 
        if(isIe){
            bg.style.filter="alpha(opacity=0)";
            bg.filters.alpha.opacity=0;
        }else{
            bg.style.opacity=0;
        } 
        showBackground(bg,50,3); 
    }
}
var isIe=(document.all)?true:false;
//让背景渐渐变暗
function showBackground(obj,endInt,size)
{
    if(isIe)
    {
        obj.filters.alpha.opacity+=size;
        if(obj.filters.alpha.opacity<endInt)
        {
            setTimeout(function(){showBackground(obj,endInt,size)},1);
        }
    }else{
        var al=parseFloat(obj.style.opacity);
        al+=(size/100);
	    obj.style.opacity=al; 
        if(al<(endInt/100))
        {
            setTimeout(function(){showBackground(obj,endInt,size)},1);
        }
    } 
}

function showBackground1(obj,endInt,size)
{
    if(isIe)
    {
        obj.filters.alpha.opacity+=size;
        if(obj.filters.alpha.opacity<endInt)
        {
            setTimeout(function(){showBackground1(obj,endInt,size)},1);
        }
    }else{
        var al=parseFloat(obj.style.opacity);
        al+=(size/100);
	    obj.style.opacity=al; 
        if(al<(endInt/100))
        {
            setTimeout(function(){showBackground1(obj,endInt,size)},1);
        }
    } 
}



//index
var innerhtml='';
function fun01(obj,width){   
		obj.style.display='block';
		width+=7;
		if(width<120){
			obj.style.width=width+"px"; 
			setTimeout(function(){fun01(obj,width);},10); 
		}else{
			obj.innerHTML=innerhtml;
			init(); 
			showBackground1(obj,100,32); 	
		}
}    
function init(){    
  var temp001 = document.getElementById('user').getElementsByTagName('ul')[1];  
  innerhtml=temp001.innerHTML;
  var all2 = document.getElementById('user').getElementsByTagName('ul')[0].getElementsByTagName('*');
  for (var i = 0, n = all2.length; i < n; ++i){ 
		all2[i].onmouseover = function(e){ 
			if (e)  
				e.stopPropagation();
			else
				window.event.cancelBubble = true; 
			if(this.nodeName=='DD'||this.nodeName=='UL'){
				temp001.style.display='none'; 
			}
			if(this.nodeName=='IMG'){
				temp001.innerHTML='';
				if(isIe){
					temp001.style.filter="alpha(opacity=10)";
					temp001.filters.alpha.opacity=50;
				}else{
					temp001.style.opacity=0.5;
				} 
				fun01(temp001,32)
			}
		}; 
	}
} 
 
	/*bg*/
var _tempbgid=0;
function bg(i){
	for(var _i=0;_i<2;_i++){
		document.getElementById('_main'+_i).style.display='none';
	}
	_tempbgid=i;
	var obj=document.getElementById('_main'+i);
	obj.style.display='block'; 
	
	if(isIe){
		obj.style.filter="alpha(opacity=0)";
		obj.filters.alpha.opacity=0;
	}else{
		obj.style.opacity=0;
	}
	showBackground(obj,100,1); 
} 

/* ad */
var indexadcount=0;
function IndexAdFun(obj,width,height,v){  
    height=(v==0?height+=14:height-=14); 
    indexadcount+=1;
    width=237/(257/14)*indexadcount;
	if(height<257&&height>=57){ 
		obj.style.height=height+"px";
		obj.style.width=width+"px";
		obj.style.marginTop="-"+(height-57)+"px"; 
		obj.style.marginLeft="-"+(width+13)+"px"; 
		IndexAdClear(obj);
		setTimeout(function(){IndexAdFun(obj,width,height,v);},1);
	} 
}
function IndexAdClear(obj){
    if(isIe){
        obj.style.filter="alpha(opacity=100)";
        obj.filters.alpha.opacity=1000;
    }else{
        obj.style.opacity=1;
    }
}

