// 浏览器版本判断
var Client = {
	Engine: {'name': 'unknown', 'version': ''},
	Features: {}
};
Client.Features.xhr = !!(window.XMLHttpRequest);
Client.Features.xpath = !!(document.evaluate);
if (window.opera) Client.Engine.name = 'opera';
else if (window.ActiveXObject) Client.Engine = {'name': 'ie', 'version': (Client.Features.xhr) ? 7 : 6};
else if (!navigator.taintEnabled) Client.Engine = {'name': 'webkit', 'version': (Client.Features.xpath) ? 420 : 419};
else if (document.getBoxObjectFor != null) Client.Engine.name = 'gecko';
Client.Engine[Client.Engine.name] = Client.Engine[Client.Engine.name + Client.Engine.version] = true;
// 返回Id、Tag
function Pid(id,tag){
if(!tag){return document.getElementById(id);}
else{return document.getElementById(id).getElementsByTagName(tag);}
}
// 选项卡
function tab(id,hx,box,iClass,s,pr){
	var hxs=Pid(id,hx);
	var boxs=Pid(id,box);
	if(!iClass){
		boxsClass=boxs;
	}
	else{
		var boxsClass = [];
		for(i=0;i<boxs.length;i++){
			if(boxs[i].className.match(/\btab\b/)){
				boxsClass.push(boxs[i]);
			}
		}
	}
	if(!pr){
		go_to(0);
		yy();
	}
	else {
		go_to(pr);
		yy();
	}
	function yy(){
		for(var i=0;i<hxs.length;i++){
			hxs[i].temp=i;
			if(!s){
				s="onmouseover";
				hxs[i][s]=function(){
					go_to(this.temp);
				}
			}
			else{
				hxs[i][s]=function(){
					go_to(this.temp);
				}
			}
		}
	}
	function go_to(pr){
		for(var i=0;i<hxs.length;i++){
			if(!hxs[i].tmpClass){
				hxs[i].tmpClass=hxs[i].className+=" pr1984_com";
				boxsClass[i].tmpClass=boxsClass[i].className+=" pr1984_com";
			}
			if(pr==i){
				hxs[i].className+=" up";
				boxsClass[i].className+=" up";
			}
			else {
				hxs[i].className=hxs[i].tmpClass;
				boxsClass[i].className=boxsClass[i].tmpClass;
			}
		}
	}
}
// 隔行换色

function ghhs(id,tag,s) {
	var line=Pid(id,tag);
	for (var i=1;i<line.length+1;i++) { 
		line[i-1].className=(i%2>0)?"t1":"t2"; 
	}
	if(s=="no"){
		return;
	}
	else if(!s){
		for(var i=0;i<line.length;i++) {
			line[i].onmouseover=function(){
				this.tmpClass=this.className;
				this.className+=" up";
			}
			line[i].onmouseout=function(){
				this.className=this.tmpClass;
			}
		}
	}
	else{
		for(var i=0;i<line.length;i++) {
			line[i].tmep=i;
			line[i][s]=function(){
				ghhs_tab(this.tmep);
			}
		}
	}
	function ghhs_tab(s){
		for(var i=0;i<line.length;i++){
			if(!line[i].tmpClass){
				line[i].tmpClass=line[i].className+=" pr1984_com";
			}
			if(s==i){
				line[i].className+=" up";
			}
			else {
				line[i].className=line[i].tmpClass;
			}
		}
	}
}
// hover对象绑定
function hovers(id,hx,box){
	var hxs=Pid(id,hx);
	var boxs=Pid(id,box);
	for(var i=0;i<hxs.length;i++) {
		hxs[i].temp=i;
		hxs[i].onmouseover=function(){
			hxs[this.temp].tmpClass=hxs[this.temp].className;
			boxs[this.temp].tmpClass=boxs[this.temp].className;
			hxs[this.temp].className+=" up";
			boxs[this.temp].className+=" up";
		}
		hxs[i].onmouseout=function(){
			hxs[this.temp].className=hxs[this.temp].tmpClass;
			boxs[this.temp].className=boxs[this.temp].tmpClass;
		}
	}
}
// 文本框控制
function inputs(id,box,type,typea){
	var obj=Pid(id,box);
	for(var i=0;i<obj.length;i++){
		obj[i].onclick=function (){
			if(this.type==type || this.type==typea){
				if(this.value==this.defaultValue){
					this.value="";
					this.tempClass=this.className;
					this.className+=" up";
				}
			}
		}
		obj[i].onblur=function (){
			if(this.type==type || this.type==typea){
				if(this.value==""){
					this.value=this.defaultValue;
					this.className=this.tempClass;
				}
			}
		}
	}
 }


//下拉菜单


// ShowHide
function ShowHide(tabName,tabId,tabNumber){
	for(i=0;i<tabNumber;i++){
		if(document.getElementById(tabName+"_con"+i)) {
			document.getElementById(tabName+"_con"+i).style.display = "none";
			document.getElementById(tabName+"_tab"+i).className = "tabBg";
		}
	}
	document.getElementById(tabName+"_con"+tabId).style.display = "block";
	document.getElementById(tabName+"_tab"+tabId).className = "tabBg_cur";
	
}