// JavaScript Document
function ImgAutoSize(d,w,h){
	var w1=d.width;
	var h1=d.height;
	if(w1==0)w1=w;
	if(h1==0)h1=h;
	if( w1/h1>w/h){
		Ratio=w/w1
		if(w1>w){
			d.width = w
			d.height = Math.round(h1 * Ratio)
		}
	}
	else{
		Ratio=h/h1
		if(h1>h){
			d.height = h
			d.width = Math.round(w1 * Ratio)
		}
	}
	var temp =eval(Math.round((h-d.height)/2)-1);
	if(temp>0)d.style.margin= temp + "px auto";
}
function AutoImg(o,w,h){
	this.o=o;
	this.w=w;
	this.h=h;
}
var ImgOdj=new Array();
var ImgOdjIndex=0;

function SetImgOdj(t,w,h){
	ImgOdj[ImgOdjIndex]=new AutoImg(t,w,h);
	ImgOdjIndex++;
}
function FormatImagesSize(){
	for(i=0;i<ImgOdjIndex;i++){
		ImgAutoSize(ImgOdj[i].o,ImgOdj[i].w,ImgOdj[i].h);
	}
}
function AutoSize(d1,d2){
	var Div1=document.getElementById(d1);
	var Div2=document.getElementById(d2);
	var AleftH=Div1.offsetHeight;
	var ContentH;
	ContentH=Div2.offsetHeight;
	ContentH=Math.max(ContentH,AleftH);
	Div1.style.height=ContentH + "px";
	Div2.style.height=ContentH + "px";
}
function AutoSize2(d1,d2,v){
	var Div1=document.getElementById(d1);
	var Div2=document.getElementById(d2);
	var AleftH=Div1.offsetHeight+v;
	var ContentH;
	ContentH=Div2.offsetHeight;
	ContentH=Math.max(ContentH,AleftH);
	Div1.style.height=eval(ContentH-v) + "px";
	Div2.style.height=ContentH + "px";
}
function BannersOver(){//中上部轮显广告
	if(BanD1.style.display!="none"){
		BanD1.style.display="none";
		BanD2.style.display="block";
	}
	else{
		BanD2.style.display="none";
		BanD1.style.display="block";
	}
}
function ZoneBoxIn(i){
	var ZoneTab=document.getElementById("ZoneBox").getElementsByTagName("li");
	if(ZoneTab.length>7){//有7个以上元素表示ZoneBox已载入
		if(i!=0){
			ZoneTab[0+4].className="ClearanceHid";
			ZoneTab[0].className="Clearance";
		}
		if(i!=1){
			ZoneTab[1+4].className="ClearanceHid";
			ZoneTab[1].className="Clearance";
		}
		if(i!=2){
			ZoneTab[2+4].className="ClearanceHid";
			ZoneTab[2].className="Clearance";
		}
		ZoneTab[i+4].className="ClearanceShow";
		ZoneTab[i].className="ClearanceOn";
		if(ZoneTab[0].className=="Clearance"){
			ZoneTab[0].style.borderLeftStyle="none";
		}
		else{
			ZoneTab[0].style.borderLeftStyle="solid";
		}
		if(ZoneTab[1].className=="ClearanceOn"){
			ZoneTab[2].style.borderLeftStyle="solid";
			ZoneTab[1].style.borderLeftStyle="solid";
		}
		else{
			ZoneTab[2].style.borderLeftStyle="none";
		}
		if(ZoneTab[2].className=="ClearanceOn"){
			ZoneTab[3].style.visibility="visible";
			ZoneTab[2].style.borderLeftStyle="solid";
			ZoneTab[1].style.borderLeftStyle="none";
		}
		else{
			ZoneTab[3].style.visibility="hidden";
		}
	}
}
