//前台页面方法

var LastLeftID = "";


function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}


function menuFix() {
 var obj = null;
 try{
	 obj = document.getElementById("sideBarContent").getElementsByTagName("li");
 }catch(e){}
 if (obj==null){
	 return;
 }
 
 for (var i=0; i<obj.length; i++) {
  obj[i].onmouseover=function() {
   this.className+=(this.className.length>0? " ": "") + "sfhover";
  }
  obj[i].onMouseDown=function() {
   this.className+=(this.className.length>0? " ": "") + "sfhover";
  }
  obj[i].onMouseUp=function() {
   this.className+=(this.className.length>0? " ": "") + "sfhover";
  }
  obj[i].onmouseout=function() {
   this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
  }
 }
}


function DoMenu(emid,sum)
{

var size=parseInt(sum);

 for(var i=1;i<size;i++){
 	if(document.getElementById('ChildMenu'+i).className !="collapsed"){
 		LastLeftID='ChildMenu'+i;
 	}
 }
 
 var obj = document.getElementById(emid); 
 obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded");

 if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu
 {
  document.getElementById(LastLeftID).className = "collapsed";
 }
 LastLeftID = emid;
}
function GetMenuID()
{
 var MenuID="";
 var _paramStr = new String(window.location.href);
 var _sharpPos = _paramStr.indexOf("#");
 
 if (_sharpPos >= 0 && _sharpPos < _paramStr.length - 1)
 {
  _paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length);
 }
 else
 {
  _paramStr = "";
 }
 
 if (_paramStr.length > 0)
 {
  var _paramArr = _paramStr.split("&");
  if (_paramArr.length>0)
  {
   var _paramKeyVal = _paramArr[0].split("=");
   if (_paramKeyVal.length>0)
   {
    MenuID = _paramKeyVal[1];
   }
  }
 }
 
 if(MenuID!="")
 {
  DoMenu(MenuID)
 }
}
GetMenuID(); //*这两个function的顺序要注意一下，不然在Firefox里GetMenuID()不起效果
menuFix();


function jjcx(){
	var fundmanage=document.getElementById('fundmanage').value;
	var fundname=document.getElementById('fundname').value;
	var fundcode=document.getElementById('fundcode').value;
	var fundpath=document.getElementById('fundpath').value;
	window.location='/jiaoyin/fund/jijinselect/search_list.ha?fundmanage='+fundmanage+'&fundname='+fundname+'&fundcode='+fundcode+'&fundpath='+fundpath;
}

function checkuserinfo()
{
        var cname=document.getElementById('cname').value;
        var password=document.getElementById('password').value;
        
	    if(cname=='' || cname==null)
	 	{
	 	   alert('请输入用户名!');
		   document.getElementById('cname').focus();
		   return false ;
		}
		if(password=='' || password==null)
		{
		   alert('请输入密码!');
		   document.getElementById('password').focus();
		   return false ;
	 	   
		}else
		{
		   dengluform.submit();
		   return true;
		}
	
}




//前台用户密码重置
function selectLogonMode(mode)
	{
		
		if(mode=='jjzh'){
			document.getElementById("certnotd").innerText="基金帐号：";
			document.getElementById("certtype").disabled="disabled";
		}else{
			
			if(mode=='grzj'){
				document.getElementById("certtypelb").innerHTML='<select name="certtype" id="certtype"><option value="0">身份证</option><option value="1">护照</option><option value="2">军官证</option><option value="3">士兵证</option><option value="4">回乡证</option><option value="5">户口本</option><option value="6">外国护照</option><option value="7">其它</option></select>';
		  	}else{
		  		document.getElementById("certtypelb").innerHTML='<select name="certtype" id="certtype"><option value="0">技术监督局</option><option value="1">营业执照</option><option value="2">行政机关</option><option value="3">社会团体</option><option value="4">军队</option><option value="5">武警</option><option value="6">下属机构</option><option value="7">基金会</option><option value="8">其它机构</option></select>';
			}
			
			document.getElementById("certnotd").innerText="证件号码：";
			document.getElementById("certtype").disabled="";			
		}
	}
	
	
	///根据用户选择的不同登录类型 出现不同的登录框
	function onchangeselete()
	{
            var logintype= document.getElementById('logintype').value;
            var tele = document.getElementById("tele");
            var email = document.getElementById("email");
            var uname = document.getElementById("uname");
            if(logintype=='0')
            {
                  if(tele.style.display=="none")
	              { 
			          tele.style.display="block";
			          email.style.display="none";
			          uname.style.display="none";
	              }
            }else if(logintype=='1')
            {
                 if(email.style.display=="none")
	              { 
			          email.style.display="block";
			          tele.style.display="none";
			          uname.style.display="none";
	              }
            }
            else if(logintype=='2')
            {
                 if(uname.style.display=="none")
	              { 
			          uname.style.display="block";
			          tele.style.display="none";
			          email.style.display="none";
	              }
            }
	}
	
	
	  //用户注册类型的选择
		function registertypeselete()
	    {
            var logintype= document.getElementById('lotype').value;
            document.getElementById('loginmodle').value=logintype;
            var orital = document.getElementById("reorital");
            var tele = document.getElementById("retele");
            var email = document.getElementById("reemail");
            var uname = document.getElementById("reuname");
            
            if(logintype=='0')
            {
                  if(tele.style.display=="none")
	              { 
			          tele.style.display="block";
			          orital.style.display="none";
			          email.style.display="none";
			          uname.style.display="none";
	              }
            }else if(logintype=='1')
            {
                 if(email.style.display=="none")
	              { 
			          email.style.display="block";
			          orital.style.display="none";
			          tele.style.display="none";
			          uname.style.display="none";
	              }
            }
            else if(logintype=='2')
            {
                 if(uname.style.display=="none")
	              { 
			          uname.style.display="block";
			          orital.style.display="none";
			          tele.style.display="none";
			          email.style.display="none";
	              }
            }
            else
            {
                  tele.style.display="none";
		          orital.style.display="block";
		          email.style.display="none";
		          uname.style.display="none";
            }
	}
	
	
	//机构用户的类型选择
	
    function onjgchangeselete()
	{
            var logintype= document.getElementById('logintype').value;
            var tele = document.getElementById("tele");
            var email = document.getElementById("email");
            var uname = document.getElementById("uname");
            javascript:src='/gate/createrandimageaction.ha?randomkey='+Math.random();
              
            if(logintype=='0')
            {
                  if(tele.style.display=="none")
	              { 
			          tele.style.display="block";
			          email.style.display="none";
			          uname.style.display="none";
	              }
            }else if(logintype=='1')
            {
                 if(email.style.display=="none")
	              { 
			          email.style.display="block";
			          tele.style.display="none";
			          uname.style.display="none";
	              }
            }
            else if(logintype=='2')
            {
                 if(uname.style.display=="none")
	              { 
			          uname.style.display="block";
			          tele.style.display="none";
			          email.style.display="none";
	              }
            }
	}
	
	function checkwebuser()
	{
			
	       var logintype= document.getElementById('logintype').value;
            if(logintype=='' || logintype==null)
	     	{
	     	   alert('请选择登录类型!');
			   document.getElementById('logintype').focus();
			   return false ;
			}
			   var telphone=document.getElementById('telphone').value;
			   var telpwd=document.getElementById('telpwd').value;
			   
			   var email=document.getElementById('emaill').value;
			   var emailpwd=document.getElementById('emailpwd').value;
			   
			    var reusername=document.getElementById('reusername').value;
			    var repassword=document.getElementById('repassword').value;
			   
		    if(logintype=='0')
			{
			 
			    if(telphone=='' || telphone==null)
			   {
			       alert('请输入手机号码!');
			       document.getElementById('telphone').focus();
			       return false ;
			   }
			    if(telpwd=='' || telpwd==null)
			   {
			       alert('请输入密码!');
			       document.getElementById('telpwd').focus();
			       return false ;
			   }
			   
			}
			if(logintype=='1')
			{
			 
			    if(email=='' || email==null)
			   {
			       alert('请输入邮箱地址!');
			       document.getElementById('email').focus();
			       return false ;
			   }
			    if(emailpwd=='' || emailpwd==null)
			   {
			       alert('请输入密码!');
			       document.getElementById('emailpwd').focus();
			       return false ;
			   }
		
			}
			
			if(logintype=='2')
			{
			   
			    if(reusername=='' || reusername==null)
			   {
			       alert('请输入用户名!');
			       document.getElementById('reusername').focus();
			       return false ;
			   }
			    if(repassword=='' || repassword==null)
			   {
			       alert('请输入密码!');
			       document.getElementById('repassword').focus();
			       return false ;
			   }
		
			}
			
			 document.getElementById('webuserloginform').submit();
	}
	
	function checkjgbuser()
	{
			
	       var logintype= document.getElementById('logintype').value;
            if(logintype=='' || logintype==null)
	     	{
	     	   alert('请选择登录类型!');
			   document.getElementById('logintype').focus();
			   return false ;
			}
			   var telphone=document.getElementById('telphone').value;
			   var telpwd=document.getElementById('telpwd').value;
			   
			   var email=document.getElementById('emaill').value;
			   var emailpwd=document.getElementById('emailpwd').value;
			   
			    var reusername=document.getElementById('reusername').value;
			    var repassword=document.getElementById('repassword').value;
			   
		    if(logintype=='0')
			{
			 
			    if(telphone=='' || telphone==null)
			   {
			       alert('请输入手机号码!');
			       document.getElementById('telphone').focus();
			       return false ;
			   }
			    if(telpwd=='' || telpwd==null)
			   {
			       alert('请输入密码!');
			       document.getElementById('telpwd').focus();
			       return false ;
			   }
			   
			}
			if(logintype=='1')
			{
			 
			    if(email=='' || email==null)
			   {
			       alert('请输入邮箱地址!');
			       document.getElementById('email').focus();
			       return false ;
			   }
			    if(emailpwd=='' || emailpwd==null)
			   {
			       alert('请输入密码!');
			       document.getElementById('emailpwd').focus();
			       return false ;
			   }
		
			}
			
			if(logintype=='2')
			{
			   
			    if(reusername=='' || reusername==null)
			   {
			       alert('请输入用户名!');
			       document.getElementById('reusername').focus();
			       return false ;
			   }
			    if(repassword=='' || repassword==null)
			   {
			       alert('请输入密码!');
			       document.getElementById('repassword').focus();
			       return false ;
			   }
		
			}
			
		  if(document.getElementById("userimg").style.display=="block")
			{
			         if(document.getElementById("randimage").value=='' || document.getElementById("randimage").value==null)
				    {
				       alert('请输入验证码!');
				       document.getElementById('userrandimage').focus();
				       return false ;
				    }
			      
			  }
			 document.getElementById('webuserloginform').submit();
		}
			
			
	function gototurl()
	{
	  window.location.href='/jiaoyin/register/register_yhzc.ha';
	}

	function shanchu(num){
		document.getElementById('tr'+num).style.display='none';
	}
	
	function add(num){
		if(document.getElementById('resourcepk'+num).value==''){
			alert('请先选择上传资源！');
		}else{
			document.getElementById('tr'+(parseInt(num)+1)).style.display='block';
		}
		
	}

 function jggototurl()
	{
	  window.location.href='/jiaoyin/register/register_jg.ha';
	}
	
function logoncom(){
	var lname=document.getElementById('lname').value;
	var lmobile=document.getElementById('lmobile').value;
	var lemail=document.getElementById('lemail').value;
   if(lemail!=""){
		document.getElementById('logintype').selectedIndex =2;
		document.getElementById('uname').style.display="none";
		document.getElementById('tele').style.display="none";
		document.getElementById('email').style.display="";
		document.getElementById('emaill').value=lemail;
	}
	if(lmobile!=""){
		document.getElementById('logintype').selectedIndex =1;
		document.getElementById('uname').style.display="none";
		document.getElementById('tele').style.display="";
		document.getElementById('email').style.display="none";
		document.getElementById('telphone').value=lmobile;
	}
	if(lname!=""){
		document.getElementById('logintype').selectedIndex =0;
		document.getElementById('uname').style.display="";
		document.getElementById('tele').style.display="none";
		document.getElementById('email').style.display="none";
		document.getElementById('reusername').value=lname;
	}
}

function zcinfoshow(){
	var lname=document.getElementById('lname').value;
	var lmobile=document.getElementById('lmobile').value;
	var lemail=document.getElementById('lemail').value;
   if(lemail!=""){
		document.getElementById('lotype').selectedIndex =2;
		document.getElementById('uname').style.display="none";
		document.getElementById('tele').style.display="none";
		document.getElementById('email').style.display="";
		document.getElementById('regemaill').value=lemail;
	}
	if(lmobile!=""){
		document.getElementById('lotype').selectedIndex =1;
		document.getElementById('uname').style.display="none";
		document.getElementById('tele').style.display="";
		document.getElementById('email').style.display="none";
		document.getElementById('regtelphone').value=lmobile;
	}
	
}





/**//*  
**     ==================================================================================================  
**     类名：CLASS_MSN_MESSAGE  
**     功能：提供类似MSN消息框  
**     示例：  
     ---------------------------------------------------------------------------------------------------  
  
             var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示：","您有1封消息","今天请我吃饭哈");  
                 MSG.show();  
  
     ---------------------------------------------------------------------------------------------------  
**     作者：ttyp  
**     邮件：ttyp@21cn.com  
**     日期：2005-3-18  
**     ==================================================================================================  
**/  
  
  
/**//*  
*     消息构造  
*/  
function CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action){  
     this.id      = id;  
     this.title   = title;  
     this.caption= caption;  
     this.message= message;  
     this.target = target;  
     this.action = action;  
     this.width     = width?width:200;  
     this.height = height?height:120;  
     this.timeout= 150;  
     this.speed     = 20; 
     this.step     = 1; 
     this.right     = screen.width -1;  
     this.bottom = screen.height; 
     this.left     = this.right - this.width; 
     this.top     = this.bottom - this.height; 
     this.timer     = 0; 
     this.pause     = false;
     this.close     = false;
     this.autoHide     = true;
}  
  
/**//*  
*     隐藏消息方法  
*/  
CLASS_MSN_MESSAGE.prototype.hide = function(){  
     if(this.onunload()){  

         var offset   = this.height>this.bottom-this.top?this.height:this.bottom-this.top; 
         var me   = this;  

         if(this.timer>0){   
             window.clearInterval(me.timer);  
         }  

         var fun = function(){  
             if(me.pause==false||me.close){
                 var x   = me.left; 
                 var y   = 0; 
                 var width = me.width; 
                 var height = 0; 
                 if(me.offset>0){ 
                     height = me.offset; 
                 } 
     
                 y   = me.bottom - height; 
     
                 if(y>=me.bottom){ 
                     window.clearInterval(me.timer);  
                     me.Pop.hide();  
                 } else { 
                     me.offset = me.offset - me.step;  
                 } 
                 me.Pop.show(x,y,width,height);    
             }             
         }  
		
         this.timer = window.setInterval(fun,this.speed)    
           
     }  
}  
  
/**//*  
*     消息卸载事件，可以重写  
*/  
CLASS_MSN_MESSAGE.prototype.onunload = function() {  
     return true;  
}  
/**//*  
*     消息命令事件，要实现自己的连接，请重写它  
*  
*/  
CLASS_MSN_MESSAGE.prototype.oncommand = function(){  
     //this.close = true;
window.open(this.action,this.target); 
     this.hide();  
}  
  
/**//*  
*     消息显示方法  
*/  
CLASS_MSN_MESSAGE.prototype.show = function(){  

     var oPopup = window.createPopup(); //IE5.5+  
    
     this.Pop = oPopup;  
  
     var w = this.width;  
     var h = this.height;  
  
     var str = "<DIV style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: " + w + "px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: " + h + "px; BACKGROUND-COLOR: #c9d3f3'>"  
         str += "<TABLE style='BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid' cellSpacing=0 cellPadding=0 width='100%' bgColor=#cfdef4 border=0>"  
         str += "<TR>"  
         str += "<TD style='FONT-SIZE: 12px;COLOR: #0f2c8c' width=30 height=24></TD>"  
         str += "<TD style='PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #1f336b; PADDING-TOP: 4px' vAlign=center width='100%'>" + this.caption + "</TD>"  
         str += "<TD style='PADDING-RIGHT: 2px; PADDING-TOP: 2px' vAlign=center align=right width=19>"  
         str += "<SPAN title=关闭 style='FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px' id='btSysClose' >×</SPAN></TD>"  
         str += "</TR>"  
         str += "<TR>"  
         str += "<TD style='PADDING-RIGHT: 1px;PADDING-BOTTOM: 1px' colSpan=3 height=" + (h-28) + ">"  
         str += "<DIV style='BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 8px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 8px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%'>" + this.title + "<BR><BR>"  
         str += "<DIV style='WORD-BREAK: break-all' align=left><A href='javascript:void(0)' hidefocus=true id='btCommand'><FONT color=#ff0000>" + this.message + "</FONT></A></DIV>"  
         str += "</DIV>"  
         str += "</TD>"  
         str += "</TR>"  
         str += "</TABLE>"  
         str += "</DIV>"  
  
     oPopup.document.body.innerHTML = str; 
    
  
     this.offset   = 0; 
     var me   = this;  

     oPopup.document.body.onmouseover = function(){me.pause=true;}
     oPopup.document.body.onmouseout = function(){me.pause=false;}

     var fun = function(){  
         var x   = me.left; 
         var y   = 0; 
         var width     = me.width; 
         var height     = me.height; 

             if(me.offset>me.height){ 
                 height = me.height; 
             } else { 
                 height = me.offset; 
             } 

         y   = me.bottom - me.offset; 
         if(y<=me.top){ 
             me.timeout--; 
             if(me.timeout==0){ 
                 window.clearInterval(me.timer);  
                 if(me.autoHide){
                     me.hide(); 
                 }
             } 
         } else { 
             me.offset = me.offset + me.step; 
         } 
         me.Pop.show(x,y,width,height);    

     }  
  
     this.timer = window.setInterval(fun,this.speed)      
  
     
  
     var btClose = oPopup.document.getElementById("btSysClose");  
  
     btClose.onclick = function(){  
         me.close = true;
         me.hide();  
     }  
  
     var btCommand = oPopup.document.getElementById("btCommand");  
     btCommand.onclick = function(){  
         me.oncommand();  
     }    
}  
/**//* 
** 设置速度方法 
**/ 
CLASS_MSN_MESSAGE.prototype.speed = function(s){ 
     var t = 20; 
     try { 
         t = praseInt(s); 
     } catch(e){} 
     this.speed = t; 
} 
/**//* 
** 设置步长方法 
**/ 
CLASS_MSN_MESSAGE.prototype.step = function(s){ 
     var t = 1; 
     try { 
         t = praseInt(s); 
     } catch(e){} 
     this.step = t; 
} 
  
CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){ 
     try { 
         this.left         = left     !=null?left:this.right-this.width; 
         this.right         = right     !=null?right:this.left +this.width; 
         this.bottom         = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height; 
         this.top         = top     !=null?top:this.bottom - this.height; 
     } catch(e){} 
} 

//同时两个有闪烁，只能用层代替了，不过层不跨框架 
//var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示：","您有2封消息","好的啊");  
//    MSG2.rect(100,null,null,screen.height); 
//     MSG2.show();  
//-->  

function selectexp(tag){
	
	if(tag=="mg"){
		document.getElementById('W00001').style.display="block";
		document.getElementById('W00002').style.display="block";
		document.getElementById('W00003').style.display="block";
		document.getElementById('W00032').style.display="none";
		document.getElementById('W00031').style.display="none";
		document.getElementById('W00030').style.display="none";
		document.getElementById('HSI001').style.display="none";
		document.getElementById('W00004').style.display="none";
		document.getElementById('W00040').style.display="none";
		
		document.getElementById('WY0004').style.display="none";
		document.getElementById('WY0006').style.display="none";
		
		document.getElementById("0").className="newsTagexp";
		document.getElementById("1").className="newsTagexpno";
		document.getElementById("2").className="newsTagexpno";
		document.getElementById("3").className="newsTagexpno";
	}else if(tag=="oz"){
		document.getElementById('W00001').style.display="none";
		document.getElementById('W00002').style.display="none";
		document.getElementById('W00003').style.display="none";
		document.getElementById('W00032').style.display="block";
		document.getElementById('W00031').style.display="block";
		document.getElementById('W00030').style.display="block";
		document.getElementById('HSI001').style.display="none";
		document.getElementById('W00004').style.display="none";
		document.getElementById('W00040').style.display="none";
		
		document.getElementById('WY0004').style.display="none";
		document.getElementById('WY0006').style.display="none";
		
		document.getElementById("0").className="newsTagexpno";
		document.getElementById("1").className="newsTagexp";
		document.getElementById("2").className="newsTagexpno";
		document.getElementById("3").className="newsTagexpno";
	}
	else if(tag=="yz"){
		document.getElementById('W00001').style.display="none";
		document.getElementById('W00002').style.display="none";
		document.getElementById('W00003').style.display="none";
		document.getElementById('W00032').style.display="none";
		document.getElementById('W00031').style.display="none";
		document.getElementById('W00030').style.display="none";
		document.getElementById('HSI001').style.display="block";
		document.getElementById('W00004').style.display="block";
		document.getElementById('W00040').style.display="block";
		
		document.getElementById('WY0004').style.display="none";
		document.getElementById('WY0006').style.display="none";
		
		document.getElementById("0").className="newsTagexpno";
		document.getElementById("1").className="newsTagexpno";
		document.getElementById("2").className="newsTagexp";
		document.getElementById("3").className="newsTagexpno";
	}else if(tag=="zysp"){
	
		document.getElementById('W00001').style.display="none";
		document.getElementById('W00002').style.display="none";
		document.getElementById('W00003').style.display="none";
		document.getElementById('W00032').style.display="none";
		document.getElementById('W00031').style.display="none";
		document.getElementById('W00030').style.display="none";
		document.getElementById('HSI001').style.display="none";
		document.getElementById('W00004').style.display="none";
		document.getElementById('W00040').style.display="none";
		
		document.getElementById('WY0004').style.display="block";
		document.getElementById('WY0006').style.display="block";
		
		document.getElementById("0").className="newsTagexpno";
		document.getElementById("1").className="newsTagexpno";
		document.getElementById("2").className="newsTagexpno";
		document.getElementById("3").className="newsTagexp";
	}
	
}
