// JavaScript Document js.js
$t0=(new Date()).getTime();$if_ie=(navigator.userAgent.indexOf('MSIE')== -1)?false:true;$if_ie6=(navigator.userAgent.indexOf('MSIE 6')== -1)?false:true;
if(window.HTMLElement){
HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr){var r=this.ownerDocument.createRange();r.setStartBefore(this);var parsedHTML=r.createContextualFragment(htmlStr);this.insertAdjacentElement(where,parsedHTML);}
HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode){switch(where){case "beforeBegin":this.parentNode.insertBefore(parsedNode,this);break;case "afterBegin":this.insertBefore(parsedNode,this.firstChild);break;
	case "beforeEnd":this.appendChild(parsedNode);break;case "afterEnd":if(this.nextSibling)this.parentNode.insertBefore(parsedNode,this.nextSibling);else this.parentNode.appendChild(parsedNode);break;}}
HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){ var r=this.ownerDocument.createRange();r.setStartBefore(this);
	var df=r.createContextualFragment(sHTML);this.parentNode.replaceChild(df,this);return sHTML;});
HTMLElement.prototype.__defineGetter__("outerHTML",function(){var attr,attrs=this.attributes,str="<"+this.tagName;for(var i=0;i<attrs.length;i++)
	{attr=attrs[i];if(attr.specified)str+=" "+attr.name+'="'+attr.value+'"';}return str+">"+this.innerHTML+"</"+this.tagName+">"; });
}
/*函数*/function $(id,$n){if($n==null)return document.getElementById(id);else return document.getElementsByName(id)[$n];}
/*跳转*/function GOGO(){var $href=location.href.split("?");window.open($href[0],'_self');}function GO(SID){window.open('?SID='+SID,'_self');}function G2(SID){window.open('?SID='+parseInt(SID,16),'_self');}
/*基本*/function base($url){$html='<base href="http://'+window.location.host+'/" />';if ($url!='')$html='<base href="?'+$url+'" />';if ($url.substr(0,1)=='/')$html='<base href="http://'+window.location.host+$url+'" />';document.write($html);}
//左侧菜单
function my_list($str,$id,$aim,$Re,$class){if($class==null){$class='left_menu';}
var $s='<h5 style="padding:4px;"><a href="javascript:GOGO();">显示全部</a> <a onclick="left_menu(\''+$id+"','"+$class+"_v',this.innerHTML);this.innerHTML=this.innerHTML=='关'?'开':'关';\">开</a> <a onclick=\"obj=this.parentNode.nextSibling;$d=obj.style.display=='none'?1:0;obj.style.display=$d?'':'none';this.innerHTML=$d?'隐':'显';\">显</a></h5>";
var $type=$str.charAt(0);if($Re==null)$Re='<a href="?SID='+($type%2==0?'0x':'')+'$1">$2</a>';$type=$type>>1;//$Re='<a onclick="G2(\'$1\')">$2</a>';
switch ($type){
   case 0 :$str=$str.replace(/(<[0-9a-f]?0`[^>]*>)/img,'</span></li><li>$1<span>').slice(13).replace(/<([0-9a-f]{1,2})`([^>]*)>/img,$Re)+"</span></li>";break;
   case 1 :$str=$str.replace(/<([0-9a-f]{1,2})`([^>]*)>/img,'</span></li><li>'+$Re+'<span>').slice(13)+"</span></li>";break;
   case 2 :$str=$str.replace(/(<[0-9a-f]{1,2}00`[^>]*>)/img,'</span></li><li>$1<span>').slice(13).replace(/<([0-9a-f]{3,4})`([^>]*)>/img,$Re)+"</span></li>";break;
   case 3 :$str=$str.match(/<[0-9a-f]{4}00`[^>]*>/img).join("").replace(/(<[0-9a-f]{1,2}0000`[^>]*>)/img,'</span></li><li>$1<span>').slice(12).replace(/<([0-9a-f]{5,6})`([^>]*)>/img,$Re)+"</span></li>";break;
   default :$str=$str.replace(/<([0-9a-f]{1,8})`([^>]*)>/img,'</span></li><li>'+$Re+'<span>').slice(13)+"</span></li>";break;
}var re = location.search.match(/(\?SID=[^&]*)/i);if (re != null){re=re[0];re=($type==0?re.slice(0,-1)+'0':($type==1?re:($type==2?re.slice(0,-2)+'00':($type==3?re.slice(0,-4)+'0000':''))));
if (re!=''){eval('re = /<li>(<a href="\\'+re+'")/img');$str=$str.replace(re,'<li class="left_menu_v">$1');}}
$s+='<ul class="'+$class+'" id="'+$id+'" onmouseover="left_menu(\''+$id+"','"+$class+'_v'+'\');this.onmouseover=\'\';">'+$str+'</ul>';
if($aim!=null && $($aim))$($aim).insertAdjacentHTML('beforeEnd',$s);//return ($s);
delete $str,$s;
}

function left_menu($id,$class,$type,$SID){var $li=$($id).getElementsByTagName("li"),$len=$li.length;if ($len==0)return;
if($type==null)for(var i=0;i<$len;i++){$li[i].onclick=function(){this.className=(this.className.length>0? "":$class);}
}else if ($type=='关')for(var i=0;i<$len;i++)$li[i].className='';else if ($type=='开')for(var i=0;i<$len;i++)$li[i].className=$class;}
function my_select_1($name,$str){document.getElementsByName($name)[0].insertAdjacentHTML('afterEnd',
'<select onchange="this.previousSibling.value=parseInt(this.value,16)"><option value="0">请选择</option>'+eval($str).replace(/<([0-9a-f]*)`([^>]*)>/img,'<option value="$1">$2</option>')+'</select>');}
/*动态查询select*/
function select_find($name,$str_name,$str){if($str==null)eval('$str='+$str_name);if(document.getElementsByName($name)[0])
document.getElementsByName($name)[0].insertAdjacentHTML('afterEnd','<select onchange="change('+$str_name+',this,\''+$name+'\')">'+change($str)+'</select>');}
function change($str,$this,$name){var $v=($this!=null&&$this.value!=null)?$this.value:'';var $l0=/([0]+)$/img.test($v)?RegExp.$1.length:0,$type=parseInt($str.charAt(0),16)
,$l=$type>>1,$n=2;if($l==0){$l=2;$n=1;}if($n==2)$l0>>=1;$v=$v.slice(-$l*$n);
if ($this!=null&&$this.value!=null&&$name!=null&&$this.previousSibling)$this.previousSibling.value=parseInt($v,$type%2?10:16);
var $r='$re=/<('+$v+')`([^>]*)>/img;$re0=/<('+fun_re($v,$type,$l-$l0)+"|"+fun_re($v,$type,$l0==0?($l-$l0-1):($l-$l0+1))+')`([^>]*)>/img;$re1=/( value="'+fun_re($v,$type,$l0==0?$l-$l0:$l-$l0+1)+'")/img;$re2=/( value="'+$v+'")/img;$re3=/<('+fun_re($v,$type,1)+')`([^>]*)>/img';
eval($r);if($re.test($str)){$str=$str.match($re0).join("").replace(/<([0-9a-f]*)`([^>]*)>/img,'<option value="$1">$2</option>')
.replace($re1,'$1 style="color: #00C;"').replace($re2,'$1 selected="selected"  style="color: #C00;"');
}else{$str=$str.match($re3).join("").replace(/<([0-9a-f]*)`([^>]*)>/img,'<option value="$1">$2</option>');}
$str='<option value="">请选择</option>'+$str;if($this==null)return $str;
if(navigator.userAgent.indexOf('MSIE') == -1){$this.innerHTML=$str;}else{$this.outerHTML=$this.outerHTML.replace(/(<select[^>]*>)(.*)(<\/select>)/i,'$1'+$str+'$3');}return $str;}
function fun_re($v,$type,$i){var $l=$type>>1,$n=2,$s='';if($l==0){$l=2;$n=1}return $v.slice(0,($i-1-$l)*$n)+'[0-9a-f]{'+($i==1?'1,':'')+$n+'}'+'00000000'.substr(0,($l-$i)*$n);}
//圆角调整
function jiao(TagName,className){for(var $obj=document.getElementsByTagName(TagName),$len=$obj.length,i=0;i<$len;i++){if ($obj[i].className==className){$obj[i].className='';if ($if_ie6){$obj[i].innerHTML='<i class="jiao_0_0"></i><i class="jiao_0_1"></i>'+$obj[i].innerHTML;}else{$obj[i].outerHTML='<div class="jiao">'+$obj[i].outerHTML+'</div>';}}}}
//默认动作

window.onload=function (){//if (typeof($onload)=="string")eval($onload);
if(typeof(my_onload)=="function")my_onload();
if($if_ie6){//IE6 下拉管理菜单
function admin_menu($id,$class){for(var $li=$($id).getElementsByTagName("li"),$len=$li.length,i=0;i<$len;i++)
	{$li[i].onmouseover=function(){this.className=$class;};$li[i].onmouseout=function(){this.className='';};}
	if($('form')){$($id).parentNode.onmouseover=function(){$('form').className='hidden';};$($id).parentNode.onmouseout=function(){$('form').className='';}}}
if($('admin_menu'))admin_menu('admin_menu','span_block');}

if ($('sys__info'))$('sys__info').innerHTML+='js运行 '+((new Date()).getTime()-$t0)+' 毫秒。';
//delete 变量名;
if($if_ie)CollectGarbage();
}
function long2ip(long){return(parseInt(long/16777216)+'.'+parseInt(long%16777216/65536)+'.'+parseInt(long%65536/256)+'.'+parseInt(long%256));}
function ip2long(ip){var $a=ip.split('.');return($a[0]*16777216+$a[1]*65536+$a[2]*256+parseInt($a[3]));}
//验证
function form_submit($this){var $If=true,$info='';for(var $obj=$this.elements,$count=$obj.length,$i=0;$i<$count;$i++)
{$obj[$i].parentNode.className="";
if($if_ie){if(!$obj[$i].name||!$obj[$i].ondblclick||$obj[$i].fireEvent("ondblclick"))continue;}
if(!$if_ie){if(!$obj[$i].name||!$obj[$i].ondblclick)continue;var $v;
eval($obj[$i].attributes['ondblclick'].nodeValue.replace(/return/,'$v=').replace(/this/,'$obj[$i]'));if($v)continue;}
$If=false;$obj[$i].parentNode.className="form_v";$info+=($if_ie?$obj[$i].parentNode.innerText:$obj[$i].parentNode.textContent)+"\n";
}if(!$If)alert($info);return $If;}
function is_date($text){return /^([1-9]\d)\d\d([-\/#:](((0?[13456789]|1[012])([-\/#:](0?[1-9]|[12][0-9]|30))?)|((0?[13578]|1[02])([-\/#:]31)?)|((0?2)([-\/#:](0?[1-9]|[12][0-9]))?))(( (0?[1-9]|1[0-9]|2[0-4])(:[0-5]?[0-9](:[0-5]?[0-9])?)?)?)?)?$/img.test($text)}
//复选
function form_set($str,$obj,$v){$v=$v==null?'':$v+'';$str=$str.replace(/([^,]+),?/img,'$1<input type="checkbox" onchange="form_set_v(this)" value="$1" /> ').
replace(eval('/(value="('+$v.replace(/,/img,'|')+')")/img'),'$1 checked="checked"');$str='<span>'+$str+'</span>';document.getElementsByName($obj)[0].insertAdjacentHTML('afterEnd',$str);return ($str);}
//复选值
function form_set_v($this){var $v=$this.parentNode.previousSibling.value;$this.parentNode.previousSibling.value=$this.checked?
($v==''?$this.value:$v+','+$this.value):(','+$v+',').replace(eval('/,'+$this.value+',/im'),',').slice(1,-1)}
//枚举类型单选
function form_enum($str,$obj,$v){$v=$v==null?'':$v+'';$str='<select onChange="this.previousSibling.value=this.value"><option value="">-请选择-</option>'+$str.replace(/([^,]+),?/img,'<option value="$1">$1</option>').replace(eval('/( value="'+$v+'")/img'),'$1 selected="selected"')+'</select>';
document.getElementsByName($obj)[0].insertAdjacentHTML('afterEnd',$str);return ($str);}
//联动表单
function my_select($name,$str_name,$v,$dhtml){var $s=eval($str_name),$type=parseInt($s.charAt(0),16),
$title='',$on=' onchange="my_onchange('+$str_name+',this)"',$len=$type>>1,$n=2;if($len==0){$len=2;$n=1}
$v=$v==null?'':($type%2==0?v10toX(16,$v):$v+'');
if($v!=''){$s.match(eval('/<('+$v+')`([^>]*)>/img'));$title=RegExp.$2;}
var $str='<span><input id="'+$name+'__0" type="text" size="16" style="display:none;" value="'+$title+'" />';
for ($i=1;$i<=$len;$i++){
	var $re1=$v.slice(0,($i-1-$len)*$n)+'[0-9a-f]{'+($i==1?'1,':'')+$n+'}'+'000000'.substr(0,($len-$i)*$n);$re1=eval('/<('+$re1+')`([^>]*)>/img');
	var $re2=($i-$len)?($v.slice(0,($i-$len)*$n)+'000000'.substr(0,($len-$i)*$n)):$v;$re2=eval('/( value="'+$re2+'")/img');
try {var $option=$s.match($re1).join('').replace($re1,'<option value="$1">$2</option>').replace($re2,'$1 selected="selected"')
}catch (err){var $option='';}
$str+='<select id="'+$name+'__'+$i+'"'+$on+'>'+($i==1?'<option value="">-请选择-</option>':'')+$option+'</select>';
}$str+='</span>';if(document.getElementsByName($name)[0])document.getElementsByName($name)[0].insertAdjacentHTML('afterEnd',$str);return($str);}
//表单联动函数
function my_onchange($str,$this){var $type=parseInt($str.charAt(0),16),$v=$this.value,$f_value=$this.parentNode.previousSibling,$title=$this.parentNode.firstChild;
if($f_value)$f_value.value=($v==''||$type%2)?$v:parseInt($v,16);if($title){$title.value=$v==''?'':$this.options[$this.selectedIndex].text;$title.title=$v;}
$this=$this.nextSibling;if($this!= null){//根据变量值产生下级表单
	$v.match(/([0]+)/img);var $len0=RegExp.$1.length,$re1,$len=$type>>1,$n=2;if($len==0){$len=2;$n=1;}
	if($v=='' || $v==null){$re1='';}else if($len0 && $n==1){$re1=$v.slice(0,-1)+"[0-9a-f]";}
	else if($len0>=2 && $n==2){$len0=$len0>>1<<1;$re1=$v.slice(0,-($len0))+"[0-9a-f]{2}"+'000000'.substr(0,$len0-2);}
	else{$re1='';}if($re1==''){return;$html='';}else{$re1=eval('/<('+$re1+')`([^>]*)>/img');
		try {$html=($str.match($re1).join("").replace($re1,'<option value="$1">$2</option>'));}catch (err){$html=('');}
		if(navigator.userAgent.indexOf('MSIE') == -1){if($this.nextSibling!= null)$this.nextSibling.innerHTML='';$this.innerHTML=$html;}
		else{if($this.nextSibling!= null)
		$this.nextSibling.outerHTML=$this.nextSibling.outerHTML.replace(/(<select[^>]*>)(.*)(<\/select>)/i,'$1$3');
		$this.outerHTML=$this.outerHTML.replace(/(<select[^>]*>)(.*)(<\/select>)/i,'$1'+$html+'$3');}
}}}
//10进制转n进制
function v10toX(n,m){m=String(m).replace(/ /gi,'');if(m=='' || parseInt(m)!=m){return '';}
var b,t='',ss='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@',a=ss.substr(0,n);
while(m!=0){b=m%n;t=a.charAt(b)+t;m=(m-b)/n;}return (t);}

