// JavaScript Document
function addLoadEvent(func) {   
    var oldonload = window.onload;   
    if(typeof window.onload != 'function') {   
        window.onload = func;   
    } else {   
        window.onload = function() {    
            oldonload();   
            func();   
        }   
    }   
} 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function pro_nav_Event(){
	
	if(!document.getElementById("proNav")) return false;
	var top_a_id=document.getElementById("proNav").getElementsByTagName("a")	
	var url=window.location.href;		
	var sort_url=getLoadUrl(url)
	for(var i=0;i<top_a_id.length;i++){
		if(url.indexOf(getLoadUrl(top_a_id[i].getAttribute("href")))!=-1){
			pro_nav(i)
			}
		}
	}
function pro_nav(num){
	var getLiClass=document.getElementById("proNav").getElementsByTagName("a")
	for(var i=0;i<getLiClass.length;i++){
	getLiClass[i].className="proLinkAStyle";	
		}
	getLiClass[num].className="proCheckedAStyle";
	}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function top_nav_Event(){
	if(!document.getElementById("nav")) return false;
	var top_a_id=document.getElementById("nav").getElementsByTagName("a")	
	var url=window.location.href;		
	var sort_url=getLoadUrl(url)
	for(var i=0;i<top_a_id.length;i++){
		if(url.indexOf(getLoadUrl(top_a_id[i].getAttribute("href")))!=-1){
			top_nav(i)
			}
		}
	}
function top_nav(num){
	var getLiClass=document.getElementById("nav").getElementsByTagName("a")
	for(var i=0;i<getLiClass.length;i++){
	getLiClass[i].className="oneATagLink";	
		}
	getLiClass[num].className="oneATagChecked";
	}
function nav_childs(){
	var nav_li_length=document.getElementById("nav_ul").getElementsByTagName("h1");
	var nav_li_lengths=document.getElementById("nav_ul").getElementsByTagName("li");
	var old=true;
	for(var i=0;i<nav_li_length.length;i++){
		//alert(nav_li_length.length[i])
	if(old){
		old=false;
		}else{
		nav_li_lengths[i].style.backgroundColor="#f9f9f9";
		old=true;
			}
		//alert("123");
	}
	//alert(nav_li_length.length);

//alert(screen.availHeight)
	}

	

/*二级菜单导航*/
function navChild(num){
	var childblock=document.getElementById("nav_ul").getElementsByTagName("ul")
	var childblock_h1=document.getElementById("nav_ul").getElementsByTagName("h1")
	var childblock_span=document.getElementById("nav_ul").getElementsByTagName("span")
	var childblock_li=document.getElementById("nav_ul").getElementsByTagName("li");
	
	for(var i=0;i<childblock.length;i++){
			if(num==i){ 
			//alert("num="+num+","+"i="+i)
			//alert(childblock[i].style.display)
			   // if(num%2==0){
				//	alert(childblock_li.firstChild.className)
				//childblock_li[i].style.backgroundColor="#f9f9f9";	
				
				//}
				if(childblock[i].style.display==""){
					childblock[i].style.display="none"
					
					}
				if(childblock[i].style.display=="none"){
					childblock[i].style.display="block"
					childblock_h1[i].className="CKfont_ico"
					childblock_span[i].className="enterprise_icos"
					//alert(childblock_span[i].className)
					//if(childblock_span[i].className=="font_ico"){
					//alert(childblock_span[i].className.length)
					
					}
					else{
					childblock[i].style.display="none"	
					childblock_h1[i].className="font_ico"
					childblock_span[i].className="enterprise_ico"
					}
			}else{
				childblock[i].style.display="none"	
				childblock_h1[i].className="font_ico"
				childblock_span[i].className="enterprise_ico"
				}
		}
	}
function hoverli(){
		var nav_li_length=document.getElementById("nav_ul").getElementsByTagName("li");
		for(var i=0;i<nav_li_length.length;i++){
		window.onmouseover=nav_li_length[i];
		}
	}	
/*二级菜单导航*/
/*
 *导般显示
 */
/*
 *loaded函数  作用：传值得 className
 */	
function nav_show(){
	if(!(document.getElementById("nav_brand"))) return false
	
	var nav_id=document.getElementById("nav_brand").getElementsByTagName("li")
	var nav_a=document.getElementById("nav_brand").getElementsByTagName("a")
	var url=window.location.href
		for(var i=0;i<nav_a.length;i++){	
			if(url.indexOf(nav_a[i].getAttribute("href"))!=-1){
				
				nav_fun(i) 	
			}
		}	
	}	
/*
 *获取截入网页名的 '类'
 */	
function nav_fun(num){
		var nav_a_copy=document.getElementById("nav_brand").getElementsByTagName("a")
		var nav_span_copy=document.getElementById("nav_brand").getElementsByTagName("span")
		nav_a_copy[num].className="branda"	
	    nav_span_copy[num].className="brandspan"		
	}	
/*载入网页时 获取该网页的名字*/
function getLoadUrl(url){
	urls=url.split("/")
	return urls[urls.length-1]
	}
	
function getClassNameNum(idstr){
	if(	!(document.getElementById(idstr))) return false;	
	var tag_mune=document.getElementById(idstr).getElementsByTagName("a")
	//alert(tag_mune.length)
	//tab_mune[0].setAttribute("class","list_news_a");
	for(var i=0;i<tag_mune.length;i++){
		
		tag_mune[i].onmouseover=function(){
			eventover(this,idstr)
			return false
			}
		}
	}	
function eventover(act,idstr){	

	var tag_mune=document.getElementById(idstr).getElementsByTagName("a")
	
	for(var i=0;i<tag_mune.length;i++){
		tag_mune[i].className=""
		}
		act.className="list_news_a"
	if(idstr=="tab_new_mune_title"){
		var tag_con=document.getElementById("tab_new_mune_list").getElementsByTagName("ul")
		for(var j=0;j<tag_mune.length;j++){
		  tag_con[j].className="" 
		if(tag_mune[j].className=="list_news_a"){
		  tag_con[j].className="ul_block"
			}
		}
		
		}	
	}
function arrayID(){
	
	var arr_id=new Array()
	arr_id[0]="tab_new_mune_title"
	arr_id[1]="tab_new_mune_title_two"
	for(value in arr_id){
		
		getClassNameNum(arr_id[value])
		}
	}
/*去除a标签的虚线框*/	
function getTagA(){
	var tagAes=document.getElementsByTagName("a")
	for(var n=0;n<tagAes.length;n++){
		tagAes[n].onfocus=function(){
			this.blur()
			}
		}
	
	}	
function tabMenuPro(){
	if(!document.getElementById("con_list_head")) return false;
	if(!document.getElementById("imgClick")) return false;
	var getTabA=document.getElementById("con_list_head").getElementsByTagName("a");
	var getTabH=document.getElementById("con_list_head").getElementsByTagName("h1");
	var getTabS=document.getElementById("con_list_head").getElementsByTagName("span");
	var getImg=document.getElementById("imgClick");
	//getTabA[0].className="pro_a_hovered";
	//getTabH[0].className="pro_h1_hovered";
	//getTabS[0].className="pro_span_hovered";
	getImg.onclick=function(){
		
	
			showPro("")
			overA("")
			overH("")
			overS("")
			return false
	}
	for(var i=0;i<getTabA.length;i++){
		
		getTabA[i].onclick=function(){
			
			overA(this)
			var getURL=this.getAttribute("href")
			getURL=getURL.split("?")
			
			showPro(getURL[1])
			return false
			}
		getTabH[i].onclick=function(){
			overH(this)
			}
		getTabS[i].onclick=function(){
			overS(this)
			}
		
		}
	
	
	}	
function overA(act){
	var getTabA=document.getElementById("con_list_head").getElementsByTagName("a");
	for(var i=0;i<getTabA.length;i++){
		getTabA[i].className="list_news_a";
		}
	act.className="pro_a_hovered";
	}	
function overH(act){
	
	var getTabH=document.getElementById("con_list_head").getElementsByTagName("h1");
	for(var i=0;i<getTabH.length;i++){
		getTabH[i].className="";
		}
	act.className="pro_h1_hovered";
	}	
function overS(act){
	var getTabS=document.getElementById("con_list_head").getElementsByTagName("span");
	for(var i=0;i<getTabS.length;i++){
		getTabS[i].className="";
		}
	act.className="pro_span_hovered";
	}		
/*===========================Ajax操作函数==============================*/
/*function pageAjaxes(){
	if(!document.getElementById("pageId")) return false;
	var getPageTagA=document.getElementById("pageId").getElementsByTagName("a");
	//alert(getPageTagA.length)
	for(var i=0;i<getPageTagA.length;i++){
		getPageTagA[i].onclick=function(){
		pageArithmetic(this)
		return false;
		}
		}
	}
var onPageNum;
var publicPageNum;
function pageArithmetic(act){
	var url=act.getAttribute("href");
	url=url.split("?");
	url="?"+url[url.length-1]
	act.setAttribute("href",url)
	url=act.getAttribute("href")
	url=url.split("&");
	pageNum=url[0];
	pageNum=pageNum.substr(6);
	//cidNum=url[1];
	//cidNum=cidNum.substr(4);
	homePageURL="?page=1&cid="+27;
	OnPageURL=""
	if(act.getAttribute("title")=="首页"){
		alert(act.getAttribute("href"))
		
		}
	if(act.getAttribute("title")=="上一页"){
		var onURL=act.getAttribute("href")
		
		publicPageNum=parseInt(pageNum)
		onPageNum=publicPageNum;
		if(onPageNum>=2)onPageNum--;
		if(onPageNum<=2)onPageNum=1;
		alert(onPageNum)
		//alert(act.getAttribute("href",homePageURL))
		}
		
	if(act.getAttribute("title")=="未页"){
		alert(act.getAttribute("href"))
		}	
	//jump(cidNum);
	}
function jump(url){
	alert(url)
	//window.location=url
	} */
	
/*===========================Ajax操作函数==============================*/	

function new_nav(){
	
	if(!document.getElementById("news_nav_ul")) return false;
	if(!document.getElementById("news_nav_ul").getElementsByTagName("ul")) return false;
	
	var getIdChild=document.getElementById("news_nav_ul").getElementsByTagName("a");
	var url=window.location.href;
	url=url.split("/")
	url=(url[url.length-1])
   
	for(var i=0;i<getIdChild.length;i++){	
		if(getIdChild[i].className=="new_list_nav"){
			var getUrl=getIdChild[i].getAttribute("href")	
			
			if(getUrl.indexOf(url)!=-1){
				getThis(i)
				}
			}
		}
	}
function getThis(num){
	var getIdUl=document.getElementById("news_nav_ul").getElementsByTagName("li")[num].getElementsByTagName("ul")[0];
	getIdUl.style.display="block";
	}
var scrollHeightNumber=0;	
var numSleep=0
var start_fun=false;
var sleep_time=3000
function link_font(get_id){
	
	if(!document.getElementById(get_id)) return false;
	var getScroll=document.getElementById(get_id);
  
    if(start_fun){	
	
			if(numSleep<=getScroll.offsetHeight){	
				 getScroll.scrollTop +=1
				 t=setTimeout("link_font('"+get_id+"')",15)
				}else{
				if(getScroll.scrollHeight==(getScroll.scrollTop+getScroll.offsetHeight)){
						getScroll.scrollTop = getScroll.scrollHeight/2-getScroll.offsetHeight;
						}
				 numSleep=0;
				 t=setTimeout("link_font('"+get_id+"')",sleep_time)
			}
			numSleep+=1
		}else{	
			getScroll.innerHTML+='<br style="clear: both" />'+getScroll.innerHTML
			
			t=setTimeout("link_font('"+get_id+"')",sleep_time)
			start_fun=true	
   	}
}	



function font_evt(get_id,tag){
	
	if(!document.getElementById(get_id)) return false;
	var getScroll=document.getElementById(get_id);
	if(getScroll.scrollTop%getScroll.offsetHeight==0){
	var getTag=getScroll.getElementsByTagName(tag);
	for(var i=0;i<getTag.length;i++){
		getTag[i].onmouseover=function(){
			clearTimeout(t);		
	}   
		getTag[i].onmouseout=function(){
			t=setTimeout("link_font('"+get_id+"')",sleep_time)
			
			}
		}
	}
	}
function foot_scorll(){
	link_font("getHeight")
	
	}
function gongao_scorll(){
	
	link_font("gonggao")

	}	
	
function Message_x(idItem){
	if(!document.getElementById(idItem)) return false;
	return document.getElementById(idItem);
	}
function Message_H(){
	
	var getJmImg=Message_x('jm').getElementsByTagName('img');
	alert(getJmImg.length);
	for(var i=0;i<getJmImg.length;i++){
		getJmImg[i].onmouseover=function(){
			alert(m);
			}
			
		}
	}	
function getThisLen(act){
	
	alert(act.length);
	}	

	








