//2005-1-7
//V2.1

//****************************************************************************
//显示日期，下拉组件/////-----/////显示POPUP窗口
//****************************************************************************
function abortError(msg,url,line){
    alert(msg+';错误行:'+line);
    return true;
}
window.onerror=abortError;

try
{
  var CalendarPopupSRC = '../js/';
  if (String(POPUPSRC) != "undefined")
  {
	CalendarPopupSRC = POPUPSRC;
  }
}
catch(e)
{
	CalendarPopupSRC = '../js/';
}

document.write('<IE:DOWNLOAD ID=dwn STYLE="behavior:url(#default#download)" />');	
var ParentdateCtrl  = null;
var ParentPopupArray = new Array();
var ParentCalendarPopup = null;
var ParentComboBoxPopup = window.createPopup();
var ParentComboTreePopup = null;

function DownURL(url)
{
	var XMLObj = null;
	try
	{
		//实例化xmlhttp对象
		if ( document.all )
		{
			XMLObj = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		}
		else
		{
			XMLObj = new XMLHttpRequest();
		}		
	}
	catch(e)
	{
		return "";
	}
	XMLObj.open('get',url,false);
	XMLObj.send();
	var ReturnVal = XMLObj.responseText;
	return ReturnVal;
}

function onDone(src)
{
	ParentCalendarPopup.document.write(src);
}

function showCalendarPopup(popCtrl,dateCtrl)
{	//显示日期
	ParentdateCtrl = dateCtrl;
	try
	{
		ParentCalendarPopup = window.createPopup();
		//var PageContent = DownURL(CalendarPopupSRC+"Calendar.htm");
		//ParentCalendarPopup.document.write(PageContent);
		dwn.startDownload(CalendarPopupSRC+"Calendar.htm",onDone);
		ParentCalendarPopup.show(1, popCtrl.offsetHeight, 232, 212, popCtrl);
	}
	catch(e)
	{}
}

var OldComboBoxUrl = "";
function showComboBoxPopup(url,s,W,H)
{//显示下拉组件
	try
	{
		if ( OldComboBoxUrl != url || ParentPopupArray.length == 0 )
		{
		    //繁体修改
			//OldComboBoxUrl = url;
			params1 = url.substring(url.indexOf('params')+7,url.length);
		    params2 = escape(params1);
		    url = url.replace(params1,params2);
		   	OldComboBoxUrl = url;

			var tmpPopupWindow = window.createPopup();
			ParentPopupArray.push(tmpPopupWindow);
			var PageContent = DownURL(url);
			tmpPopupWindow.document.write(PageContent);
		}
		var tmpPopupWindow = ParentPopupArray[ParentPopupArray.length - 1];
		tmpPopupWindow.show(1, s.offsetHeight, W, H, s);
	}
	catch(e)
	{}
}

var OldComboTreeUrl = "";
function showComboTreePopup(url,s,W,H)
{//显示下拉Tree组件
	try
	{
		if ( OldComboTreeUrl != url || ParentComboTreePopup == null )
		{
			ParentComboTreePopup = window.createPopup();
			var PageContent = DownURL(url);
			ParentComboTreePopup.document.write(PageContent);
			OldComboTreeUrl = url;
		}
		ParentComboTreePopup.show(1, s.offsetHeight, W, H, s);
	}
	catch(e)
	{}
}

//****************************************************************************
//显示日期，下拉组件结束/////-----/////显示POPUP窗口
//****************************************************************************


//****************************************************************************
//显示载入进度
//****************************************************************************
//var cWidth = document.body.clientWidth;
//var cHeight= document.body.clientHeight;
//cTop = window.screenTop + (cHeight-136)/2;
//cLeft= window.screenLeft + (cWidth-384)/2;


//////////////////////////////////////////////////////////助手
var Agent = '';
Agent += '<OBJECT language=chinese id=sims style="LEFT:100px;TOP:100px" classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F></OBJECT>';
Agent += '<Object ID="L&HTruVoice" Width=0 Height=0 style="LEFT:100px;TOP:100px"  ClassID="CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575" CodeBase="#VERSION=6,0,0,0"></Object>';
var MerlinID;
var MerlinACS;
//ShowAgent();
function ShowAgent()
{
	try
	{
		document.write (Agent);
		return;
		//sims.Connected = true;
		//MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS);
		//Merlin = sims.Characters.Character(MerlinID);
		//Merlin.MoveTo(cLeft-100,cTop-100);
		//Merlin.Show();
		//Merlin.Think("页面载入请稍候...");
		//Merlin.Play("Surprised");
		//Merlin.Play("GestureLeft");
		//Merlin.Play("Pleased");
		//Merlin.Think("页面载入请稍候...");
		//Merlin.Play("GestureLeft");
		//Merlin.Play("Pleased");
		//Merlin.Play("GestureDown");
		//Merlin.Think("页面载入请稍候...");
		//Merlin.Play("GetAttention");
	}
	catch(e)
	{
	}
}

function LoadLocalAgent(CharID, CharACS)
{
	try
	{
	LoadReq = sims.Characters.Load(CharID, CharACS);
	return(true);
	}
	catch(e)
	{}
}

function UnloadAgent()
{
	try
	{
	Merlin.StopAll();
	Merlin.Hide();
	sims.Connected = false;
	//sims.Characters.Character.Unload(MerlinID);
	}
	catch(e)
	{}
}
////////////////////////////////////////////////////////////////////////////////助手

//document.write('<DOWNLOAD ID=dwn STYLE="behavior:url(#default#download)" />');
try
{
  var oPopup = null;
  var IMGSRC = '../';
  var ProcessBar = true;
  
  //isNeedProcessBar
  //功能：是否显示进度条
  //返回值：boolen型，true为显示进度条，false为不显示进度条（在前台打开表单时的进度条）
  if (!isNeedProcessBar)
  {
	  ProcessBar = false;
  }
}
catch(e)
{
	ProcessBar = true;
	IMGSRC = '../';
}

//ProcessBar = false;

try
{
  var IMGSRC = '../';
  if (String(imgpath) != "undefined")
  {
	IMGSRC = imgpath;
  }
}
catch(e)
{
	IMGSRC = '../';
}

	
var oPopup=window.createPopup();
//var iLoadForm =null;
//var iloadt = null;
var sleepid = 0;
var lic = 20;
var time=null;
var L11 = 5;
var M11 = 95;

if (ProcessBar)
{
	
	var bodyStr = '';
	bodyStr +=  ("<div id='LoadForm' style='position:absolute;background-color:#e4e4e4;top:0;left:0;width:384;height:136;z-index:1'>");
	bodyStr +=  ("<table border=0 cellSpacing=0 cellPadding=0 >");
	bodyStr +=  ("<tr><td height=136 width=384><img src='"+IMGSRC+"images/loading.jpg'></td></tr>");
	bodyStr +=  ("</div>");
	bodyStr +=  ("<table width=300 height=15 cellSpacing=0 cellPadding=1 align=center border=0 style='position:absolute;border:1 solid  #999999;top:81;left:40;' ><tr><td><table height=15  bgcolor=#08246B id=loadt><tr><td></td></tr></table></td></tr></table>");
	oPopup.document.body.innerHTML = bodyStr;

	var cLeft= (screen.width - 384)/2;
	var cTop = (screen.height - 136)/2;
	//alert(top.screen.height);

	oPopup.show(cLeft,cTop,384,136);
	oPopup.document.body.bgColor = '#DDDDDD';
	//iLoadForm = oPopup.document.body.all('LoadForm');
	//iloadt = oPopup.document.body.all('loadt');
	//iLoadForm.onclick = hide;
	//iLoadForm.style.display="";
	sleepid = 0;
	lic = 20;
	loads();
}

function ShowProcessBar()
{
	var bodyStr = '';
	bodyStr +=  ("<div id='LoadForm' style='position:absolute;background-color:#e4e4e4;top:0;left:0;width:384;height:136;z-index:1'>");
	bodyStr +=  ("<table border=0 cellSpacing=0 cellPadding=0 >");
	bodyStr +=  ("<tr><td height=136 width=384><img src='"+IMGSRC+"images/loading.jpg'></td></tr>");
	bodyStr +=  ("</div>");
	bodyStr +=  ("<table width=300 height=15 cellSpacing=0 cellPadding=1 align=center border=0 style='position:absolute;border:1 solid  #999999;top:81;left:40;' ><tr><td><table height=15  bgcolor=#08246B id=loadt><tr><td></td></tr></table></td></tr></table>");
	oPopup.document.body.innerHTML = bodyStr;

	var cLeft= (screen.width - 384)/2;
	var cTop = (screen.height - 136)/2;
	//alert(top.screen.height);

	oPopup.show(cLeft,cTop,384,136);
	oPopup.document.body.bgColor = '#DDDDDD';
	//iLoadForm = oPopup.document.body.all('LoadForm');
	//iloadt = oPopup.document.body.all('loadt');
	//iLoadForm.onclick = hide;
	//iLoadForm.style.display="";
	sleepid = 0;
	L11 = 100;
	M11 = 90;
	lic = 0;
	loads();
}

function loads()
{
	if (oPopup==null)
	{
		return;
	}
	
	//oPopup.document.parentWindow.resizeTo(330,87);
	try
	{
		var iloadt = oPopup.document.body.all('loadt');
		iloadt.style.width=lic+"%";
	}
	catch(e)
	{
		hide();
		return;
	}
	time = setTimeout("loads()",L11);

    if(lic>100)
	{
		hide();
    }
    else if (lic>=99)
    {
		lic += 0.000001;
	}
    else if (lic>M11)
    {
		lic += 0.05;
    }
	else
	{
       	lic += 1;
    }	
}

function hide()
{
    try
    {
        clearTimeout(time);
    }
    catch(e)
    {}
	if (oPopup==null)
	{
		return;
	}
	//iloadt.style.width="100%";
	//iLoadForm.style.display="none";
	
	//UnloadAgent();
	oPopup.show(-8000,8000,0);
	oPopup.hide();
	self.scrollTop = 0;
	lic = 20;
	
}

function setpIt(w)
{
	oPopup.document.body.all('loadt').style.width=w+"%";
	lic = w;
}




//****************************************************************************
//显示载入进度结束
//****************************************************************************

//删除字串两头重复的字串
function trim(str,chr)
{
	if (str.substr(0,1)==chr)
	{
		str = str.substr(1,str.length);
	}
	if (str.substr(str.length-1,1)==chr)
	{
		str = str.substr(0,str.length-1);
	}
	return str;
}

//返回值
function SelValue(s){
	
	try
	{
		var sObj = event.srcElement;
		if (sObj.tagName=='INPUT'&&sObj.type=='checkbox')
			return;
	}
	catch(e)
	{}
	
	ReturnArr = new Array();
	chkArr = new Array();
	
	//根据checkbox取记录
	var chkElements = document.getElementsByTagName('INPUT');
	if (chkElements.length>0)
	{
		for (var i=0; i < chkElements.length; i++)
		{
			var chkElement = chkElements[i];
			if (chkElement.checked&&chkElement.getAttribute('chkIndex')!=null)
			{
				chkArr.push(chkElement.value);
			}
		}
	}
	if (chkArr.length>0)
	{
		if (dataExList.length>0)
		{
			for (var i = 0; i < dataExList[0].length; i++)
			{
				var tmpReturnValue = "";
				for (var j = 0; j < chkArr.length; j++)
				{
					var R1 = chkArr[j];
					var R2 = i;
					tmpReturnValue += dataExList[R1][R2] + ',';
				}
				tmpReturnValue = tmpReturnValue.substr(0,tmpReturnValue.length-1);
				ReturnArr.push(tmpReturnValue);
			}
		}
		
	}
	else
	{
		//选取一条记录
		var id = s.rowIndex - 1;
		for (var j = 0;j<dataExList[id].length ;j++ )
		{
			//ReturnStr += dataExList[id][j] + '_$$@@$$_';
			//以字符串,分隔不安全,使用更为安全的字符串分隔
			ReturnArr[j] = dataExList[id][j];
			//alert(ReturnArr[j]);
		}
	}
	//ReturnStr = ReturnStr.substr(0,ReturnStr.length-8);
	//alert(ReturnArr);

	//if (ReturnStr=='')
	if (ReturnArr.length == 0)
	{
		alert('请选择');
	}
	else
	{
		top.returnValue = ReturnArr;
		top.close();
	}

} 


var tmpTrColor = 'Menu';


function QueryButtonClick(s,b)
{
	if (b.style.display=='none')
	{
		b.style.display = '';
		s.src="../images/buttom/yc3.gif";
	}
	else
	{
		b.style.display = 'none';
		s.src="../images/buttom/yc4.gif";
	}

}

//进行简单查询（databrowser)
function SetEasyFindZone(ListTitle,ListField,dataProcArg,dataProcArgName,SearchArr,showSearchZone,ListShowField)
{
	var str = "";
	var DisplayFlag = '';
	var SearchImg = 'yc3.gif';
	if (showSearchZone=='hide')
	{
		DisplayFlag = 'none';
		SearchImg = 'yc4.gif';
	}
	if (dataProcArg.length!='')
	{//如果存储过程参数存在，则进行存储过程查询
		for (var i=0;i<dataProcArg.length;i++)
		{
			var SearchValue = "";
			try
			{
				if (SearchArr.length>0)
				{
					SearchValue = SearchArr[i][1];
				}
			}
			catch(e)
			{}
			str += "<td style='border:0px' >" + dataProcArgName[i] + "：<input type=text value='"+SearchValue+"' size=8 class='box' runat=server id='easyfind_"+i+"' name='easyfind_"+i+"' FieldName='"+dataProcArg[i]+"'><input type=hidden value='"+dataProcArg[i]+"' id='FieldName_"+i+"' name='FieldName_"+i+"'></td>" ;
		}
	}
	else
	{//否则从表查询
		var CntIndex = 0;
		for (var i=0;i<ListTitle.length;i++)
		{
			var showList = ','+ListShowField.toString()+',';
			if (showList.indexOf(','+i+',')==-1)continue;
			
			var SearchValue = "";
			try
			{
				if (SearchArr.length>0)
				{
					SearchValue = SearchArr[i][1];
				}
			}
			catch(e)
			{}
			if(ListField[i] == 'guid' || ListField[i] == 'sz_guid')
			    continue;
			str += "<td style='border:0px' >" + ListTitle[i] + "：<input type=text value='"+SearchValue+"' size=8 class='box' runat=server id='easyfind_"+CntIndex+"' name='easyfind_"+CntIndex+"' FieldName='"+ListField[i]+"'><input type=hidden value='"+ListField[i]+"' id='FieldName_"+CntIndex+"' name='FieldName_"+CntIndex+"'></td>" ;
			CntIndex++;
		}
	}

	str = "<table cellspacing='0' width=100% align=center cellpadding='0' border=0 id='FindZone' name='FindZone' style='display:"+DisplayFlag+"'><tr><td height=1></td></tr><tr><td><table cellspacing='1' cellpadding='2' width=98% border=1 BorderColor='DarkGray' align=center><tr>"+str+"<td  style='border:0px' ><input type='image' id='findbutton' src='../images/buttom/search.gif' runat='server'></td></tr></table></td></tr></table>";
	str += "<table cellspacing='0' width=98% align=center cellpadding='0' border=0><tr><td><IMG id='ShowSearchIMG' style='CURSOR: hand' onclick='QueryButtonClick(this,FindZone);' alt='隐藏/显示查询表单' src='../images/buttom/"+SearchImg+"' name='ShowSearchIMG' p=''></td><td><input type=text value='' id='tmpFocusObj' style='width:1;height:1px'></td></tr></table>";
	str += "<table height=2><tr><td></td></tr></table>";
	return(str);
}

function getList(ListTitle,ListField,ListArray,ListShowField)
{
	var TitleCount = ListTitle.length;
	var ListCount  = ListArray.length;
	var TrColor = new Array("#EBECEC","#FAFBFB");
	var TempListStr  = "";
	var TempTitleStr  = "";
	var Str1 = "";
	var Str2 = "";
	var Str3 = "";
	var Str4 = "";
	var Str  = "";
	var TempStr = "";
	var j = 0;

	var TempSearch = "";
	var TitleTempChar = "";
    var hasGuid = false;
    
	for (i=0;i<ListCount;i++)
	{
		var guid = '';
		var j = (i%2);
		Str = '';
        
		for (var k = 0;k<ListArray[i].length ;k++ )
		{
			var showList = ','+ListShowField.toString()+',';
			if (showList.indexOf(','+k+',')==-1)continue;
			guid = ListArray[i][TitleCount-1];
			
			if (ListField[TitleCount-1] == 'guid' || ListField[TitleCount-1] == 'sz_guid')
			{
			    hasGuid = true;
			    if(k == ListArray[i].length-1)
			        break;
            }			        
			if(k == 0 && (ListField[TitleCount-1] == 'guid'|| ListField[TitleCount-1] == 'sz_guid'))
		        Str += "<td height=20 style='border:0px; width:25px;'><input type='checkbox' id='" + guid + "' onclick='MarkVal(this);' /></td><td height=20 style='border:0px'>" + ListArray[i][k] + "</td>";
		    else if(ListField[TitleCount-1] == 'guid'|| ListField[TitleCount-1] == 'sz_guid')
		        Str += "<td height=20 style='border:0px'></td><td height=20 style='border:0px'>" + ListArray[i][k] + "</td>";
		    else
		        Str += "<td height=20 style='border:0px'>" + ListArray[i][k] + "</td>";
		}

		Str1 = "<tr id='" + guid + "' align=left bgcolor='"+TrColor[j]+"' tmpBgColor='"+tmpTrColor+"' style='cursor:Hand' onmouseover='SelStyle(this);' onmouseout='SelStyle(this);' onclick='SelValue(this);'>" ;
		Str2 = "</tr>";
		Str3 = Str;
		var chkStr = "";
		try
		{
			if (OpraType=='databrowse')
			{
				chkStr = "<input type=checkbox value='"+i+"' chkIndex>";
			}
		}
		catch(e){}
		//Str4 = "<td height=20 width=30 style='border:0px'><input type=radio name = 'radio1' value='"+i+"'></td>";
		Str4 = "<td height=20 width=10 style='border:0px'></td>";
	
		TempListStr += Str1+Str4+Str3+Str2;

	}	

	for (i=0;i<TitleCount;i++)
	{
		var showList = ','+ListShowField.toString()+',';
		if (showList.indexOf(','+i+',')==-1)continue;
			
		var TitleTopStr = ListTitle[i];
		if(TitleTopStr == 'guid' || TitleTopStr == 'sz_guid')
		    TitleTopStr = '';
		var TitleWidth  = TitleTopStr.length*15;
		//这里的标题宽度不作设置了。
		//TitleWidth = (TitleWidth>100)?100:TitleWidth;
		//alert(TitleWidth)
		
		var TitleZoneStr = "<table cellspacing='0' cellpadding='0' border=0 width='100%'><tr><td style='font-weight: bold;border:0px;'><nobr>"+TitleTopStr+"</nobr></td></tr></table>";
		
		if(hasGuid)   
		    TempTitleStr += "<td style='font-weight: bold;border:0px' ></td><td style='font-weight: bold;border:0px' >" + TitleZoneStr + "</td>" ;
		else
		    TempTitleStr += "<td style='font-weight: bold;border:0px' >" + TitleZoneStr + "</td>" ;
	}
	TempTitleStr = "<tr class='gridheader' height=22><td width=10 style='border:0px'></td>" +TempTitleStr+"</tr>";

	var ListChar = "<table width='99%' border='1' id='DataListTable' BorderColor='DarkGray' cellspacing='0' cellpadding='0'  align=center style='font-size:9pt'>" +					
				TempTitleStr+	
				TempListStr +
			"</table>";
	if(hasGuid)    
	    ListChar = "<td width='100%' style='font-weight: bold;border:0px;'><table width='100%' style='text-align:right;'><tr><td><input type='hidden' id='txtId' /><input onclick='DelRows(this.id);' type='button' value='删 除' style='width:60px; height:23px; BACKGROUND-IMAGE: url(../images/buttom/gridheader.jpg); border: #7EB9E0 1px solid;background-color: #FFFFFF;background-position: center center;font-family: 'Courier New' , Arial;font-size: 9pt;FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorStr=#ffffff, endColorStr=#B7D8EE, gradientType=0);' /></td></tr></table></td>" + ListChar;

	return ListChar;
	
}

function getNewList(ListTitle,ListField,ListArray,ListShowField)
{
	var ListChar = getList(ListTitle,ListField,ListArray,ListShowField)
	ListChar = "<table width=98% cellpadding=0 cellspacing=0 align=center><tr><td>"+ListChar+"</td></tr></table><br>";
	return(ListChar);
}

//显示列表
function ShowList(ListTitle,ListField,ListArray,dataProcArg,dataProcArgName,SearchArr,showSearchZone,ListShowField)
{
	//alert(showSearchZone);
	var ListChar = getNewList(ListTitle,ListField,ListArray,ListShowField);
	var findstr = SetEasyFindZone(ListTitle,ListField,dataProcArg,dataProcArgName,SearchArr,showSearchZone,ListShowField);
	document.write(findstr+ListChar);
	top.document.title = '数据游览列表';
	
	try
	{//databrowser打开后自动选中查询第一个输入框
		document.onkeydown = SelRows;
		document.onkeyup = function(){document.all.item('SelectFrmZone').removeAttribute('currTop');}
		document.all.item('SelectFrmZone').onscroll = SelScroll;
		document.all.item('tmpFocusObj').focus();
		document.all.item('easyfind_0').focus();
		document.all.item('easyfind_0').select();
	}
	catch(e)
	{
		//alert(e.description);
	}
}



//代替滚动条
function ScrollButton()
{
	try
	{
		var ScrollBtnPath = '../images/buttom/';
		if (String(ScrollImgPath) != "undefined")
		{
			ScrollBtnPath = ScrollImgPath;
		}
	}
	catch(e)
	{
		ScrollBtnPath = '../images/buttom/';
	}
	var topChar = ScrollBtnPath+'top.gif';
	var bottomChar = ScrollBtnPath+'bottom.gif';
	var btnZone = '';
	var tmpTop = document.body.scrollTop+5;
	var tmpLeft = document.body.clientWidth-25;
	btnZone = '<img id="TopButtonScroll" title="向上" style="POSITION: absolute;left:'+tmpLeft+';top:'+tmpTop+';cursor:hand" onclick="toTop();" onmousedown="toScrolltop();" onmouseup="noScroll();" src = "'+topChar+'">';
	document.write(btnZone);
	var tmpTop = document.body.offsetHeight+document.body.scrollTop-25;
	btnZone = '<img id="BottomButtonScroll" title="向下" style="POSITION: absolute;left:'+tmpLeft+';top:'+tmpTop+';cursor:hand" onclick="toBottom();" onmousedown="toScrollBottom();" onmouseup="noScroll();"  src="'+bottomChar+'">';
	document.write(btnZone);
}

function setScrollButton()
{
	try
	{
		document.all.item("TopButtonScroll").style.top = document.body.scrollTop+5;
		document.all.item("TopButtonScroll").style.left = document.body.clientWidth-25;
		document.all.item("BottomButtonScroll").style.top = document.body.offsetHeight+document.body.scrollTop-25;
		document.all.item("BottomButtonScroll").style.left = document.body.clientWidth-25;
	}
	catch(e)
	{}
}

function toTop()
{
	document.body.scrollTop = (document.body.scrollTop-10);
	setScrollButton();
}

function toBottom()
{
	document.body.scrollTop = (document.body.scrollTop+10);
	setScrollButton();
}

function toTop2()
{
	document.body.scrollTop = (document.body.scrollTop-10);
	setScrollButton();
}

function toBottom2()
{
	document.body.scrollTop = (document.body.scrollTop+10);
	setScrollButton();
}

var scrollTimeID = null;

function toScrolltop()
{
	noScroll();
	scrollTimeID = setInterval("toTop2()", 20);
}

function toScrollBottom()
{
	noScroll();
	scrollTimeID = setInterval("toBottom2()", 20);
}

function noScroll()
{
	clearInterval(scrollTimeID);
	setScrollButton();
}

window.onscroll = setScrollButton;
window.onresize = setScrollButton;

//移动组件,右键菜单

currentX = currentY = 0;  
whichIt = null;           

function grabIt() {

	whichIt = event.srcElement;
	if (whichIt.tagName=='BODY'){whichIt = null; return true;}
	try
	{
		if (whichIt.id=='TopButtonScroll'){whichIt = null; return true;}
		if (whichIt.id=='BottomButtonScroll'){whichIt = null; return true;}
		if ((whichIt.style.position==null)||(whichIt.style.position!='absolute'))
		{
			whichIt = null;
		}
	}
	catch(e)
	{
		whichIt = null;
	}
	if (whichIt == null) {return true; }

	whichIt.style.pixelLeft = whichIt.offsetLeft;
	whichIt.style.pixelTop = whichIt.offsetTop;
	currentX = (event.clientX + document.body.scrollLeft);
	currentY = (event.clientY + document.body.scrollTop); 	

	return true;
}

function moveIt() {

if (whichIt == null) { return true; }

newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX);    distanceY = (newY - currentY);
currentX = newX;    currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
event.returnValue = false;

return false;
}

function dropIt() {
whichIt = null;
CustomMove = false;
return true;
}	

function ContextMenu()
{
	if (parent == self)
	{
		return false;
	}

}

document.oncontextmenu=ContextMenu;  //right click event;
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
	


//自动展开树
function TreeViewExpand(TVInfoArray,TreeViewID,NodeText)
{
var ComponentArt_ActiveTreeView11=ComponentArt_GetTreeView(TreeViewID);
ComponentArt_ActiveTreeView11.ExpandAll(0);
if (NodeText=='')
{
	return;
}
	for (var i=0;i<TVInfoArray.length;i++)
	{
		var tmpArrayText = TVInfoArray[i][3];
		if (NodeText==tmpArrayText)
		{
			var TreeViewIndex = i;
			try
			{
				var NodeIndex = TreeViewIndex;
				var zp_e=ComponentArt_ActiveTreeView.zp_l(NodeIndex);
				var zp_ak=document.getElementById(TreeViewID+'_item_'+NodeIndex);
				var zp_aq=document.getElementById(TreeViewID+'_item_'+NodeIndex+'_cell');
				var zp_bz=document.getElementById(TreeViewID+'_item_'+NodeIndex+'_div');
				ComponentArt_SelectItem(ComponentArt_ActiveTreeView,zp_e,zp_ak,zp_aq);
				zp_ak.focus();
			}
			catch(e)
			{
			    	//alert();
			}
		}
	}
}

var oPopup = window.createPopup();
//TreeViewExpand(ComponentArt_Storage_TreeView1,'TreeView1','sadf');//最后参数为空时则为全部展开，最后一个参数为节点TEXT时则为该节点选中




//////////////////////////////////////////////////////////
//******************************************************//

//弹出提示窗口
//
var TipsPopup=window.createPopup();
var PopupTimer = null;
var PopupWidth = 180;
var PopupHeight= 120;
var RunHeight = 0;
var PopupLeft = screen.availWidth - PopupWidth - 20;
var PopupTop = screen.availHeight;
var PopupImgSrc = '';
function ShowTipsPopup( Content )
{
	PopupTimer = null;
	PopupWidth = 180;
	PopupHeight= 135;
	RunHeight = 0;
	PopupLeft = screen.availWidth - PopupWidth - 20;
	PopupTop = screen.availHeight;

	var bodyStr = ''+
	'<TABLE id=table_0 style="WIDTH: '+PopupWidth+'; HEIGHT: '+PopupHeight+'" cellSpacing=0 '+
	'  borderColorDark=#ffffff cellPadding=0 align=center '+
	'  bgColor=#f1f8fb borderColorLight=#7EB9E0 border=1 name="table_0" '+
	'  DataMember="">'+
	'	<TBODY>'+
	'	<TR>'+
	'	  <TD style="Font-Size:9pt; HEIGHT: 20px;background:#B7D8EE;filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr=#ffffff, endColorStr=#B7D8EE, gradientType=0);" >'+
	'		<table width=100% border=0 cellPadding=0 cellSpacing=0 ><tr> '+
	'			<td width=10><img src='+PopupImgSrc+'images/flowico4.gif></td>'+
	'			<td style="Font-Size:9pt;color:#3262a3;">&nbsp;温馨提示</TD>'+
	'			<td width=1%  style="Font-Size:9pt;color:#3262a3;FONT-FAMILY: Webdings;cursor:hand;" id="TipsPopupCloseBtn"  onclick="try{parent.TipsPopup.hide();}catch(e){}">r</TD>'+
	'			<td width=4></TD>'+
	'		</TR></table>'+
	'	  </td>' +
	'	</tr>'+
	'	<TR>'+
	'	  <TD>' +
	'<div id="TipsPopupDIVZone" style="OVERFLOW: auto; WIDTH: 100%; HEIGHT: 100%">'+
	'		<table width=100% height=100%><tr><td style="Font-Size:9pt;"> '+
	Content+ 
	'		</td></tr></table>'+
	'</DIV>'+
	'	</tr>'+
	'	</tbody>'+
	'</table>';
	
	
	TipsPopup.document.body.innerHTML = bodyStr;
	

	TipsPopup.show(PopupLeft,PopupTop,PopupWidth,RunHeight);
	
	//var CloseBtn = TipsPopup.document.body.all('TipsPopupCloseBtn');
	//CloseBtn.onclick = function ()
	//{TipsPopup.hide();}
	
	PopTimer();
	
}

function ShowTipsPopupWindow( Content )
{
	PopupImgSrc = '../';
	ShowTipsPopup( Content );
}


function PopTimer()
{
	if ( RunHeight > PopupHeight )
	{
		clearTimeout(PopupTimer);
		return;
	}
	
	RunHeight ++;
	
	PopupTop --;;
	
	TipsPopup.show(PopupLeft,PopupTop,PopupWidth,RunHeight);
	
	PopupTimer = setTimeout("PopTimer()",10);
}
