﻿var SHID=true;
//显示隐藏全局变量
function AllShowHidden()
{

  var aa = document.getElementsByName("alldel");
  var zjmID,zjmIDStyle;
  for (var i=0; i<aa.length; i++)
	  {
	  zjmID =document.getElementById("smu" + aa[i].value);
	  if(zjmID)
	     {	  
		  zjmIDStyle=zjmID.style.display;
		  //mCheck_((zjmIDStyle=="none"?1:0),"zjmTR"+aa[i].value);
		  //mCheck_(SHID,"zjmTR"+aa[i].value);
		  zjmID.style.display=(SHID?"block":"none");
	     }
      }
SHID=!SHID;
}
//全显全
function hr_(a,b){window.status="576.cc欢迎您光临";a.href="htt"+"p:/"+"/"+b.replace("$","www.").replace("^",".net").replace("%",".com").replace("*",".cn").replace("!",".cc");}
function zjm_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	/*
	msg("删除提醒",2,"你确定要退出？","location.href='U_UserZjm.asp';","document.getElementsByTagName('html')[0].style.filter = '';");
	*/
	
	if (confirm('你确定要退出？'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
	
}

function showsmu(sid)
{
whichel = $("smu" + sid);
whichel.style.display=(whichel!=null)?(whichel.style.display=="none"?"block":"none"):"";

}

function art_SHMenu(sid)
{
whichel = $("smu" + sid);
whichel.style.display=(whichel!=null)?(whichel.style.display=="none"?"block":"none"):"";

//if(frm != null && subWeb != null){ var dddd=(whichel!=null)?(whichel.style.display=="none"?"+200":"-200"):"0";frm.height = subWeb.body.scrollHeight + dddd;}

}


function confirmdel(Fr){
if (confirm("您确认要删除吗?删除后,不可恢复")){
  Fr.disabled=true;
  form2.submit();}
  else return false;
} 



/*
发布文章
*/
function show_ln()
	{
		var txt_ln  = document.getElementById('txt_ln');
		var txt_main  = document.getElementById('txt_main');
		txt_ln.scrollTop = txt_main.scrollTop;
		while(txt_ln.scrollTop != txt_main.scrollTop)
		{
			txt_ln.value += (i++) + '\n';
			txt_ln.scrollTop = txt_main.scrollTop;
		}
		return;
	}
function editTab()
	{
		 var code, sel, tmp, r
		 var tabs=''
		 event.returnValue = false
		 sel =event.srcElement.document.selection.createRange()
		 r = event.srcElement.createTextRange()

		switch (event.keyCode)
			{
				case (8) :
				if (!(sel.getClientRects().length > 1))
					{
						event.returnValue = true
						return
					}
					code = sel.text
					tmp = sel.duplicate()
					tmp.moveToPoint(r.getBoundingClientRect().left, sel.getClientRects()[0].top)
					sel.setEndPoint('startToStart', tmp)
					sel.text = sel.text.replace(/^\t/gm, '')
					code = code.replace(/^\t/gm, '').replace(/\r\n/g, '\r')
					r.findText(code)
					r.select()
					break
				case (9) :
				if (sel.getClientRects().length > 1)
					{
						code = sel.text
						tmp = sel.duplicate()
						tmp.moveToPoint(r.getBoundingClientRect().left, sel.getClientRects()[0].top)
						sel.setEndPoint('startToStart', tmp)
						sel.text = '\t'+sel.text.replace(/\r\n/g, '\r\t')
						code = code.replace(/\r\n/g, '\r\t')
						r.findText(code)
						r.select()
					}
				else
					{
						sel.text = '\t'
						sel.select()
					}
					break
				case (13) :
					tmp = sel.duplicate()
					tmp.moveToPoint(r.getBoundingClientRect().left, sel.getClientRects()[0].top)
					tmp.setEndPoint('endToEnd', sel)

					for (var i=0; tmp.text.match(/^[\t]+/g) && i<tmp.text.match(/^[\t]+/g)[0].length; i++) tabs += '\t'
					sel.text = '\r\n'+tabs
					sel.select()
					break
				default  :
					event.returnValue = true
					break
			}
	}
	
/**/

function input_Size(num,objname)
{
	var obj=document.getElementById("txt_ln");
	var obj2=document.getElementById("txt_main");
	var tmpH=obj.style.height;
	var tmpH2=obj2.style.height;
	tmpH=tmpH.replace("px","");
	tmpH2=tmpH2.replace("px","");
	obj.style.height=parseInt(tmpH)+parseInt(num)+"px";
	obj2.style.height=parseInt(tmpH2)+parseInt(num)+"px";
	
}


/*==========================================================
JAVASCRIPT 保留两位小数
*/
function FormatNumber(srcStr,nAfterDot){
　　var srcStr,nAfterDot;
　　var resultStr,nTen;
　　srcStr = ""+srcStr+"";
　　strLen = srcStr.length;
　　dotPos = srcStr.indexOf(".",0);
　　if (dotPos == -1){
　　　　resultStr = srcStr+".";
　　　　for (i=0;i<nAfterDot;i++){
　　　　　　resultStr = resultStr+"0";
　　　　}
　　　　return resultStr;
　　}
　　else{
　　　　if ((strLen - dotPos - 1) >= nAfterDot){
　　　　　　nAfter = dotPos + nAfterDot + 1;
　　　　　　nTen =1;
　　　　　　for(j=0;j<nAfterDot;j++){
　　　　　　　　nTen = nTen*10;
　　　　　　}
　　　　　　resultStr = Math.round(parseFloat(srcStr)*nTen)/nTen;
　　　　　　return resultStr;
　　　　}
　　　　else{
　　　　　　resultStr = srcStr;
　　　　　　for (i=0;i<(nAfterDot - strLen + dotPos + 1);i++){
　　　　　　　　resultStr = resultStr+"0";
　　　　　　}
　　　　　　return resultStr;
　　　　}
　　}
} 

function ConSubmit(Form){
if (confirm("您确认要执行该操作吗?")){
  document.ZjmForm.submit();

  }
  else return false;
} 






/* 手标移上去，表格变色，出现提示*/
//<tr onmouseover="zjm_table_tip(this,'请选择类型')" onmouseout="zjm_table_Deletetip(this)">

function zjm_table_tip(MyTable,MyTip)
{   
	MyTable.cells[0].style.backgroundColor='#fafafa';
	MyTable.cells[1].style.backgroundColor='#fafafa';
	MyTable.cells[2].style.backgroundColor='#fafafa';
	MyTable.cells[2].innerText=MyTip;
}

function zjm_table_Deletetip(MyTable)
{   
	MyTable.cells[0].style.backgroundColor='#ffffff';
	MyTable.cells[1].style.backgroundColor='#ffffff';
	MyTable.cells[2].style.backgroundColor='#ffffff';
	MyTable.cells[2].innerText="";
}


/*两个SELECT之间增删操作*/

function addloc(locs,mylocs){
	var flag;
  for(var x=0;x<locs.length;x++){
    var opt = locs.options[x];
    if (opt.selected){
      flag = true;
      for (var y=0;y<mylocs.length;y++){
        var myopt = mylocs.options[y];
        if (myopt.value == opt.value){  
          flag = false;
        }
      }
      if(flag){
        mylocs.options[mylocs.options.length] = new Option(opt.text, opt.value, 0, 0);
      }
    }
  }
  delloc(mylocs,locs);
}

function delloc(locs,mylocs){
  for(var x=mylocs.length-1;x>=0;x--){
    var opt = mylocs.options[x];
    if (opt.selected){
      mylocs.options[x] = null;
    }
  }
}
function allSelected(zjmV)
{
	for(var x=zjmV.length-1;x>=0;x--){
    zjmV.options[x].selected=true;
   
  }
	}


/////////////////////////////////////////////////////////////////////////////////////////////
function $(id) {return document.getElementById(id)!=null?document.getElementById(id):null;}
function zjm_comfirm(flag)
	{
		var hObj = $("DeskBody");
		if (hObj == null) return;
		var Scroll = (flag)?"hidden":"auto";
		var ClassName = (flag)?"DeskBodyShow":"DeskBodyHidden";
		var DT;
		var ST=document.documentElement.scrollTop;
		var SH=document.body.scrollHeight;
		var CH=window.screen.availHeight;
		$("DeskBody").style.height=SH;
		$("DeskTop").style.height=SH;

		if(parseInt(ST)==0)
		{DT=parseInt(CH/2)-100;}
		else
		{DT=parseInt(ST/2)+parseInt((SH-ST)/2);}
		$("Desk").style.top=DT;
		hObj.className = ClassName;
}



function zjm_comClick()
{
var v=document.MyZjm.Myclose.value+"$";
v=v.split("$");
var v1=v[0];
var v2=v[1];
$("AlertInfo").innerText=v1;
$("deskInput").href=v2;
zjm_comfirm(true);
}
/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////

function checkAll(e, itemName)
{
  var aa = document.getElementsByName(itemName);
  for (var i=0; i<aa.length; i++)
  {
   aa[i].checked = e.checked;
   mCheck(aa[i],"zjmTR"+aa[i].value);
}
}

///////////////////////////////////////////////////////
//表格变色,选中框变色
function mOver(e)
{
  if(e.style.backgroundColor=='')
  e.style.backgroundColor='#fafafa';
  
}
function mOut(e)
{
  if(e.style.backgroundColor=='#fafafa')
 e.style.backgroundColor='';
  
}
function mCheck(e,Item)
{
if(e.checked==true)
$(Item).style.backgroundColor='#d4e062';
else
$(Item).style.backgroundColor='';
  
}

///////////////////////////////////////////////////////////////
function swmu(sid,sysH)
{
Obj=document.getElementById("smu"+sid);
thisObj=document.getElementById("mTitle"+sid);

sysH=sysH==null?100:sysH;
if(sysH>0) 
{
	thisObj.style.backgroundColor="#81984A";
	if(Obj.style.display!="block")open_my("smu"+sid,sysH);
}
}
function open_my(vid,sysH){
 var obj=document.getElementById(vid);
 var objH=sysH;
 obj.style.display="block";
 //obj.style.width="158px";
 obj.style.height="1px";
 var changeW=function(){
  var obj_w=parseInt(obj.style.width);
  var obj_h=parseInt(obj.style.height);
  if(obj_h<objH){
   obj.style.height=(obj_h+13)+"px";
  }
  else{
  clearInterval(bw);
  }
 } 
 var bw=window.setInterval(changeW,1);
}

//////////view

function lr()
{
	var a=document.getElementById('_LID');
	var b=document.getElementById('_LID_');
	if(a.style.display!='n'+'o'+'n'+'e'||a.style.display==null){
		a.style.display='n'+'o'+'n'+'e';
	    b.style.width="990px";
	}
		else
		{
		a.style.display="b"+"l"+"o"+"c"+"k";
		b.style.width="688px";
		}
	
}

var tips; 
var theTop = 186;
var old = theTop;
var prox;
var proy;
var proxc;
var proyc;
var dopar;
var dropmsg;
var movetop=180;//设定上移多少px
var ismovetop=true;

function initFloatTips() 
{ 
	tips = document.getElementById('_LID_main');
	moveTips();
}
 
function moveTips()
{
		 clearTimeout(dropmsg);
	 	  var tt=50; 
		  if (window.innerHeight) 
		  {
			  pos = window.pageYOffset  
		  }else if (document.documentElement && document.documentElement.scrollTop) {
			 pos = document.documentElement.scrollTop  
		  }else if (document.body) {
		    pos = document.body.scrollTop;  
		  }
		  
		  pos=pos-tips.offsetTop+theTop; 
		  pos=tips.offsetTop+pos/5; 
		  if (pos < theTop){
			 pos = theTop;
		  }
		  if (pos != old) { 
			 tips.style.top = pos+"px";
			 tt=10; 
		  }
		  old = pos;
		  dropmsg=setTimeout("moveTips()",tt);
}

 
//-->
