//导航菜单JS
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){g('tb_'+i).className='normaltab';g('tbc_0'+i).className='undis';}g('tbc_0'+n).className='dis';g('tb_'+n).className='hovertab';
}

function menuout(object){
	var mm=document.getElementById("left_"+object);
	mm.className='menuout';
	mm.style.color="#002940";
	}
function menuover(object){
	var mm = document.getElementById("left_"+object);
	mm.className='menuover';
	mm.style.color="#fff";
	}

//左侧树菜单JS
function rolinTab(obj) {
var list = $(obj).getElementsByTagName("LI");
var state = {show:false,hidden:false,showObj:false};
for (var i=0; i<list.length; i++) {
var tmp = new rolinItem(list[i],state);
//	if (i == 5) {
//			tmp.pShow();
//			var isOpen=true;
//			getFirstChild(list[i]).style.background = "#8093a1";
//			getFirstChild(list[i]).style.color = "#fff";
//			}
}
}
function rolinItem(obj,state) {
var speed = 0.1;
var range = 1;
var interval;
var tarH;
var tar = this;
var head = getFirstChild(obj);
var content = getNextChild(head);
var isOpen = false;
this.pHidden = function() {
if (isOpen) hidden();
}
this.pShow = show;
var baseH = content.offsetHeight;
content.style.display = "none";
var isOpen = false;
head.onmouseover = function() {
if (!state.show && !state.hidden) {
	if (!isOpen){
this.style.background = "#8093a1";
		}
	else{
this.style.background = "#2b5261";
//this.style.color = "#fff";
		}
}
}
head.onmouseout = mouseout;
head.onclick = function() {
this.style.background = "#8093a1";
this.style.color = "#fff";
if (!state.show && !state.hidden) {
if (!isOpen) {
head.onmouseout = null;
show();
} else {
hidden();
}
}
}
function mouseout() {
this.style.background = "#2b5261"
this.style.color = "#fff";
}

function show() {
head.style.borderBottom = "1px solid #DADADA";
state.show = true;
if (state.openObj && state.openObj != tar ) {
state.openObj.pHidden();
}
content.style.height = "0px";
content.style.display = "block";
content.style.overflow = "hidden";
state.openObj = tar;
tarH = baseH;
interval = setInterval(move,10);
}
function showS() {
isOpen = true;
state.show = false;
}
function hidden() {
state.hidden = true;
tarH = 0;
interval = setInterval(move,10);
}
function hiddenS() {
head.style.borderBottom = "none";
head.onmouseout = mouseout;
head.onmouseout();
content.style.display = "none";
isOpen = false;
state.hidden = false;
}
function move() {
var dist = (tarH - content.style.height.pxToNum())*speed;
if (Math.abs(dist) < 1) dist = dist > 0 ? 1: -1;
content.style.height = (content.style.height.pxToNum() + dist) + "px";
if (Math.abs(content.style.height.pxToNum() - tarH) <= range ) {
clearInterval(interval);
content.style.height = tarH + "px";
if (tarH != 0) {
showS()
} else {
hiddenS();
}
}
}
}
var $ = function($) {return document.getElementById($)};
String.prototype.pxToNum = function() {return Number(this.replace("px",""))}
function getFirstChild(obj) {
var result = obj.firstChild;
while (!result.tagName) {
result = result.nextSibling;
}
return result;
}
function getNextChild(obj) {
var result = obj.nextSibling;
while (!result.tagName) {
result = result.nextSibling;
}
return result;
}

function showdiv(obj){
	for (var i=1 ; i<=4;i++){
	var div_title=document.getElementById("div_"+i);
	var div=document.getElementById("closediv_" + i);
		if(i==obj){
			div.style.display="";
			div_title.className="showdivtitle";
			}
		else{
			div.style.display="none";
			div_title.className="";
			}
		}
	return true;
	}
	
/*	左键不可选择JS
function selectstart() {
    event.returnValue = false;
}

function mousedown() {
    if (event.button == 2) {
        event.returnValue = false;
    }
}

function keydown(e) {
    if (event.ctrlKey && event.keyCode == 67) {
        event.returnValue = false;
    }
}

if (window.navigator.userAgent.toLowerCase().indexOf("firefox") == -1) {
    document.onselectstart = selectstart;
    document.onmousedown = mousedown;
    document.onkeydown = keydown;
}
document.body.style.MozUserSelect = "none";
if (window.attachEvent) {
    window.attachEvent("onload", onloadEvent);
}
else {
    window.addEventListener("load", onloadEvent, false);
}

function onloadEvent() {
    document.body.oncopy = function() {
        event.returnValue = false;
        clipboardData.clearData();
    }
}
*/
