// JavaScript Document
var Global={};
Global.newspace=function(str){
	var arr=str.split("."),
	      o=Global;
	for(var i=(arr[0]=="Global"?1:0);i<arr.length;i++){
		o[arr[i]]=o[arr[i]]||{};
		o=o[arr[i]]
		}	  
	}
Global.newspace("Dom");
Global.newspace("Event");

Global.Dom.getClassN=function(str,root,tag){
	if(root){root=typeof root=="string"?document.getElementById(root):root;}
	else{root=document.body}
	tag=tag||"*";
	var tagarr=root.getElementsByTagName(tag), arr=[];
	for(var i=0;i<tagarr.length;i++){
		var tagclassN=tagarr[i].className.split(" ");
		for(var j=0;j<tagclassN.length;j++){
			  if(tagclassN[j]==str){
				  arr.push(tagarr[i]);
			  }
		}
	}
	return arr
}

Global.Dom.get=function(node){
	 node=typeof node=="string"?document.getElementById(node):node
	 return node
	}

Global.Dom.childN=function(str,root,tag){
	var cNd=Global.Dom.getClassN(str,root,tag),cN=cNd[0].childNodes,arr=[];
       for(var i=0;i<cN.length;i++){
		   if(cN[i].nodeType==1){
			   arr.push(cN[i])
			   }
		   }
		   return arr
	}
	
Global.Dom.addCN=function(node,str){
		if(!new RegExp("(^|\\s+)"+str).test(node.className)){
node.className = node.className + " " + str;
}
	}
Global.Dom.removeCN=function(node,str){
	node.className = node.className.replace(new RegExp("(^|\\s+)"+str),"");
	}
	


Global.Event.ON=function(node,eventtype,hander,scope){
	node=typeof node=="string"?document.getElementById(node):node;
	scope=scope||node;
	if(document.all){
		node.attachEvent("on"+eventtype,function(){hander.apply(scope,arguments)});
		}
	else{
		node.addEventListener(eventtype,function(){hander.apply(scope,arguments)},false)
		}
	}
	
Global.Event.hover=function(fmov,fmot){
	this.onmouseover=fmov;
	this.onmouseout=fmot;
	}

function tab(config){
	this._root=config.root;
	this._tabmenu=config.tabmenu;
	this._tabcontect=config.tabcontect;
	this._currentclass=config.currentclass;
	this._currentindex=0;
	this._trigetmouseout=config.trigetmouseout||" "
	
	
	var triget=config.triget||"click";
	var This=this;
	var showsign=false;
	
	for(var i=0;i<this._tabmenu.length;i++){
	  this._tabmenu[i]._index=i;
	  Global.Event.ON(this._tabmenu[i],triget,function(){
	  This.tabshow(this._index);
	  this._currentindex=this._index;
	  return false;
		  })
	if(this._trigetmouseout){
	for(var j=0;j<this._tabcontect.length;j++){
		  this._tabcontect[j]._index=j;
		  Global.Event.ON(this._tabcontect[j],this._trigetmouseout,function(){
			  This.tabhidden(this._index)
			  })
		   	  
	  }
	}
	}
}
	
tab.prototype={
	tabshow:function(n){
		for(var i=0;i<this._tabcontect.length;i++){
			this._tabcontect[i].style.display="none";
			}
			this._tabcontect[n].style.display="block";
			if(this._currentclass){
				var tabC=Global.Dom.getClassN(this._currentclass,this._root)[0];
				Global.Dom.removeCN(tabC,this._currentclass);
				Global.Dom.addCN(this._tabmenu[n],this._currentclass);
				}
		return false;
		}

	}

function indextab(){	
var trd=Global.Dom.getClassN("tabmenu")[0];
var tad=Global.Dom.childN("tabmenu");
var ttc=Global.Dom.getClassN("list_m");
new tab({root:trd,tabmenu:tad,tabcontect:ttc,currentclass:"current"})

}






































