//头部交互
function selectTab(DivID,i){
document.getElementById("header_"+DivID).style.display="block";
switch(i){
case 1:
var DivID2=DivID.replace("1","2");
var DivID3=DivID.replace("1","3");
var DivID4=DivID.replace("1","4");
var DivID5=DivID.replace("1","5");
var DivID6=DivID.replace("1","6");
var DivID7=DivID.replace("1","7");
var DivID8=DivID.replace("1","8");
var DivID9=DivID.replace("1","9");
document.getElementById(DivID).className=DivID;
document.getElementById(DivID2).className=DivID2;
document.getElementById(DivID3).className=DivID3;
document.getElementById(DivID4).className=DivID4;
document.getElementById(DivID5).className=DivID5;
document.getElementById(DivID6).className=DivID6;
document.getElementById(DivID7).className=DivID7;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 2:
var DivID2=DivID.replace("2","1");
var DivID3=DivID.replace("2","3");
var DivID4=DivID.replace("2","4");
var DivID5=DivID.replace("2","5");
var DivID6=DivID.replace("2","6");
var DivID7=DivID.replace("2","7");
var DivID8=DivID.replace("2","8");
var DivID9=DivID.replace("2","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID;
document.getElementById(DivID3).className=DivID3;
document.getElementById(DivID4).className=DivID4;
document.getElementById(DivID5).className=DivID5;
document.getElementById(DivID6).className=DivID6;
document.getElementById(DivID7).className=DivID7;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 3:
var DivID2=DivID.replace("3","1");
var DivID3=DivID.replace("3","2");
var DivID4=DivID.replace("3","4");
var DivID5=DivID.replace("3","5");
var DivID6=DivID.replace("3","6");
var DivID7=DivID.replace("3","7");
var DivID8=DivID.replace("3","8");
var DivID9=DivID.replace("3","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID;
document.getElementById(DivID4).className=DivID4;
document.getElementById(DivID5).className=DivID5;
document.getElementById(DivID6).className=DivID6;
document.getElementById(DivID7).className=DivID7;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 4:
var DivID2=DivID.replace("4","1");
var DivID3=DivID.replace("4","2");
var DivID4=DivID.replace("4","3");
var DivID5=DivID.replace("4","5");
var DivID6=DivID.replace("4","6");
var DivID7=DivID.replace("4","7");
var DivID8=DivID.replace("4","8");
var DivID9=DivID.replace("4","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID4;
document.getElementById(DivID4).className=DivID;
document.getElementById(DivID5).className=DivID5;
document.getElementById(DivID6).className=DivID6;
document.getElementById(DivID7).className=DivID7;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 5:
var DivID2=DivID.replace("5","1");
var DivID3=DivID.replace("5","2");
var DivID4=DivID.replace("5","3");
var DivID5=DivID.replace("5","4");
var DivID6=DivID.replace("5","6");
var DivID7=DivID.replace("5","7");
var DivID8=DivID.replace("5","8");
var DivID9=DivID.replace("5","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID4;
document.getElementById(DivID4).className=DivID5;
document.getElementById(DivID5).className=DivID;
document.getElementById(DivID6).className=DivID6;
document.getElementById(DivID7).className=DivID7;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 6:
var DivID2=DivID.replace("6","1");
var DivID3=DivID.replace("6","2");
var DivID4=DivID.replace("6","3");
var DivID5=DivID.replace("6","4");
var DivID6=DivID.replace("6","5");
var DivID7=DivID.replace("6","7");
var DivID8=DivID.replace("6","8");
var DivID9=DivID.replace("6","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID4;
document.getElementById(DivID4).className=DivID5;
document.getElementById(DivID5).className=DivID6;
document.getElementById(DivID6).className=DivID;
document.getElementById(DivID7).className=DivID7;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 7:
var DivID2=DivID.replace("7","1");
var DivID3=DivID.replace("7","2");
var DivID4=DivID.replace("7","3");
var DivID5=DivID.replace("7","4");
var DivID6=DivID.replace("7","5");
var DivID7=DivID.replace("7","6");
var DivID8=DivID.replace("7","8");
var DivID9=DivID.replace("7","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID4;
document.getElementById(DivID4).className=DivID5;
document.getElementById(DivID5).className=DivID6;
document.getElementById(DivID6).className=DivID7;
document.getElementById(DivID7).className=DivID;
document.getElementById(DivID8).className=DivID8;
document.getElementById(DivID9).className=DivID9;
break;
case 8:
var DivID2=DivID.replace("8","1");
var DivID3=DivID.replace("8","2");
var DivID4=DivID.replace("8","3");
var DivID5=DivID.replace("8","4");
var DivID6=DivID.replace("8","5");
var DivID7=DivID.replace("8","6");
var DivID8=DivID.replace("8","7");
var DivID9=DivID.replace("8","9");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID4;
document.getElementById(DivID4).className=DivID5;
document.getElementById(DivID5).className=DivID6;
document.getElementById(DivID6).className=DivID7;
document.getElementById(DivID7).className=DivID8;
document.getElementById(DivID8).className=DivID;
document.getElementById(DivID9).className=DivID9;
break;
case 9:
var DivID2=DivID.replace("9","1");
var DivID3=DivID.replace("9","2");
var DivID4=DivID.replace("9","3");
var DivID5=DivID.replace("9","4");
var DivID6=DivID.replace("9","5");
var DivID7=DivID.replace("9","6");
var DivID8=DivID.replace("9","7");
var DivID9=DivID.replace("9","8");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID4;
document.getElementById(DivID4).className=DivID5;
document.getElementById(DivID5).className=DivID6;
document.getElementById(DivID6).className=DivID7;
document.getElementById(DivID7).className=DivID8;
document.getElementById(DivID8).className=DivID9;
document.getElementById(DivID9).className=DivID;
break;
}
eval('document.getElementById(DivID).className="set"');
document.getElementById("header_"+DivID2).style.display="none";
document.getElementById("header_"+DivID3).style.display="none";
document.getElementById("header_"+DivID4).style.display="none";
document.getElementById("header_"+DivID5).style.display="none";
document.getElementById("header_"+DivID6).style.display="none";
document.getElementById("header_"+DivID7).style.display="none";
document.getElementById("header_"+DivID8).style.display="none";
document.getElementById("header_"+DivID9).style.display="none";
}
//商圈交互
function selectTab_SQ(DivID,i){
document.getElementById(DivID+"DIV").style.display="block";
switch(i){
case 1:
var DivID2=DivID.replace("1","2");
var DivID3=DivID.replace("1","3");
document.getElementById(DivID).className=DivID;
document.getElementById(DivID2).className=DivID2;
document.getElementById(DivID3).className=DivID3;
break;
case 2:
var DivID2=DivID.replace("2","1");
var DivID3=DivID.replace("2","3");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID;
document.getElementById(DivID3).className=DivID3;
break;
case 3:
var DivID2=DivID.replace("3","1");
var DivID3=DivID.replace("3","2");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID3;
document.getElementById(DivID3).className=DivID;
break;
}
eval('document.getElementById(DivID).className="set"');
document.getElementById(DivID2+"DIV").style.display="none";
document.getElementById(DivID3+"DIV").style.display="none";
}

//博商交互
function selectTab_blog(DivID,i){
document.getElementById(DivID+"DIV").style.display="block";
switch(i){
case 1:
var DivID2=DivID.replace("1","2");
document.getElementById(DivID).className=DivID;
document.getElementById(DivID2).className=DivID2;
break;
case 2:
var DivID2=DivID.replace("2","1");
document.getElementById(DivID).className=DivID2;
document.getElementById(DivID2).className=DivID;
break;
}
eval('document.getElementById(DivID).className="set"');
document.getElementById(DivID2+"DIV").style.display="none";
}

//行业分类类别鼠标上已弹出显示
function showhidden(id,i){
		var select_obj=document.getElementsByTagName("SELECT");
		if(i==1){
			document.getElementById(id).style.display="block";
		}else{
			document.getElementById(id).style.display="none";
		}
}


//左侧快速通道
$=function(id){
	return document.getElementById(id);
}

Namespace = new Object();
Namespace.register = function(namespace){
	var nsArray = namespace.split('.');
	var sEval = "";
    var sNS = "";
	for (var i = 0; i < nsArray.length; i++){
        if (i != 0) sNS += ".";
        sNS += nsArray[i];
        sEval += "if (typeof(" + sNS + ") == 'undefined') " + sNS + " = new Object();"
    }
    if (sEval != "") eval(sEval);
}

Namespace.register("tab.util.setDiv");
Namespace.register("tab.util.showDiv");

/*
 *重构DIV位置的静态类
 *@class setDiv
 */
(function(){
	var initheight,totalheight;
	tab.util.setDiv = {
		/**
		 *初始化弹性显示DOM对象
		 *@param (el,con,nums,overclassname,outclassname,speed,maxheight) tab前缀，显示内容前缀，tab个数，覆盖tab样式，离开tab样式，弹开速度，显示内容框高度
		 */
		init:function(el,con,nums,overclassname,outclassname,speed,maxheight){
			var arg = new Array();
			for(i=0;i<arguments.length;i++){
				arg[i] = arguments[i];
			}
			for(j=1;j<=parseInt(arg[2]);j++){
				tagBox = $(arg[0] + j);
				hidBox = $(arg[1] + j);
				tagBox.m = j;
				hidBox.m = j;
				tagBox.onmouseover=function(){tab.util.showDiv.slideshow(arg,this.m);};
				tagBox.onmouseout=function(){tab.util.showDiv.slideshow(arg,this.m);};
				hidBox.onmouseover=function(){tab.util.showDiv.slideshow(arg,this.m);};
				hidBox.onmouseout=function(){tab.util.showDiv.slideshow(arg,this.m);};
			}
			tab.util.showDiv.slideshow(arg,1);
		},

		tabDivinit:function(nums,tab,con,curClassName,speed,oEvent){
			var t = oEvent;
			var arg = new Array;
			for(i=0;i<arguments.length;i++){
				arg[i] = arguments[i];
			}
			for(var j=0;j<arg[0];j++){
				var curtab = $(arg[1] + j);
				curtab.n = j;
				switch(t){
					case 'click':
						curtab.onclick = function(){tab.util.showDiv.show(arg,this.n);};
						break;
					default:
						curtab.onmouseover = function(){tab.util.showDiv.show(arg,this.n);};
						break;
				}
			}
			return arg;
		}
	};
})();

/**
 *显示隐藏类
 *@class showDiv
 */
(function(){
	var pos;
	var showpos;
	tab.util.showDiv = {
		
		/**
		 *由onmouseover和onmouseout事件触发，弹性显示
		 *@param arg是数组类，id是tab的后缀数字
		 */
		slideshow:function(arg,id){
			var curobj = new Array();
			for(j=0;j<arg.length;j++){
				curobj[j] = arg[j];
			}
			var tagBox,hidBox;
			var ctrl = 0;
			if((id!=pos)||(pos==null)){
				for(i=1;i<=parseInt(curobj[2]);i++){
					tagBox = $(curobj[0] + i);
					hidBox = $(curobj[1] + i);
					if(i==id){
						pos=id;
						tagBox.className = curobj[3];
						hidBox.style.display = "block";
						
						hidBox.style.height = curobj[6] + "px";
					}else{
							hidBox.style.height = "0px";
							tagBox.className = curobj[4];
							hidBox.style.display = "none";
					}
				}
			}
		}
		
	}
})();

/**
 *移动类
 *@class move
 */
(function(){
	var oStart,oEnd,oStartY,oEndY;
	var speed = 10;
	tab.util.move = {

toString:function(){
			var tempStr = "";
			for(var i=0;i<movebox.list.length;i++){
				tempStr = tempStr + movebox.list[i].id + "&";
			}
			tempStr = tempStr.substring(0,tempStr.length-1);
			return tempStr;
		}
	};
})();