function getId(elemId){
		if(document.getElementById){
			return document.getElementById(elemId);
		}else if(document.layers){
			document.layers[elemId];
		}else{
			return eval('document.all.' + elemId);
		}
	}
function AddFavorite(sURL, sTitle){
    try{
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e){
        try{
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e){
            alert("加入收藏夹");
        }
    }
}

function HoverLi(n){ 
	if(n<=2){
		for(var i=1;i<=2;i++){
		getId('tb_'+i).className='normaltab';
		getId('tbc_0'+i).className='undis';
		}
	}else{
	for(var i=3;i<=4;i++){
		getId('tb_'+i).className='normaltab';
		getId('tbc_0'+i).className='undis';
	}
	}
		getId('tbc_0'+n).className='dis';
		getId('tb_'+n).className='hovertab'; 
} 

//跳转页面显示
function ShowPage(TotalPage,PageIndex,url){
	document.write("<table style='clear: both;width:100%;'><tr><td valign='center' class='PageInation'><a class=MultiPages>"+PageIndex+"/"+TotalPage+"</a>");
	if (PageIndex<6) {
		PageLong=11-PageIndex;
	}
	else
		if (TotalPage-PageIndex<6) {
			PageLong=10-(TotalPage-PageIndex)
		}
		else {
			PageLong=5;
		}
	for (var i=1; i <= TotalPage; i++) {
		if (i < PageIndex+PageLong && i > PageIndex-PageLong || i==1 || i==TotalPage){
			if (PageIndex==i) {
				document.write("<a class=CurrentPage>"+ i +"</a>");
			}
			else {
			document.write("<a class=PageNum href=?p="+i+"&"+url+">"+ i +"</a>");
			}
		}
	}
	document.write("<input onkeydown=if((event.keyCode==13)&&(this.value!=''))window.location='?p='+this.value+'&"+url+"'; onkeyup=if(isNaN(this.value))this.value='' class=PageInput></td></tr></table>");
}

//全选复选框
function CheckAll(form){
	for (var i=0;i<form.elements.length;i++){
	var e = form.elements[i];
	if (e.name != 'chkall' && e.type=="checkbox")e.checked = form.chkall.checked;
	}
}

function OpenWindow (target) { 
  window.open(target, "_Child", "toolbar=no,scrollbars=yes,resizable=yes,width=400,height=400"); 
}

// Flash Document
function normalswf(sFile,sWidth,sHeight){
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ sWidth +'" height="'+ sHeight +'">  ');
 document.write(' <param name="movie" value="'+ sFile +'">  ');
 document.write(' <param name="quality" value="high">  ');
 document.write(' <param name="wmode" value="transparent">');
 document.write(' <embed wmode="transparent" src="'+ sFile +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ sWidth +'" height="'+ sHeight +'"></embed>  ');
 document.write('</object> ');
}
function noTranswf(sFile,sWidth,sHeight){
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ sWidth +'" height="'+ sHeight +'">  ');
 document.write(' <param name="movie" value="'+ sFile +'">  ');
 document.write(' <param name="quality" value="high">  ');
 document.write(' <param name="wmode" value="">  ');
 document.write(' <embed src="'+ sFile +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ sWidth +'" height="'+ sHeight +'"></embed>  ');
 document.write('</object> ');
}
function parameterswf(sFile,sWidth,sHeight,sID){
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ sWidth +'" height="'+ sHeight +'">  ');
 document.write(' <param name="movie" value="'+ sFile +'">  ');
 document.write(' <param name="quality" value="high">  ');
 document.write(' <param name="wmode" value="">  ');
 document.write(' <param name="flashvars" value="no='+ sID +'" />  ');
 document.write(' <embed src="'+ sFile +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ sWidth +'" height="'+ sHeight +'"></embed>  ');
 document.write('</object> ');
}

//图片自动调整的模式，1为按比例调整 ，2 按大小调整。
var resizemode=1
function imgresize(o){
   if (resizemode==2 || o.onmousewheel){
   if(o.width > 500 ){
    o.style.width='500px';
   }
   if(o.height > 800){
    o.style.height='800px';
   }
  }else{
  var parentNode=o.parentNode.parentNode
  if (parentNode){
  if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='100%';
  }else{
  var parentNode=o.parentNode
  if (parentNode){
   if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='100%';
   }
  }
 }
 }
//打印内容
function doPrint(){
var printid=getId('printContent');
var mContent = printid.innerHTML;
document.body.innerHTML = mContent;
window.print();
}
//菜单
var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=20	//菜单距连接文字顶端距离

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all

function showmenu(e,vmenu,mod){
	if (!vmenu){return false;} //如果空则不显示
	var which=vmenu
	menuobj=document.getElementById("popmenu")
	menuobj.thestyle=menuobj.style
	menuobj.innerHTML=which
	menuobj.contentwidth=menuobj.offsetWidth
	eventX=e.clientX
	eventY=e.clientY
	var rightedge=document.body.clientWidth-eventX
	var bottomedge=document.body.clientHeight-eventY
	var getlength
		if (rightedge<menuobj.contentwidth){
			getlength=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
		}else{
			getlength=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
		}
		menuobj.thestyle.left=getlength+'px'
		if (bottomedge<menuobj.contentheight&&mod!=0){
			getlength=ie4? document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23 : ns6? window.pageYOffset+eventY-menuobj.contentheight-10 : eventY-menuobj.contentheight
		}	else{
			getlength=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
		}
	menuobj.thestyle.top=getlength+'px'
	menuobj.thestyle.visibility="visible"
}

function ie_y(e){  
	var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
}  
function ie_x(e){  
	var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}  

function highlightmenu(e,state){
	if (document.all)
		source_el=event.srcElement
	else if (document.getElementById)
		source_el=e.target
	if (source_el.className=="menuitems"){
		source_el.id=(state=="on")? "mouseoverstyle" : ""
	}
	else{
		while(source_el.id!="popmenu"){
			source_el=document.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
			}
		}
	}
}

function hidemenu(){if (window.menuobj)menuobj.thestyle.visibility="hidden"}
function dynamichide(e){if ((ie4||ns6)&&!menuobj.contains(e.toElement))hidemenu()}

document.onclick=hidemenu
document.write("<div class=menuskin id=popmenu onmouseover=highlightmenu(event,'on') onmouseout=highlightmenu(event,'off');dynamichide(event)></div>")
// 菜单END