function window_onload(){
  try{
	  onclick_style();
  }catch(e){

  }
  //alert("3");
  try{
  	//if(window.init){
		init();
	//}
  }catch(e){
	//window.status=e;
  }
  //alert("4");
  try{	//规则/指南--->会员业务指引栏目下的java script
  	//if(window.hiddensubtable)
 	 	hiddensubtable();  
    	hiddensubtable2();
	//}
  }catch(e){
  }	
  //alert("5");
  try{
    if(window.CheckUIElements){
    	CheckUIElements();//首页滚动
    }
  }catch(e){
  }

}

// 处理鼠标点击效果

function onclick_style() {
	var link, objLinks, i;
	link = GetPageName(window.location.href);
	//link = unescape(link);
	objLinks = document.getElementsByTagName("A");
	for(i = 0; i < objLinks.length; i++)
	{
		obj = objLinks[i];
		var url ;
		//增加对obj的判断，如果obj为空，通过getAttribute来取
		if(obj == null || obj==""){
			url= obj.getAttribute("href");
			if(!url || url == ''){
				url = obj.getAttribute("url");
			}
		}else{
			url = obj.href;
			if(!url || url == ''){
				url = obj.url;
			}
		}
		
		if(!url||url=='') continue;
		if(link == GetPageName(url))
		{

			while(obj != null && obj.tagName != "TD")
				//前面为IE浏览器，后面parentNode为火狐浏览器
				obj = obj.parentElement||obj.parentNode;
			//alert("aaaaaaaaa1"+obj.tagName);
			if(obj.tagName == "TD")
			{
				if(obj.className == "") continue;
				if(obj.className == "bg1" ){
					obj.className = "bg3";
				}
				if(obj.className == "bg8"){
					obj.style.backgroundColor = "#E6E7E7";
				}
				if(obj.className == "bg4"){
					obj.className = "bg5";
				}

				var objtable = obj;
				objtable = FindParentElement(objtable, "TABLE");
				if(objtable.tagName == "TABLE")
				{
					objtable.style.display = "";	
					var temp ;
					if(link.indexOf('rule/')>-1){
						temp = link.substring(link.indexOf('rule/'),link.length-1);
					}
					if(link.indexOf('investor/')>-1){
						temp = link.substring(link.indexOf('investor/'),link.length-1)
					}
					

					
				    //投资者教育
					if(obj.getAttribute("onclick")!=null&&obj.getAttribute("onclick")!=""){
						obj.onclick();
					}else{
						var tmps = temp.split("/");			
						if(tmps.length>=3){
							var lanmu = tmps[1]+"/"+tmps[2];
							var td = document.getElementById(lanmu);
							if(td){
								if(td.className == "bg6")
									td.className = "bg7";
							}
						}						
					}
					


					//处理视频课堂，因为视频课堂的目录结构和其他的不一样，单独取id为tzsc进行判定
					if(tmps.length >= 3){
						var test = tmps[1];
						var td = document.getElementById(test);
						if(td){
							if(td.className == "bg6")
								td.className = "bg7";
						}
					}
				}
			}
		}
	}
}
function FindParentElement(obj, tag)
{
	while(obj != null && obj.tagName != tag)
		obj = obj.parentElement;
	return obj;
}


function GetPageName(link)
{
	if(link.indexOf('cxda/')>-1){
		var p1 = link.lastIndexOf("/");
		var p2 = link.indexOf("main");
		return link.substring(p2,p1).toLowerCase();
	}else{
		return link.toLowerCase();
	}
}
