function showList(div_id,event) 
{ 
	var obj = window.document.getElementById(div_id + "_ljf"); 

	if(obj.style.display=='none'){
		show_div(div_id,event);
	}else{
		hidden_div(div_id,event);
	}
}

function show_div(div_id,event){
	var div = window.document.getElementById(div_id+'_ljf');
	div.style.display="block";
}

function hidden_div(div_id,theEvent){
	var div = window.document.getElementById(div_id+'_ljf');
	if(typeof(HTMLElement)!="undefined")    //给firefox定义contains()方法，ie下不起作用
	{   
	      HTMLElement.prototype.contains=function(obj)   
	      {   
	          while(obj!=null&&typeof(obj.tagName)!="undefind"){ //通过循环对比来判断是不是obj的父元素
				if(obj==this) return true;   
	  			obj=obj.parentNode;
			}   
	          return false;   
	      };   
	}  
	if (theEvent){
        var browser=navigator.userAgent;   //取得浏览器属性
        if (browser.indexOf("Firefox")>0){ //如果是Firefox
             if (div.contains(theEvent.relatedTarget)) { //如果是子元素
                return;   //结束函式
                 } 
         } 
           if (browser.indexOf("MSIE")>0){ //如果是IE
                   if (div.contains(event.toElement)) { //如果是子元素
                         return; //结束函式
                    }
          }
      }
	div.style.display="none";
}

//显示验证码
function yzm(form_id,div_id){
	var num1=Math.round(Math.random()*10000000);
	var num=num1.toString().substr(0,4);
	div = document.getElementById(div_id);
	form = document.getElementById(form_id);
	div.innerHTML = "<img id=codeimg"+form.name+" name=codeimg"+form.name+" width=50 heigh=22 src='"+"yzm.php?num="+num+"'>";
	check2 = document.getElementsByName(form_id+"_check2");
	check2.value=num;
}

//刷新验证码
function code(form_id,div_id){
	form = document.getElementById(form_id);
	var num1=Math.round(Math.random()*10000000);
	var num=num1.toString().substr(0,4);
	var img = document.getElementById('codeimg'+form.name);
	img.src="yzm.php?num="+num;
	check2 = document.getElementsByName(form_id+"_check2");
	check2.value=num;
}
function trim(str){
	// 用正则表达式将前后空格
	// 用空字符串替代。
	return str.replace(/(^\s*)|(\s*$)/g, "");

}
