//document.onclick = parent.parent.document.menuFile.style='none';
n1=0;n2=0;n3=0;n4=0;
function nd(){n1=0;n2=0;n3=0;n4=0}
function star(){if((n1+n2+n3+n4)==4){MM_timelineGoto('Timeline1','2');MM_timelinePlay('Timeline1');nd()}}
function startcenter_togglePortlet(ctrlInst,doc,portletId)
	{		
			var tableDiv = doc.getElementById("portlet"+portletId);
			var minImg	= doc.getElementById("portletimage_min_"+portletId);
			var maxImg  = doc.getElementById("portletimage_max_"+portletId);
			
			if (tableDiv.style.display != 'none')
			{													
				minImg.style.display = 'none';
				maxImg.style.display = 'inline';								

				sendEvent("toggleportlet","scportlets",0,"state",null,null,portletId);								
			}
			else
			{							
				minImg.style.display = 'inline';
				maxImg.style.display = 'none';									
			
				sendEvent("toggleportlet","scportlets",1,"state",null,null,portletId);									
			}			
	}


function LTrim(str){
	var IntStrLength
	IntStrLength=str.length-1
	var j=0
	for (var i=0;i<=IntStrLength;i++)
		if (str.charAt(i)==" "){
			j=j+1
		}else{
		  break;
		}
	str=str.substr(j)
	return str
}
function RTrim(str){
	var IntStrLength
	IntStrLength=str.length-1
	var j=0
	for (var i=IntStrLength;i>=0;i--)
		if (str.charAt(i)==" "){
			j=j+1
		}else{
		break;
		}		
	IntStrLength=IntStrLength-j+1
	str=str.substr(0,IntStrLength)
	return str
}

//隐藏所有下拉菜单
function HideLayers(){
var menu; 
for (var i=0;i<=10;i++){ 
	menu="p"+i; 
	whE=document.all(menu);
	if(whE){
	document.all(menu).style.visibility="hidden";}
} 
}

function ShowLayers(strF){
  var menu,x,y;
  menu="p"+strF;
  HideLayers();
 
  x=findPosX(document.getElementById("tablemenu"+strF));
  y=findPosY(document.getElementById("tablemenu"+strF));
 
  if (strF!=-1)
  {
  	document.getElementById(menu).style.left=x+3;
  	document.getElementById(menu).style.top=y+45;
  	document.getElementById(menu).style.visibility="visible";
  }
}


function expandCont(bn)
{
	var leftTab = document.getElementById(bn);
       	leftTab.style.display = (leftTab.style.display == "block")?"none":"block";
       	img = document.getElementById("img_"+bn);
      	img.src=(img.src.indexOf("images/toggle1.gif")!=-1)?"../images/toggle2.gif":"../images/toggle1.gif";
      //	set_cookie_gen(bn,leftTab.style.display)

}
function expandCont1(bn)
{
	var leftTab = document.getElementById(bn);
       	leftTab.style.display = (leftTab.style.display == "block")?"none":"block";
    //   	img = document.getElementById("img_"+bn);
    //  	img.src=(img.src.indexOf("images/toggle1.gif")!=-1)?"../images/toggle2.gif":"../images/toggle1.gif";
      //	set_cookie_gen(bn,leftTab.style.display)

}
function BHClick()
{var showx = 300;
	var showy = 200;
	var WINheight = 250;
	var newWINwidth = 340;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/YJ.aspx', 'winpop' , features );
	if( retval != null )
	{if (retval!=""){
	var a=retval.split("^");
	//	ctl.value = a[0];
	//	ctl1.value = a[1];
	document.all("bhyj").value=a[1];
	document.all.btnBH.click(); 
	}}
}

function NextClick(ctl,ctl1,ctl2)
{var showx = 300;
	var showy = 200;
	var WINheight = 350;
	var newWINwidth = 400;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/lc.aspx', 'winpop' , features );
		if(( retval != null )&&(retval!=-1))
	{if (retval!=""){
	b=retval.split("^");
	ctl2.value = b[0];
	c=b[1];
	a=c.split("#");
		ctl.value = a[1];
		ctl1.value = a[0];
		document.Form1.submit(); 
	}}
}

function opendj(url){
	window.open (url, "", "fullscreen=no,titlebar=no,top=50, left=100, height=600, width=800, toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes");
}

function SelectDate(ctl, m){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 293;
	var newWINwidth = 315;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/calendar.aspx?m='+m, 'winpop' , features );

	if( retval != null )
	{
		ctl.value = retval;
	}
} 

function SelectBM(ctl,ctl1){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 293;
	var newWINwidth = 315;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/bmselect.aspx', 'winpop' , features );

	if( retval != null )
	{var a=retval.split("|&&|");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function SelectSbfl(ctl,ctl1){
	
	var showx = 220;
	var showy = 100;
	var WINheight = 600;
	var newWINwidth = 500;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/sbflselect.aspx?sbfl='+ctl1.value, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function Selectwzfl(ctl,ctl1){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 293;
	var newWINwidth = 315;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/wzflselect.aspx?fl='+ctl1.value, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function SelectXM(ctl){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 340;
	var newWINwidth = 288;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/xmselect.aspx', 'winpop' , features );

	if( retval != null )
	{
		ctl.value = retval;
	}
}
function SelectGYDW(ctl,dwlx){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 340;
	var newWINwidth = 288;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/gydwselect.aspx?dwlx='+dwlx, 'winpop' , features );

	if( retval != null )
	{
		ctl.value = retval;
	}
}
function SelectQM(ctl,ctl1,qm){
	
	var showx = 300;
	var showy = 200;
	var WINheight = 250;
	var newWINwidth = 400;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/QM.aspx', 'winpop' , features );
	if( retval != null )
	{if (retval!=""){
	a=retval.split("||");
		ctl.value = a[0];
		ctl1.value = a[1];
		document.all("qmfield").value=qm;
			document.all("qmyj").value=a[2];
		document.Form1.submit();
	}}
}

function SelectsubtableQM(ctl,ctl1,qm){
	
	var showx = 300;
	var showy = 200;
	var WINheight = 200;
	var newWINwidth = 320;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/QM.aspx', 'winpop' , features );
	if( retval != null )
	{if (retval!=""){
	a=retval.split("||");
		ctl.value = a[0];
		ctl1.value = a[1];
		document.all("qmfield").value=qm;
		document.all("issubtalbeQM").value="yes";
		document.Form1.submit();
	}}
}
function SelectUser(ctl,ctl1){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 400;
	var newWINwidth = 250;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/UserSelect.aspx?tp=app&id=SCYX', 'winpop' , features );
	if( retval != null )
	{if (retval!=-1){
	a=retval.split("#");
		ctl.value = a[1];
		ctl1.value = a[0];
	}}
}

function BMSelectUser(ctl,ctl1){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 400;
	var newWINwidth = 250;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/bmUserSelect.aspx', 'winpop' , features );
	if( retval != null )
	{if (retval!=-1){
	a=retval.split("#");
		ctl.value = a[1];
		ctl1.value = a[0];
	}}
}

function SelectUsers(ctl,ctl1){
	
	var showx = 273;
	var showy = 100;
	var WINheight = 318;
	var newWINwidth = 388;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/UsersSelect.aspx?tp=app&id=SCYX', 'winpop' , features );
	if( retval != null )
	{if (retval!=""){
	a=retval.split("#");
		ctl.value = a[1];
		ctl1.value = a[0];
	}}
}

function Selectdwfl(ctl,ctl1){
	
	var showx = 220;
	var showy = 100;
	var WINheight = 300;
	var newWINwidth = 400;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/dwflselect.aspx?fl='+ctl1.value, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function SelectDW(ctl,ctl1){
	
	var showx = 220;
	var showy = 100;
	var WINheight = 500;
	var newWINwidth = 400;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/dwselect.aspx?fl='+ctl.value, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function SelectHT(ctl,ctl1){
	
	var showx = 173;
	var showy = 100;
	var WINheight = 540;
	var newWINwidth = 810;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/HTselect.aspx', 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function Selectfykm(ctl,ctl1,fykmid){ //费用科目
	
	var showx = 220;
	var showy = 100;
	var WINheight = 300;
	var newWINwidth = 400;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/fykmselect.aspx?fl=0&fykmid='+fykmid, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}
function SelectTask(ctl,ctl1){ //费用科目
	
	var showx = 220;
	var showy = 200;
	var WINheight = 500;
	var newWINwidth = 610;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/tasklistselect.aspx?je='+document.all("je") .value, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function Selectweblx(ctl){ 
	
	var showx = 220;
	var showy = 200;
	var WINheight = 500;
	var newWINwidth = 610;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/weblxselect.aspx?classid='+document.all("classid").value, 'winpop' , features );

	if( retval != null )
	{if (retval!=-1){
	a=retval.split("#");
		ctl.value = a[1];
	}}
}

function Selectyycx(ctl,ctl1,fykmid){ //费用科目
	
	var showx = 220;
	var showy = 100;
	var WINheight = 300;
	var newWINwidth = 400;

	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	
	retval = window.showModalDialog('../Choose/appselect.aspx?fl=0&appid='+fykmid, 'winpop' , features );

	if( retval != null )
	{var a=retval.split(",");
		ctl.value = a[0];
		ctl1.value = a[1];
	}
}

function MsgWin(title, msg, w, h){ 
	window.open(msg,'','');} 
	
function alertWin1(title, msg, w, h){ 
document.location=msg;
}	

function alertWin(title, msg, w, h){ 
	var titleheight = "22px";//提示窗口标题高度 
	var bordercolor = "#666699";//提示窗口的边框颜色 
	var titlecolor = "#FFFFFF";//提示窗口的标题颜色 
	var titlebgcolor = "#b1b9cf";//提示窗口的标题背景色
	var bgcolor = "#FFFFFF";//提示内容的背景色
	var iWidth =window.screen.width;//document.body.clientWidth;// document.documentElement.clientWidth; 
	var iHeight =window.screen.height;//document.body.clientHeight;// document.documentElement.clientHeight; 
	var bgObj = document.createElement("div"); 
	bgObj.id="divbg";
	bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.clientHeight, iHeight)+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:101;";
	document.body.appendChild(bgObj); 
	document.body.scroll="no";
	var msgObj=document.createElement("div");
	msgObj.style.cssText = "BORDER-RIGHT: #000000 0px solid;BORDER-TOP: #000000 0px solid;DISPLAY: block;LEFT: 0px;MARGIN-LEFT: 12px;BORDER-LEFT: #000000 0px solid;BORDER-BOTTOM: #000000 0px solid;POSITION: absolute;font:11px '宋体';top:"+(iHeight-h)/8+"px;left:"+(iWidth-w)/2+"px;width:"+w+"px;height:"+h+"px;text-align:center;z-index:102;";
	msgObj.id="divmsg";
	document.body.appendChild(msgObj);
	var table = document.createElement("table");
	msgObj.appendChild(table);
	table.style.cssText = "margin:0px;border:0px;padding:0px;width:100%;";
	table.cellSpacing = 0;
	var tr = table.insertRow(-1);
	var titleBar = tr.insertCell(-1);
	titleBar.style.cssText = "width:100%;text-align:left;padding:0px;margin:0px;font:bold 13px '宋体';color:"+titlecolor+";cursor:move;";
	titleBar.style.paddingLeft = "0px";
	titleBar.innerHTML ="<TABLE cellSpacing='0' cellPadding='0' width='100%'><TR><TD class='moveableHead' style='BACKGROUND-IMAGE: url(../images/portlet/drag_header_left.gif)' width='6' height='22' ></TD><TD class='moveableHead' style='BACKGROUND-IMAGE: url(../images/portlet/drag_header_middle.gif)' vAlign='middle' align='left' ><TABLE class='moveableHead' cellSpacing='0' cellPadding='0' width='100%'><TBODY><TR><TD class='moveableHead' vAlign='middle' noWrap align='left'><IMG class='moveableHead' style='MARGIN-RIGHT: 3px; POSITION: relative; TOP: 2px' src='../images/portlet/img_lookup.gif' /> <SPAN class='moveableHead' style='POSITION: relative; TOP: -2px'>选择值</SPAN> </TD><TD class='moveableHead' style='PADDING-TOP: 3px' vAlign='middle' noWrap align='right'><IMG id='lookup_valuelist_first' height='1' src='../images/portlet/blank.gif' width='1' mxpart='first' />  <IMG style='CURSOR: hand; align: right' onclick='document.body.removeChild(document.getElementById(\"divbg\")); document.body.removeChild(document.getElementById(\"divmsg\"));body.scroll=\"\";' src='../images/portlet/dialogclose.gif' mxpart='dialogClose' /> </TD></TR></TBODY></TABLE></TD><TD class='moveableHead' style='BACKGROUND-IMAGE: url(../images/portlet/drag_header_right.gif)' width='6' height='22' mxpart='dragright'></TD></TR></TBODY></TABLE>";
		var closeBtn = tr.insertCell(-1);
	closeBtn.style.cssText = "BACKGROUND-POSITION: left bottom; BACKGROUND-IMAGE: url(../images/portlet/dialog_shadow_head.gif); WIDTH: 3px; CURSOR: hand; BACKGROUND-REPEAT: no-repeat";
	closeBtn.innerHTML = "&nbsp;";
	
	var moveX = 0;
	var moveY = 0;
	var moveTop = 0;
	var moveLeft = 0;
	var moveable = false;
	var docMouseMoveEvent = document.onmousemove;
	var docMouseUpEvent = document.onmouseup;
	titleBar.onmousedown = function() {
		var evt = getEvent();
		moveable = true; 
		moveX = evt.clientX;
		moveY = evt.clientY;
		moveTop = parseInt(msgObj.style.top);
		moveLeft = parseInt(msgObj.style.left);
		document.onmousemove = function() {
			if (moveable) {
				var evt = getEvent();
				var x = moveLeft + evt.clientX - moveX;
				var y = moveTop + evt.clientY - moveY;
				if ( x > 0 &&( x + w < iWidth) && y > 0 && (y + h < iHeight) ) {
					msgObj.style.left = x + "px";
					msgObj.style.top = y + "px";
				}
			}	
		};
		document.onmouseup = function () { 
			if (moveable) { 
				document.onmousemove = docMouseMoveEvent;
				document.onmouseup = docMouseUpEvent;
				moveable = false; 
				moveX = 0;
				moveY = 0;
				moveTop = 0;
				moveLeft = 0;
			} 
		};
	}
var msgBox = table.insertRow(-1);
 titleBar = msgBox.insertCell(-1);
titleBar.style.cssText = "BORDER-LEFT: #404040 1px solid;BORDER-RIGHT: #404040 1px solid;BACKGROUND-IMAGE: url(../images/portlet/dialog_bg_tile.gif); BACKGROUND-COLOR: #ffffff;";
titleBar.innerHTML = "&nbsp;"
closeBtn = msgBox.insertCell(-1);
	closeBtn.style.cssText = "WIDTH: 4px; CURSOR: hand; BORDER-LEFT: #404040 4px solid;";
	closeBtn.innerHTML = "&nbsp;";
	titleBar = table.insertRow(-1);
     msgBox = titleBar.insertCell(-1);
	msgBox.style.cssText = "BORDER-LEFT: #404040 1px solid;BORDER-RIGHT: #404040 1px solid;BACKGROUND-COLOR: #ffffff;font:10pt '宋体';";
	msgBox.innerHTML = "<iframe src='"+msg+"' frameBorder='0' noResize width='99%' height='460px' scrolling='auto'  style='padding-bottom:0px'></iframe>";
	closeBtn = titleBar.insertCell(-1);
	closeBtn.style.cssText = "WIDTH: 4px; CURSOR: hand; BORDER-LEFT: #404040 4px solid;";
	closeBtn.innerHTML = "&nbsp;";
	titleBar = table.insertRow(-1);
	var closeB = titleBar.insertCell(-1);
		closeB.style.cssText = "height:25px;text-align:center;BORDER-LEFT: #404040 1px solid;BORDER-RIGHT: #404040 1px solid;BACKGROUND-IMAGE: url(../images/portlet/dialog_bg_tile.gif); BACKGROUND-COLOR: #ffffff;font:10pt '宋体';";
	closeB.innerHTML = "<input id='btnClose' class=bt type=button value='关 闭'>";
	closeB.onclick = function(){ 
		document.body.removeChild(bgObj); 
		document.body.removeChild(msgObj); 
		document.body.scroll="";
	} 
	closeBtn = titleBar.insertCell(-1);
	closeBtn.style.cssText = "WIDTH: 4px; CURSOR: hand; BORDER-LEFT: #404040 4px solid;";
	closeBtn.innerHTML = "&nbsp;";
	 titleBar = table.insertRow(-1);
	 closeBtn = titleBar.insertCell(-1);
	 	closeBtn.innerHTML = "<TABLE style='TABLE-LAYOUT: fixed' cellSpacing='0' cellPadding='0' width='100%'><TBODY><TR height='4'><TD style='WIDTH: 5px; CURSOR: hand'><IMG src='../images/portlet/dialog_shadow_foot.gif' align='top' /> <TD style='CURSOR: hand; BACKGROUND-COLOR: #404040';BORDER-TOP: #404040 1px solid;><TD align=right style='WIDTH: 6px; CURSOR: hand; BORDER-TOP: #404040 1px solid; BORDER-LEFT: #404040 2px solid;'></table>";
	closeBtn.colSpan  = 2;
    //获得事件Event对象，用于兼容IE和FireFox
    function getEvent() {
	    return window.event || arguments.callee.caller.arguments[0];
    }
} 


function SelectTree(rowno,strMain,strSub,prj){ //费用科目
	
	var showx = 800;
	var showy = 500;

	
 alertWin('选择','../choose/getwzmain.aspx?project_id='+prj+'&rowno='+rowno+'&tablename='+strMain+'&childtablename='+strSub, showx,showy);

}

function SelectTreeMain(strMain,prj){ //费用科目
	
	var showx = 800;
	var showy = 500;

	
 alertWin('选择','../choose/getmain.aspx?project_id='+prj+'&tablename='+strMain, showx,showy);

}
function SelectLbxz(strMain,project_id,rowno){ //列表窗口
	
	var showx = 800;
	var showy = 500;
	if(strMain=="v_cgjsgys"){
		 if (document.all("ifinishdate").value=="")
		 {
			 alert('必须填写结算结束日期后，才可选择供应商！');
			 return;
		 }
		 alertWin('选择','../inetpoweron/PopupCtrls/contact/JsDwList.aspx?tp=mat&project_id='+project_id+'&d='+document.all("ifinishdate").value, showx,showy);
		 return;
	}
	if(strMain=="v_lwhtjsgys"){
		 if (document.all("ifinishdate").value=="")
		 {
			 alert('必须填写结算结束日期后，才可选择承包商 ！');
			 return;
		 }
		 alertWin('选择','../inetpoweron/PopupCtrls/contact/JsDwList.aspx?tp=Lw&project_id='+project_id+'&d='+document.all("ifinishdate").value, showx,showy);
		 return;
	}
	if(strMain=="v_czdw_select"){
		 if (document.all("ifinishdate").value=="")
		 {
			 alert('必须填写结算结束日期后，才可选择出租单位！');
			 return;
		 }
		 alertWin('选择','../inetpoweron/PopupCtrls/contact/JsDwList.aspx?tp=Jx&project_id='+project_id+'&d='+document.all("ifinishdate").value, showx,showy);
		 return;
	}
	if(strMain=="v_zyfbhtjsgys"){
		 if (document.all("ifinishdate").value=="")
		 {
			 alert('必须填写结算结束日期后，才可选择承包商 ！');
			 return;
		 }
		 alertWin('选择','../inetpoweron/PopupCtrls/contact/JsDwList.aspx?tp=Fb&project_id='+project_id+'&d='+document.all("ifinishdate").value, showx,showy);
		 return;
	}
	
	
 //alertWin('选择','../choose/getlistvalue.aspx?project_id='+project_id+'&tablename='+strMain+'&id='+id+'&rowno='+rowno, showx,showy);
 alertWin('选择','../choose/getlistvalue.aspx?project_id='+project_id+'&tablename='+strMain+'&rowno='+rowno, showx,showy);

}

function SelectTreeValue(strMain,project_id,rowno,id){ //树形列表窗口
	
	var showx = 800;
	var showy = 500;

	
 alertWin('选择','../choose/gettreevalue.aspx?project_id='+project_id+'&tablename='+strMain+'&id='+id+'&rowno='+rowno, showx,showy);

}

function selectall(){
if (document.all("dtgContent")==null) {return -1;}
  var a=document.all("dtgContent").rows.length-1;
  myd=document.all("cbxsc");
  var chkall = document.getElementById("chkall");
  if (chkall.checked){
  if (a==1) {myd.checked=true;return -1;}
  if (typeof(myd.length)=='undefined'){return -1;}
  for(var i=0;i<a;i++){
    if(myd[i]!=null) myd[i].checked=true;
  } }
  else {
    if (a==1) {myd.checked=false;return -1;}
  if (typeof(myd.length)=='undefined'){return -1;}
  for(var i=0;i<a;i++){
    if(myd[i]!=null) myd[i].checked=false;
  } }
}

function selall(tablename,fieldname){
if (document.all(tablename)==null) {return -1;}
  var a=document.all(tablename).rows.length-1;
  
  var chkall = document.getElementById(tablename+fieldname);
  if (chkall.checked){
  for(var i=0;i<a;i++){
    if(document.getElementById(tablename+fieldname+i)!=null) document.getElementById(tablename+fieldname+i).checked=true;
  } }
  else {
  for(var i=0;i<a;i++){
    if(document.getElementById(tablename+fieldname+i)!=null) document.getElementById(tablename+fieldname+i).checked=false;
  } }  
}

function selectitem(rowno){
if (document.all("dtgContent")==null) {return -1;}
  var a=document.all("dtgContent").rows.length-1;
  myd=document.all("cbxsc");
  var chkall = document.getElementById("chkall");
     if (a==1) {myd.checked=true;return -1;}
  if (typeof(myd.length)=='undefined'){return -1;}
  for(var i=0;i<a;i++){
    if(myd[i]!=null) myd[i].checked=false;
    if (i==rowno) myd[i].checked=true;
  } 
}

function SelectOperatePerson(ctl,ctl1){
	
	var showx = 300;
	var showy = 200;
	var WINheight = 390;
	var newWINwidth = 550;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../Choose/flowoperateperson.aspx?tablename='+ctl+'&lcid='+ctl1, 'winpop' , features );
	if(( retval != null )&&( retval != -1 ))
	{a=retval.split("||");  document.getElementById("clrid").value=a[0];document.getElementById("txtclyj").value=a[1];
	return true; }
	else
	{ return false;}
}


function findPosX(o) {
  var x,y;
     x=o.offsetLeft;
     y=o.offsetTop;
     while(o=o.offsetParent)
     {
       x+=o.offsetLeft;
       y+=o.offsetTop;
     }
return x;



//var curleft = 0;

//if (obj.offsetParent) { //返回父类元素，大多说offsetParent返回body
  // while (obj.offsetParent) {//遍历所有父类元素
  //  curleft += obj.offsetLeft;//当前元素的左边距
 //   obj = obj.offsetParent;        
//   }
//} else if (obj.x) curleft += obj.x;
//return curleft;
}

function findPosY(o) {
 var x,y;
     x=o.offsetLeft;
     y=o.offsetTop;
     while(o=o.offsetParent)
     {
       x+=o.offsetLeft;
       y+=o.offsetTop;
     }
return y;
//return curtop;
}
function getPos(){
return {x:findPosX(document.getElementById("tablemenu")),y:findPosY(document.getElementById("tablemenu"))};
}

function showPos(){
var pos = getPos();
alert("x=="+pos.x+"y=="+pos.y);
}


function OpenProject(){
	
	var showx = 100;
	var showy = 200;
	var WINheight = 500;
	var newWINwidth = 1000;
	var features =
		'dialogWidth:'  + newWINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:yes;Resizeable=no';
	retval = window.showModalDialog('../choose/openproject.aspx?tablename=v_xm_auth&modid=1564', 'winpop' , features );
	if(( retval != null )&&( retval != -1 ))
	{a=retval.split("||");  
	document.all('tblstatus').rows(0).cells(1).innerHTML ='<span> '+a[0]+'</span>';
	document.all('tblstatus').rows(0).cells(2).innerHTML ='<span> '+a[1]+'</span>';
	document.Form1.submit() ;  
	return true; }
	else
	{ return false;}
}

function eventForm(event,value)
{document.all('event').value=event;
document.all('value').value=value;
document.Form1.submit();
}