﻿
/*导航菜单*/
$(function(){








$("#nav li[class=an2]").hover(function(){$(this).attr("class",'an1')},function(){$(this).attr("class",'an2')});

$('.type[class!=an3]').click(function(){

$('.type').removeClass('an3');

$(this).addClass('an3');
 
$("#searchform").attr('action',$(this).attr('sel'));
 
 
});


$('.qym div').click(function(){

$('.qym div').removeClass('an99');

$(this).addClass('an99');
 


});

})





//以下是常用js 函数

 

/*ie 6 下 层 不被 select  */

function topDiv(divId,iframeId)
{
    var div_dom = document.getElementById(divId);
    !iframeId && (iframeId = 'Hide4Ie6Buga');    //默认 iframe 的 id
    var iframe_dom = document.getElementById(iframeId);
    if(!iframe_dom)    //不存在 自动生成 iframe
      {
        var tmpIframeDom    = document.createElement("IFRAME");
        tmpIframeDom.id        = iframeId;
        document.body.appendChild(tmpIframeDom);
        iframe_dom = document.getElementById(iframeId);
        iframe_dom.src    = "about:blank";    //javascript:void(0);  about:blank
        iframe_dom.style.display = "block";//none
        iframe_dom.style.position = "absolute";
        iframe_dom.style.scrolling = "no";
        iframe_dom.style.frameBorder = 0;
//        iframe_dom.style.backgroundColor = "#ff0000";
//        iframe_dom.setAttribute("style","position:absolute; top:0px; left:0px; "); //display:none;
    }
    //使iframe 处于 指定的 div 下面
    iframe_dom.style.width = div_dom.offsetWidth;
    iframe_dom.style.height = div_dom.offsetHeight;
    iframe_dom.style.top = div_dom.style.top;
    iframe_dom.style.left = div_dom.style.left;
    iframe_dom.style.zIndex = div_dom.style.zIndex - 1;
//    iframe_dom.style.display = "block";
}




/*

使用方法

< a  id="a1">显示层</a>

<div  id="a2">dssssssssss</div>

 var siter = new Move_Show("a1","a2",null)
 siter.adjustwidth = -1;
 siter.init();

*/

//  显示与隐藏
function Move_Show(moveid,showid,showevent){
        this.mid = document.getElementById(moveid);
        this.sid = document.getElementById(showid);
        this.sevent = showevent
        this.hidetimer = null;
        this.adjustwidth = 0;
        var _this = this;
        this.init = function(){
            _this.mid.onmouseover =function(){
                if(!_this.sid.style.width){
                    var newsid = _this.mid;
                    while(newsid.parentNode.tagName.toLowerCase() != "li"){
                       newsid = newsid.parentNode;
                       }
                    _this.sid.style.width = newsid.offsetWidth + _this.adjustwidth + "px";
                }
                _this.sid.style.display="block";
                if(_this.sevent)
                    _this.sevent;
                if(_this.hidetimer)
                    window.clearTimeout(_this.hidetimer);
            }
            _this.mid.onmouseout = function(){
                _this.disp_none();
            }
            
            _this.sid.onmouseover = function(){
                if(_this.hidetimer)
                    window.clearTimeout(_this.hidetimer);
            }
            _this.sid.onmouseout = function(){
                _this.disp_none();
            }
        }
        
        this.disp_none = function(){
            _this.hidetimer = window.setTimeout(function(){
                _this.sid.style.display="none";
            },300);
        }
    }
	
	
	
//以下是 快速登录的一些代码

function qloginAction(u,p,fun,a){
	
	 
 
 
	 
  $.post(base_url+"/user/qlogin" ,{u:u,p:p},function(d){
					
					
					 
							 
							 
			  if(typeof(d.error)!='undefined') {
				
				
				alert(d.error);
				
				a.value='快速登录';
				
			   
			   return ;
				} 
			     
			   
			 eval(fun+"();");
		 
				  									
															
 },'json');


	
}
	
	
	
	function checknum(){
 var nn
 if(document.getElementById("postmesg").value.length>100){
      document.getElementById("postmesg").value = document.getElementById("postmesg").value.substring(0,100); }
 else 
    {nn=100-document.getElementById("postmesg").value.length;
	
	
	if(nn==-1){alert('字数不能超过100个');return ;}
	
    document.getElementById("syzs").innerHTML="剩余字数："+nn;}
 }

