var IE = (document.all) ? 1 : 0;
var NS = (document.layers) ? 1 : 0;

// WINDOW STATUS FUNCTIONS
window.defaultStatus = "";

var bV=parseInt(navigator.appVersion);
var NN4=(document.layers) ? true : false;
var IE4=((document.all)&&(bV>=4))?true:false;
var moveFlag=false;

var fntSize=9;
var tipBgColor="FFFFCC";
var tipBorderColor="000000";
var tipTextColor="000000";

function turnit2(ss){
if (ss.style.display=="none"){
		ss.style.display="";
	  
	}else{
		ss.style.display="none"; 
	  
	}	
} 

var oBLastTR, sBLastTRBGColor;
function doVoucherClick(aItemID){
	oForm=document.mainform;
	//oForm.BEdit.disabled=oForm.BRemove.disabled=false;
	if (oBLastTR!=null)
	{
		oBLastTR.style.background=sBLastTRBGColor;             //恢复上次选定的背景颜色
		oBLastTR.style.color="windowtext";                    //设置上次选定的文字颜色为windowtext颜色
	}
	eval("sBLastTRBGColor=TRID"+aItemID+".style.background"); //存储上次选定的背景颜色
	eval("TRID"+aItemID+".style.background='highlight'");    //高亮显示当前选定的行
	eval("TRID"+aItemID+".style.color='window'");            //反白当前行的文字颜色
    eval("oBLastTR=TRID"+aItemID);
	s = bytes2bstr(ExecASPByGet("TakenAccountDetail.asp?DetailType=B&AccountID="+aItemID));
	document.all.accountdetail.innerHTML = s;
}

var LastID
function turnit(ss){
	if (LastID!=null){
		LastID.style.display="none";
	}

	if (ss.style.display=="none"){
		ss.style.display="";
	  
	}else{
		ss.style.display="none"; 
	  
	}	
	LastID=ss;
}

function turnoff(){
	LastID.style.display="none";
}

/*bak
function turnit(ss,ii,climg,opimg){
	if (ss.style.display=="none"){
		ss.style.display="";
	  ii.src=opimg;
	}else{
		ss.style.display="none"; 
	  ii.src=climg;
	}
} 
*/

function setReload(){
  window.location.reload()
}

function showTip(msg){
  var obj = 'TipBox';

  moveFlag=true;
  if(NN4){
	with (document[obj].document){
	  open();
	  write('<layer ID=TipBox bgColor=#'+tipBgColor+' style="border:1px solid #'+tipBorderColor+'; font-size:'+fntSize+'pt;"><font color=#'+tipTextColor+' lang="gb2312" face="宋体">'+msg+'</font></layer>');
	  close();
	}
    document.layers[obj].visibility = 'visible';
  }else if(IE4){
	IE_MouseMove();
    document.all[obj].innerHTML = msg;
    document.all[obj].style.visibility = 'visible';
  }
}

function hideTip(){
  var obj = 'TipBox';

  moveFlag=false;
  if(NN4){
    if(document.layers[obj] != null) document.layers[obj].visibility = 'hidden';
  }else if(IE4)
    document.all[obj].style.visibility = 'hidden';
}

function IE_MouseMove(){
  if(moveFlag){
	var x = event.x;
	var y = event.y;

	var objp = document.all.TipBox.style;
	var xx = (document.body.scrollLeft+x);
	var yy = (document.body.scrollTop+y);

	objp.pixelLeft = xx;
	objp.pixelTop = yy+10;
  }
} 

function NN_MouseMove(e){
  if(moveFlag){
	var objp = document.layers.TipBox;
	objp.moveTo(e.x+20, e.y);
  }
}

if(IE4){
  document.write("<DIV ID=TipBox STYLE='position:absolute; visibility: hidden; padding: 0.2em 0.2em 0.2em 0.2em; color: #"+tipTextColor+"; background-color: #"+tipBgColor+"; border:1px solid #"+tipBorderColor+"; font-size: "+fntSize+"pt'></DIV>");
  document.onmousemove = IE_MouseMove;
}else{
  document.write("<DIV ID=TipBox STYLE='position:absolute; visibility: hidden; background-color: #"+tipBgColor+"; border:1px solid #"+tipBorderColor+"; font-size: "+fntSize+"pt'></DIV>");
  document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove = NN_MouseMove;
  setTimeout("window.onresize=setReload",500)
}

function ShowHit( aText ){
	document.write( "<table width='100%' border=0><tr><td width='30'><img src='images/light.JPG' style='filter:alpha(opacity=20)'></td><td><font color='#40436b' style='font-size:9pt'><b>你知道吗?</b> " + aText + "</font></td></tr></table>" );
}

function ShowDialog( loc ){
	//window.showModalDialog( loc,'','scrollbars=yes;resizable=no;help=yes;status=no;dialogTop='+((screen.height-600)/2)+';dialogLeft='+((screen.width-400)/2)+';dialogWidth=402px;dialogHeight=415px;center=yes')
	window.showModalDialog( loc,'','center=yes;help=no;resizable=yes;status=no;dialogHeight:300px;dialogWidth:650px')


}

function openwin( aurl ){
	var attribution;
	attribution = "toolbar = no, " +
	"menubar = no, " +
	"scrollbars = no, " +
	"status = no, " +
	"location = no, " +
	"resizable = no, " +
	"directories = no, " +
	"width = 402, " +
	"height = 415 " +
	"top = " + (screen.height-600)/2 + "," +
	"left = " +(screen.width-400)/2 + "," +
	"maxinizebox = 0";
	window.open( aurl,"attent",attribution );
}

function popUp( loc, w, h, menubar ) {
	if( w == null ) { w = 402; }
	if( h == null ) { h = 415; }
	if( menubar == null || menubar == false ) {
		menubar = "";
	} else {
		menubar = "menubar,";
	}

	if( NS ) { w += 50; }
	// Need the var or else IE4 blows up not recognizing editorWin
	var editorWin = window.showModalDialog(loc,'editWin', menubar + 'resizable,scrollbars,width=' + w + ',height=' + h);
	//if( !newWin.opener )
		//newWin.opener = window;
	editorWin.focus(); //causing intermittent errors
}

//调用页面
function js_callpage( URL, width, height ) {
 var newwin = window.open( URL, "homeWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height );
return false;
}

//document.oncontextmenu=new Function("event.returnValue=false;");
//document.onselectstart=new Function("event.returnValue=false;");
