//搜索滑动门
function $(id) { return (typeof (id)=='object')?id:document.getElementById(id); };

function SubSearch(i)
{
  for(j=1;j<=3;j++)
    {
  if(i==j){
   $("sea"+j).className="sd1";
   $("sub"+j).style.display="";
   $("souboxradio"+j).click();
          }
   else
    {
   $("sea"+j).className="sd2";
   $("sub"+j).style.display="none";
      }
     }
}
/** 类 */
var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}
//tab封装
function id(name){
return typeof name == "string" ? document.getElementById(name) : name;
}
	function hasClass(name, type, elem) {
				var r = [];
				var re = new RegExp("(^|\\s)" + name + "(\\s|$)");
				var e = (elem ? id(elem) : document).getElementsByTagName(type || "*");
				for (var i = 0; i < e.length; i++) {
					if (re.test(e[i].className)) r.push(e[i]);
				}
				return r;
			}
			var ttf = function(options){
				this.setOptions = function(options){
					return {
						name:options["name"] || "",
					 	item:options["item"] || "",
						con:options["con"] || "",
						event:options["event"] || "click",
						visited:options["visited"] || "",
						initCon:options["initCon"] || "none",
						other:options["other"] || "hide",
						autorun:options["autorun"] || "",
						setTime:options["setTime"] || "2000",
						callback:options["callback"] || ""
					}
				}
				this.options = this.setOptions(options);
				this.init = function(){
					this.name = id(this.options.name);	
					this.item = hasClass(this.options.item,"",this.name);
					this.con = hasClass(this.options.con,"",this.name);
					this.currentItem = 0;
					this.autorunTimer = null;
					if(!this.name || this.item.length == 0 || this.con.length == 0){
						return;	
					}
					this.resetCon();
					if(typeof this.options.initCon == "number"){
						this.ctlCon(this.options.initCon - 1);	
					}else if(this.options.initCon == "show"){
						for(var i = 0,j=this.con.length;i<j;i++){
							this.con[i].style.display = "";
						}
					};
					this.autorunFn();
					this.setIndex();
				}
				this.setIndex = function(){
					var _this = this;
					for (var i = 0, j = this.item.length; i < j; i++) {
						(function(n) {
							_this.item[n]["on" + _this.options.event] = function() {
								if (_this.options.autorun) {
									clearTimeout(_this.autorunTimer);
									_this.autorunTimer = null;
								}
								_this.ctlCon(n);
								_this.currentItem = n + 1 == j ? 0: n + 1;
								setTimeout(function() { _this.autorunFn() }, _this.options.setTime);
							}
						})(i);
					};
				}
				this.ctlCon = function(index){
					if(this.options.other == "hide"){
						this.resetCon();
					}
					if(this.con[index].style.display == "none"){
						this.con[index].style.display = "";
					}else{
						this.con[index].style.display = "none";
					}
					if (this.options.visited) {
						this.ctlItem(index);
					}
					if(this.options.callback){
						this.options.callback.call(this,index);
					}
				}
				this.ctlItem= function(index) {
					if(this.item[index].className.indexOf(this.options.visited) != -1){
						var defaultClass = this.item[index].className.split(this.options.visited).join("");
					}else{
						var defaultClass = this.item[index].className;
					}
					if(this.options.other == "hide"){
						for(var i = 0,j=this.item.length;i<j;i++){
							this.item[i].className = defaultClass;
						}
					}
					if(this.con[index].style.display =="none"){
						this.item[index].className = defaultClass;
					}else{
						this.item[index].className = defaultClass +" "+this.options.visited;
					}
				},
				this.resetCon = function(){
					for(var i = 0,j=this.con.length;i<j;i++){
						this.con[i].style.display = "none";
					}
				}
				this.autorunFn = function(){
					if(this.options.autorun){
						var _this = this;
						this.ctlCon(this.currentItem);
						this.ctlItem(this.currentItem);
						this.currentItem > this.item.length - 2 ? this.currentItem = 0 : this.currentItem++;
						this.autorunTimer = setTimeout(function() { _this.autorunFn(); }, _this.options.setTime);
					}
				}
				this.init();
			}


