function $(id){
	return document.getElementById(id);
}

/* 浮动层显示及隐藏 */
var index = new Object();
index.openlayer = null;//记录页面内已显示层的id
document.onmousedown = function(){
	if (index.openlayer != null) $(index.openlayer).style.display = "none";
	index.openlayer = null;
}

function showSub(id){
	$(id).style.display = "block";
}
function hideSub(id){
	$(id).style.display = "none";
}
function stopBubble(e){
	if(e && e.stopPropagation){
		e.stopPropagation();
	}else{
		window.event.cancelBubble = true;
	}
}
/* 显示层并向全局注册 */
function showlayer(id){
	showSub(id);
	if(index.openlayer != null && index.openlayer != id) hidelayer(index.openlayer);
	index.openlayer = id;
	$(id).onmousedown = function(e){
		stopBubble(e);
	}
}
function hidelayer(id){
	hideSub(id);
	index.openlayer = null;
	$(id).onmousedown = null;
}

/* 标签切换 */
function tabSwitch(t,i,on,off){
	
	var c = t.parentNode.id;
	if(t.className == on) return ;
	
	var lis = t.parentNode.getElementsByTagName("li");
	for(var j = 0;j<lis.length;j++){
		if(j==(i-1)){
			$(c+"_"+i).className = "";
			lis[j].className=on;
		}else{
			$(c+"_"+(j+1)).className = "hide";
			lis[j].className=off;
		}
	}
}

/* 广告后显函数 */
function delayShow(from, to ){
	document.getElementById(to).innerHTML=document.getElementById(from).innerHTML;
	document.getElementById(from).innerHTML="";
}


/* 搜索验证 */
function changeSearchAction (id) {
	if(id == "page"){
		document.forms["searchForm"].action = "http://sou.ccicc.cn/";
		$("searchPage").className = "n";
		$("searchproduct").className = "";
		$("searchFormArrow").style.left= "10px";
		$("type").value= "all";
	}else{
		document.forms["searchForm"].action = "http://sou.ccicc.cn/";
		$("searchPage").className = "";
		$("searchproduct").className = "n";
		$("searchFormArrow").style.left= "57px";
		$("type").value= "file";
	}
}
