//GZ58 JavaScript create by G5 desgin http://www.g58.net;

/*公共变量*/
var _Env_InstallPath="/";
var w3c=(document.getElementById)? true:false;
var agt=navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
var ie5=(w3c && ie)? true : false;
var ns6=(w3c && (navigator.appName=="Netscape"))? true: false;
var op8=(navigator.userAgent.toLowerCase().indexOf("opera")==-1)? false:true;
/**/

window.onerror=function(){return true};


function getObj(o){
	var o=document.getElementById(o)?document.getElementById(o):o;
	return o;
}
function $(o){
	var o=document.getElementById(o)?document.getElementById(o):o;
	return o;
}

function getTargetElement(evt) {
    var elem;
    if (evt.target) {
        elem = (evt.target.nodeType == 3) ? evt.target.parentNode : evt.target;
    } else {
        elem = evt.srcElement;
    }
    return elem;
}

//截取指定首尾字串之间的字符
String.prototype.substringEx=function(startStr,endStr){
	var tmpstr=this.substring(this.indexOf(startStr)+startStr.length);
	return tmpstr.substring(0,tmpstr.indexOf(endStr));
}

/**/

function addFavorite(title){
	var url = window.location.href;
	if(document.all){
		window.external.addFavorite(url,title);
	}else if (window.sidebar){
		window.sidebar.addPanel(title, url, "");
	}
}


function showFlash(flashUrl,width,height,type){
	document.write('<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+flashUrl+'" />');
	document.write('<param name="quality" value="high" />');
	if(type!=1){
		document.write('<param name="wmode" value="transparent" />');
	}
	document.write('<param name="menu" value="false" />');
	document.write('<param name="allowFullScreen" value="true" />');
	document.write('<embed src="'+flashUrl+'" quality="high" wmode="transparent" menu="false" allowFullScreen="true" allowScriptAccess="true"  pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>');
	document.write('</object>');
}

function picFlashObject(pics,links,texts,focus_width,focus_height,text_height){
	var swf_height = focus_height+text_height;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/images/focus.swf"> <param name="quality" value="high"><param name="bgcolor" value="#eeeeee">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('<embed src="/images/focus.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#eeeeee" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function picFlashObject2(files,links,texts,configs,focus_width,focus_height){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ focus_height +'">');
	document.write('<param name="movie" value="/images/focus2.swf"><param name="quality" value="high">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&menu=false&bcastr_config='+configs+'">');
	document.write('<embed src="/images/focus2.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&menu=false&bcastr_config='+configs+'" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>'); 
}


//取对象绝对top值，兼容IE、FF(有细微差别)
function getOffsetTop(obj) {
	var n = obj.offsetTop;
	while (obj = obj.offsetParent) n+= obj.offsetTop;
	return n;
}
//取对象绝对left值，兼容IE、FF
function getOffsetLeft(obj) {
	var n = obj.offsetLeft;
	while (obj = obj.offsetParent) n+= obj.offsetLeft;
	return n;
}

//超宽图片自动缩小
function ResizeImage(obj,resWidth){
	if (!obj)
		return;
	var imgs=obj.getElementsByTagName("IMG");
	for(i=0; i<imgs.length; i++){
		//if (imgs[i].className=="MyEventImage"){
			if (ie){
				imgs[i].attachEvent("ondblclick",ImageDblClick);
			}else{
				imgs[i].addEventListener("dblclick",ImageDblClick,false);
			}
			if (imgs[i].width>resWidth){
				imgs[i].width=resWidth;
				imgs[i].height=(imgs[i].height/imgs[i].width)*resWidth;
				imgs[i].alt="双击放大图片";
			}
		//}
	}
}

//双击事件处理函数
function ImageDblClick(evt){
    evt = (evt) ? evt : ((window.event) ? window.event : "");
    if (evt) {
        var elem = getTargetElement(evt);		//get target element object
        if (elem) {
			var newwin=window.open("","","toolbar=no,menubar=no,scrollbars=yes,left=0,top=0,resizable=yes");
			newwin.document.title=document.title;
			newwin.document.body.innerHTML="<img src='"+elem.src+"' alt='' />";
        }
    }
}


function winOpen(urls,winName,width,height) {
	window.open(urls,winName,"toolbar=no,menubar=no,scrollbars=no,left=0,top=0,resizable=no,width="+width+",height="+height+",status=no,location=no");
}




//菜单选择
//自动判断并选择当前页面所在菜单，并修正显示背景
function focusCurrentMenu(tagid){
	var isHereNum,urlPre,pagePath,menuPath,pagePathPre,menuPathPre;
	var obj=document.getElementById(tagid);
	isHereNum=-1;
	urlPre="http://"+location.host+_Env_InstallPath;
	if (location.href.indexOf(urlPre)!=-1){
		pagePathPre=location.href.substr(urlPre.length);
		pagePathPre=pagePathPre.substring(0,pagePathPre.indexOf("/"));	//取第一个目录名
		if(obj){
			var liObjs=obj.getElementsByTagName("LI");
			//判断当前页面URL是否与菜单项URL完全相同，相同则选择
			for (var i=0;i<liObjs.length ;i++ ){
				if(liObjs[i].parentNode==obj){
					menuPath=liObjs[i].getElementsByTagName("A")[0].href;
					if(location.href==menuPath)
						isHereNum=i; 
					else
						liObjs[i].className="";
				}
			}
			if(isHereNum==-1){
				//判断当前页面目录是否与菜单项目录相同，相同则选择
				for (var i=0;i<liObjs.length ;i++ ){
					if(liObjs[i].parentNode==obj){
						menuPath=liObjs[i].getElementsByTagName("A")[0].href;
						if (menuPath.indexOf(urlPre)==-1) continue;
						menuPathPre=menuPath.substr(urlPre.length);
						menuPathPre=menuPathPre.substring(0,menuPathPre.indexOf("/"));
						if(menuPathPre==pagePathPre)
							isHereNum=i;
						else
							liObjs[i].className="";
					}
				}
			}
			if(isHereNum>=0){
				liObjs[isHereNum].className="isHere";
				window.__CurrentMenuItem=liObjs[isHereNum].childNodes[0];	//记录当前选中菜单项
				window.__HoverMenuItem=null;
			}
			//if(liObjs[isHereNum-1]) liObjs[isHereNum-1].className="isHereNext";
		}	
	}
}
function focusCurrentMenu2(tagid){
	var isHereNum,urlPre,pagePath,menuPath,pagePathPre,menuPathPre;
	var obj=document.getElementById(tagid);
	isHereNum=-1;
	urlPre="http://"+location.host+"/";
	if (location.href.indexOf(urlPre)!=-1){
		pagePathPre=location.href.substr(urlPre.length);
		pagePathPre=pagePathPre.substring(0,pagePathPre.indexOf("/"));	//取第一个目录名
		if(obj){
			var liObjs=obj.getElementsByTagName("LI");
			//判断当前页面URL是否与菜单项URL完全相同，相同则选择
			for (var i=0;i<liObjs.length ;i++ ){
				menuPath=liObjs[i].getElementsByTagName("A")[0].href;
				if(location.href==menuPath)
					isHereNum=i; 
				else
					liObjs[i].className=liObjs[i].className.replace(/( ?|^)isHere\b/gi, "");
			}

			if(isHereNum>=0)
				liObjs[isHereNum].className+=(liObjs[isHereNum].className.length>0?" ":"") + "isHere";
			else
				focusCurrentMenu3(tagid);
		}	
	}
}
function focusCurrentMenu3(tagid){
	var isHereNum,urlPre,pagePath,menuPath,pagePathPre,menuPathPre;
	var obj=document.getElementById(tagid);
	isHereNum=-1;
	urlPre="http://"+location.host+"/";
	if (location.href.indexOf(urlPre)!=-1){
		pagePathPre=location.href.substr(urlPre.length);
		pagePathPre=pagePathPre.substring(0,pagePathPre.lastIndexOf("/"));	//取第一个目录名
		if(obj){
			var liObjs=obj.getElementsByTagName("LI");
			//判断当前页面目录是否与菜单项目录相同，相同则选择
			for (var i=0;i<liObjs.length ;i++ ){
				menuPath=liObjs[i].getElementsByTagName("A")[0].href;
				if (menuPath.indexOf(urlPre)==-1) continue;
				menuPathPre=menuPath.substr(urlPre.length);
				menuPathPre=menuPathPre.substring(0,menuPathPre.lastIndexOf("/"));
				if(menuPathPre==pagePathPre)
					isHereNum=i;
				else
					liObjs[i].className=liObjs[i].className.replace(/( ?|^)isHere\b/gi, "");
			}
			if(isHereNum>=0)
				liObjs[isHereNum].className+=(liObjs[isHereNum].className.length>0?" ":"") + "isHere";
		}	
	}
}

//切换tab标签
function switchMenuTab(obj,subObjPre){
	if(!obj)return;
	obj.blur();
	var tabTleObjs=obj.parentNode.parentNode.getElementsByTagName("LI");
	if(obj!=__CurrentMenuItem){
		if(__HoverMenuItem==null)
			__CurrentMenuItem.parentNode.className="";
		else
			__HoverMenuItem.parentNode.className="";
		obj.parentNode.className="isHere";
		window.__HoverMenuItem=obj;
	}else if(__HoverMenuItem!=null && __HoverMenuItem!=__CurrentMenuItem){
		__HoverMenuItem.parentNode.className="";
		__HoverMenuItem=null;
		__CurrentMenuItem.parentNode.className="isHere";
	}
	for (var i=0;i<tabTleObjs.length;i++) {
		if(tabTleObjs[i].parentNode!=obj.parentNode.parentNode) continue;
		if(tabTleObjs[i]==obj.parentNode){
			if(document.getElementById(subObjPre+"_"+i)) document.getElementById(subObjPre+"_"+i).style.display="block";
		}else{
			if(document.getElementById(subObjPre+"_"+i)) document.getElementById(subObjPre+"_"+i).style.display="none";
		}
	}
}

//切换tab标签
function switchTab(obj,subObjPre){
	if(!obj)return;
	obj.blur();
	var tabTleObjs=obj.parentNode.parentNode.getElementsByTagName("LI");
	for (var i=0;i<tabTleObjs.length;i++) {
		if(tabTleObjs[i]==obj.parentNode){
			tabTleObjs[i].className="isHere";
			if(document.getElementById(subObjPre+"_"+i)) document.getElementById(subObjPre+"_"+i).style.display="block";
		}else{
			tabTleObjs[i].className="";
			if(document.getElementById(subObjPre+"_"+i)) document.getElementById(subObjPre+"_"+i).style.display="none";
		}
	}
}
//切换tab标签2
function switchTabShow(obj){
	if(!obj)return;
	obj.blur();
	var tobjs=obj.parentNode.parentNode.parentNode.getElementsByTagName("LI");
	for (var i=0;i<tobjs.length;i++) {
		if(tobjs[i]==obj.parentNode.parentNode){
			tobjs[i].className="isHere";
		}else{
			tobjs[i].className="";
		}
	}
}

//阻此当事件对象向上冒泡
function stopBubble(e){
	var e=e?e:window.event;
	if(window.event){
		e.cancelBubble=true;
	}else{
		e.stopPropagation();
	}
}

//顶部菜单显示
function TopMenuShow(objname) {
	var mainObj=document.getElementById(objname);
	if(!mainObj) return;

	var MenuObj = mainObj.getElementsByTagName("li");
	for (var i=0; i<MenuObj.length; i++) {
		if(MenuObj[i].parentNode!=mainObj) continue;	//如是子菜单的LI则跳过
		MenuObj[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "menuHover";
			//修正当前LI项显示
			var mainObj=document.getElementById(objname);
			if(!mainObj) return;
			if(mainObj!=__CurrentMenuItem){
				if(__HoverMenuItem==null)
					__CurrentMenuItem.parentNode.className="";
				else
					__HoverMenuItem.parentNode.className="";
				mainObj.parentNode.className="isHere";
				window.__HoverMenuItem=mainObj;
			}else if(__HoverMenuItem!=null && __HoverMenuItem!=__CurrentMenuItem){
				__HoverMenuItem.parentNode.className="";
				__HoverMenuItem=null;
				__CurrentMenuItem.parentNode.className="isHere";
			}
			//
		}
		MenuObj[i].onMouseDown=function() {
			this.className+=(this.className.length>0? " ": "") + "menuHover";
		}
		MenuObj[i].onMouseUp=function() {
			this.className+=(this.className.length>0? " ": "") + "menuHover";
		}
		MenuObj[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)menuHover\\b"), "");
		}
	}
}
//**


//**
function checkSearchForm(frmobj) {	
	if(!frmobj)return false;
	if(frmobj.keyword.value.replace(/\s/g,"")=="" || frmobj.keyword.value.replace(/\s/g,"")=="请输入关键字"){
		alert("Please enter a keyword!");
		frmobj.keyword.focus();
		return false;
	}
	return true;
}



//Cookie操作函数
//获得Cookie解码后的值
function GetCookieVal(offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
//设定Cookie值
function SetCookie(name, value)
{
	var expdate = new Date();
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
	document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
	+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
	+((secure == true) ? "; secure" : "");
}
//获得Cookie的原始值
function GetCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return GetCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}
//end





///*选择checkbox函数*/
//objs - checkbox类型的input集合
//flag - 动作标志 1为全选 -1为反选
function selectAll(objs,flag){
	if (objs){
		if (objs.length){
			for (var i=0;i<objs.length ;i++ ){
				if (flag==1)
					objs[i].checked=true;
				if (flag==-1)
					objs[i].checked=!objs[i].checked;
			}
		}else{
			if (flag==1)
				objs.checked=true;
			if (flag==-1)
				objs.checked=!objs.checked;
		}
	}
}

function SelectInputAll(thisObj,parentObj,checkInputName)
{
	if(thisObj && parentObj)
	{
		var chkObjs=parentObj.getElementsByTagName("INPUT");
		for (var i=0;i<chkObjs.length;i++)
		{
			if (chkObjs[i].name == checkInputName)
				chkObjs[i].checked = thisObj.checked;
		}
	}
}

function isInputSelected(obj,checkInputName){
	if(!obj) return false;
	var chkObjs=obj.getElementsByTagName("INPUT");
	for (var i=0;i<chkObjs.length;i++){
		if(chkObjs[i].name==checkInputName && chkObjs[i].checked) return true;
	}
	return false;
}

//end





//改变字体大小
function ChangeFontSize(objId,size)
{
	var obj=document.getElementById(objId);
	if (obj){
		obj.style.fontSize=size+"px";
	}
	var objs=obj.getElementsByTagName("DIV");
	for (var i=0;i<objs.length ;i++ )
	{
		objs[i].style.fontSize=size+"px";
	}
	var objs=obj.getElementsByTagName("P");
	for (var i=0;i<objs.length ;i++ )
	{
		objs[i].style.fontSize=size+"px";
	}
}

//DOM兼容的showModalDialog对话框
function __ShowModalDialog(url,win,width,height){
	if (url=="" || url=="#") return false;
	if (document.all){	//IE
		window.showModalDialog(url,win,"dialogWidth="+width+"px;dialogHeight="+height+"px;scroll=yes;unadorned=no;dialogHide=yes;resizable=no;status=no;help=no;");
	}else{
		var modalWin=window.open(url,win,"width="+width+",height="+height+",menubar=no,resizable=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes");
		modalWin.moveTo((document.body.clientWidth-width)/2,(document.body.clientHeight-height)/2+100);
	}
}




//滚动函数类
function StandardScroll(root,child,cloneChild,direction,speed){
	var rootObj;
	var upT,downT,leftT,rightT;

	rootObj=document.getElementById(root);
	run=function(){
		if (direction=="up"){
			if(rootObj.parentNode.scrollTop<rootObj.offsetHeight/2)
				rootObj.parentNode.scrollTop++;
			else
				rootObj.parentNode.scrollTop=0;
		}
		if (direction=="down"){
			if(rootObj.parentNode.scrollTop>rootObj.offsetHeight/2)
				rootObj.parentNode.scrollTop--;
			else
				rootObj.parentNode.scrollTop=rootObj.offsetHeight;
		}
		if (direction=="left"){
			if(rootObj.parentNode.scrollLeft<rootObj.offsetWidth/2)
				rootObj.parentNode.scrollLeft++;
			else
				rootObj.parentNode.scrollLeft=0;
		}
		if (direction=="right"){
			if(rootObj.parentNode.scrollLeft>rootObj.offsetWidth/2)
				rootObj.parentNode.scrollLeft--;
			else
				rootObj.parentNode.scrollLeft=rootObj.offsetWidth;
		}
	}
	stop=function(){
		clearInterval(t);
	}

	start=function(){
		t=setInterval(run,speed);
	}
	
	this.init=function(){
		if (rootObj){
			document.getElementById(cloneChild).innerHTML=document.getElementById(child).innerHTML;
			start();
			if (document.all){
				rootObj.attachEvent("onmouseover",stop);
				rootObj.attachEvent("onmouseout",start);
			}else{
				rootObj.addEventListener("mouseover",stop,false);
				rootObj.addEventListener("mouseout",start,false);
			}
		}
	}
}



//JS版修正xmlhttp返回乱码，For IE
function gb2utf8(data){
	var glbEncode = [];
	gb2utf8_data = data;
	execScript("gb2utf8_data = MidB(gb2utf8_data, 1)", "VBScript");
	var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");
	t=t.split("@");
	var i=0,j=t.length,k;
	while(++i<j) {
		k=t[i].substring(0,4);
		if(!glbEncode[k]) {
			gb2utf8_char = eval("0x"+k);
			execScript("gb2utf8_char = Chr(gb2utf8_char)", "VBScript");
			glbEncode[k]=escape(gb2utf8_char).substring(1,6);
		}
		t[i]=glbEncode[k]+t[i].substring(4);
	}
	gb2utf8_data = gb2utf8_char = null;
	return unescape(t.join("%"));
}




function CheckLoginForm()
{
	if(document.loginForm.username.value=="")
	{
		alert("请输入用户名！");
		document.loginForm.username.focus();
		return false;
	}
	if(document.loginForm.password.value == "")
	{
		alert("请输入密码！");
		document.loginForm.password.focus();
		return false;
	}
	if(document.loginForm.checkCode.value == "")
	{
		alert("请输入验证码！");
		document.loginForm.checkCode.focus();
		return false;
	}
	return true;
}





//统计点击
function countHits(url){
	this.CallBack=function(strs){
		if(strs.replace(/\s/g,"")!="")eval(strs);
	};
	this.WaitProc=function(){};
	__XmlHttpPool__.GetRemoteData(url,this.CallBack,this.WaitProc);
}

function getRemoteJs(url){
	this.CallBack=function(strs){
		if(strs.replace(/\s/g,"")!="")eval(strs);
	};
	this.WaitProc=function(){};
	__XmlHttpPool__.GetRemoteData(url,this.CallBack,this.WaitProc);
}

//取URL参数值
function getUrlParam(pname){
	var arr=new Array;
	if(location.search=="")return null;
	var params=location.search.substr(1);
	if(location.search.indexOf(pname+"=")==-1)return null;
	var re = new RegExp("(&|^)[^&]*(" + pname + ")\=([^&]*)","ig");
	while(re.exec(params)){
		arr.push(RegExp.$3);
	}
	if(arr.length==0)
		return null;
	else if(arr.length==1)
		return arr[0];
	else if(arr.length>1)
		return arr;
}



//Tree Menu Function
function TreeMemu(objname) {
	var rootObj=document.getElementById(objname);
	if(!rootObj) return;
	if(rootObj.getElementsByTagName("UL")) rootObj=rootObj.getElementsByTagName("UL")[0];
	if(rootObj.getElementsByTagName("LI")) var menuItemObj = rootObj.getElementsByTagName("LI");
	for (var i=0; i<menuItemObj.length; i++) {
		if(menuItemObj[i].parentNode!=rootObj) continue;	//ignore sub category
		//if it's current category
		if(menuItemObj[i].className.toLowerCase().indexOf("ishere")>-1 || menuItemObj[i].innerHTML.toLowerCase().indexOf("ishere")>-1){
			menuItemObj[i].className+=(menuItemObj[i].className.length>0?" ":"") + "open";
		}else{
			menuItemObj[i].className=menuItemObj[i].className.replace(/( ?|^)open\b/gi, "close");
		}
		menuItemObj[i].onclick=function() {
			if(this.getElementsByTagName("LI").length==0)return;
			this.className=this.className.replace(/( ?|^)close\b/gi, "");
			this.className+=(this.className.length>0?" ":"") + "open";
			var menuSubObj=rootObj.getElementsByTagName("LI");
			for (var n=0;menuSubObj.length ;n++ )
			{
				if(menuSubObj[n].parentNode!=rootObj) continue;
				if(menuSubObj[n]!=this){
					menuSubObj[n].className=menuSubObj[n].className.replace(/( ?|^)open\b/gi, "close");
				}
			}
		}
	}
}
function TreeMenuAction(objname,action,command){
	var rootObj=document.getElementById(objname);
	if(!rootObj) return;
	if(rootObj.getElementsByTagName("UL")) 
		rootObj=rootObj.getElementsByTagName("UL")[0];
	else
		return;
	var menuItemObj = rootObj.getElementsByTagName("LI");
	if(!menuItemObj)return;
	switch(command){
		case "first":
			if(action=="open"){
				if (menuItemObj[0].className.indexOf("close")>-1){
					menuItemObj[0].className=menuItemObj[0].className.replace(/( ?|^)close\b/gi, "open");
				}else{
					menuItemObj[0].className=menuItemObj[0].className+" open";
				}
			}
			if(action=="close"){
				if (menuItemObj[0].className.indexOf("open")>-1){
					menuItemObj[0].className=menuItemObj[0].className.replace(/( ?|^)open\b/gi, "close");
				}else{
					menuItemObj[0].className=menuItemObj[0].className+" close";
				}
			}
			break;
		case "all":
			for(var i=0;i<menuItemObj.length;i++){
				if(menuItemObj[i].parentNode!=rootObj) continue;
				if(action=="open"){
					if (menuItemObj[0].className.indexOf("close")>-1){
						menuItemObj[0].className=menuItemObj[0].className.replace(/( ?|^)close\b/gi, "open");
					}else{
						menuItemObj[0].className=menuItemObj[0].className+" open";
					}
				}
				if(action=="close"){
					if (menuItemObj[0].className.indexOf("open")>-1){
						menuItemObj[0].className=menuItemObj[0].className.replace(/( ?|^)open\b/gi, "close");
					}else{
						menuItemObj[0].className=menuItemObj[0].className+" close";
					}
				}
			}
			break;
	}
	
}
//**