//新开窗口---------------------------------------------------------------------------------------------
function JsOpenwindow(width,height,Url)
{
	var left = screen.width/2 - width/2;
	var top  = screen.height/2 - height/2;	 
	window.open(Url,null,"width="+width+",height="+height+",left="+left+",top="+top+"\",scrollbars=yes,resizable=yes");
}
//模式窗口
function JsShowModalDialog(width,height,Url)
{	
	var sFeatures="dialogHeight: " + height + "px; width: " + width + "px; center: Yes; help:No; resizable:No; status:Yes;";
	var rtnValue = window.showModalDialog(Url,null,sFeatures);
	return rtnValue;
}

//是否删除
function isDelete()
{		
	if(window.confirm("是否确认删除"))
	{
		if(document.all("txtAction")!=null)
			document.all("txtAction").value = "del"				
		document.forms[0].submit();
	}
}

//重写是否删除
//重写方法有问题
function isDeleteByOpen(DelURL)
{
	if(window.confirm("是否确认删除"))
	{
		JsOpenwindow(100,100,DelURL);
	}
}


//搜索
function MySearch(url)
{
	
	if(document.all("tbSearch").style.display=="none")
		document.all("tbSearch").style.display = "";
	else
	{
		document.all("tbSearch").style.display = "none";
		location.href = url;
	}
}

//搜索Action
function SearchAction()
{
	if(document.all("txtAction")!=null)
		document.all("txtAction").value = "search"	
	document.forms[0].submit();
}

///帮助信息展示------------------------
function MyHelpMessageShow()
{
	var mes = document.all("tabMessage");
	if(mes.className=="Message")
		mes.className = "Message2";
	else
		mes.className = "Message";
}

///控制显示
function ControlDis(objID)
{
	var objDis = document.all(objID);
	if(objDis.style.display=="none")
		objDis.style.display = "";
	else
		objDis.style.display = "none";
	
}

//打印
function IsPrint(url)
{
	if(window.confirm("是否打印"))
	{
		window.open(url);
	}
}
//打印
function DoPrint(url)
{
	var col = document.getElementsByTagName("INPUT");
	var items = "0";
	for(i=0;i<=col.length-1;i++)
	{
		if(col(i).id!=null&&col(i).id.charAt(0)=="O")
			if(col(i).checked)
				items = items + "," + col(i).value;
	}
	if(items=="0")
	{
		if(!window.confirm("你没有选择任何数据,是否打印全部"))
			return;
	}
	JsOpenwindow(screen.width,screen.height,url+items);
}

//是否选择了数据
function IsHasSelect()
{
	var col = document.getElementsByTagName("INPUT");
	var rtnValue = false;	
	for(i=0;i<=col.length-1;i++)
	{
		if(col(i).id!=null&&col(i).id.charAt(0)=="O")
			if(col(i).checked)
			{
				rtnValue = true;
				break;
			}				
	}	
	if(!rtnValue)
		alert("您还没有选择任何数据");
	return rtnValue;
}

//是否确认
function IsConfirm()
{
	if(window.confirm("是否确认,确认后将不能再编辑..此操作不能恢复"))
	{
		if(document.all("txtAction")!=null)
			document.all("txtAction").value = "confirm"				
		document.forms[0].submit();
	}
}
//是否作废
function IsCancel()
{
	if(window.confirm("是否作废,作废后将撤销库存操作"))
	{
		if(window.confirm("系统将过滤待作废的单证,已经作废的将不作处理.你确认执行作废的批处理吗"))
		{
			if(document.all("txtAction")!=null)
				document.all("txtAction").value = "cancel"				
			document.forms[0].submit();
		}
	}
}
//是否关闭
function IsClose()
{
	if(window.confirm("是否关闭,关闭后将不能再编辑和同时不能进货采用.此操作不能恢复"))
	{
		if(document.all("txtAction")!=null)
			document.all("txtAction").value = "close"				
		document.forms[0].submit();
	}
}

///初始化系统数据
function IsInitSys_Data()
{
	if(window.confirm("你将初始化系统的数据,确认要执行吗?"))
	{
		if(window.confirm("你将初始化系统的数据,慎重考虑请:按确定执行,按取消返回"))
		{
			return true;
		}
	}
	return false;
}


//四舍五入
//myFloat是要进行四舍五入的数字，mfNumber代表要取舍的位数
function floatRound(myFloat,mfNumber)
{
    var cutNumber = Math.pow(10,mfNumber-1);
    return Math.round(myFloat * cutNumber)/cutNumber;
}

//操作跳转--------------------------
function GotoOP(url)
{
	if(url!="0")
		location.href = url;
}

function JsSort(url,sortby)
{
	var newurl = url.replace("&Sortby=" + sortby,"");
	newurl = newurl + "?&Sortby=" + sortby;
	location.href = newurl;
}
