// JavaScript Document
var dropstatus=0;
function dropmenu(elem){
	dropstatus=1;
	document.getElementById('drop_a').style.display="none";
	document.getElementById('drop_b').style.display="none";
	document.getElementById('drop_c').style.display="none";
	document.getElementById('drop_d').style.display="none";
	document.getElementById('drop_e').style.display="none";
	document.getElementById('drop_f').style.display="none";
	document.getElementById('drop_g').style.display="none";
	document.getElementById(elem).style.display="block";
}

function hidedrop(){
	dropstatus=0;
		setTimeout("hidealldrop()",500);
}

function hidealldrop(){
	if(dropstatus==0){
	document.getElementById('drop_a').style.display="none";
	document.getElementById('drop_b').style.display="none";
	document.getElementById('drop_c').style.display="none";
	document.getElementById('drop_d').style.display="none";
	document.getElementById('drop_e').style.display="none";
	document.getElementById('drop_f').style.display="none";
	document.getElementById('drop_g').style.display="none";
	}
}

function changestatus(){
	dropstatus=1;
}




function loadlink(){
	var a;  //a为数组
	a=getElementsByClassName('droplink','a',document);
	for(i=0;i<a.length;i++){
		a[i].onmouseover=changestatus;
		a[i].onmouseout=hidedrop;
	}
}

function getElementsByClassName(strClassName, strTagName, oElm){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}


function addLoadEvent(func){
	var oldonload=window.onload;
	if (typeof window.onload!='function'){
		window.onload=func;
	}
	else{
		window.onload=function(){
			oldonload();
			func();
		}
	}
}

addLoadEvent(loadlink);
