function turnit(obj)
{
	var submenu = document.getElementById(obj);
	if(submenu.style.display == "none")
	{
		submenu.style.display = "";
	}
	else
	{
		submenu.style.display = "none";
	}
	
}
function StrTrim(str) 
{ 
	return str.replace(/(^\s*)|(\s*$)/g, ""); 
}
function quit()
{
	if(window.confirm("确定要退出系统！"))
	{
		var btn = top.midFrame.document.getElementById("btnClose");
		btn.click();
		top.location.href="quit.aspx";
	}
}
			
function openWin(url,w,h)
{
	var t= 80;
	var l = window.screen.availWidth - 800;
	var hh =window.open(url,"aa","height=" + h + ", width=" + w + ", top=" + t + ", left=" + l + ", toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");
	hh.focus();
}
			
function openWinA(url)
{
	var h,w,t,l;
	h = window.screen.availHeight-250;
	w = 820;
	l = window.screen.availWidth - 1000;
	var hhA = window.open(url,"bb","height=" + h + ", width=" + w + ", top=0, left=" + l + ", toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");
	hhA.focus();
}
			
function openWinAA(url)
{
	var h,w,t,l;
	h = window.screen.availHeight- 0;
	w = 1024;
	l = window.screen.availWidth - 1024;
	var hhAA = window.open(url,"bb","height=" + h + ", width=" + w + ", top=100, left=" + l + ", toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no");
	hhAA.focus();
}
function IsNumber(str) 
{ 
	var number_chars = "1234567890";
	var i;
	for (i=0;i<str.length;i++)
	{
		if (number_chars.indexOf(str.charAt(i))==-1) return false;
	}
	return true; 
}	
function openWinB(url)
{
	var h,w,t,l;
	h = window.screen.availHeight-200;
	w = 760;
	l = window.screen.availWidth - 800;
	var hhB = window.open(url,"cc","height=" + h + ", width=" + w + ", top=0, left=" + l + ", toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");
	hhB.focus();
}
function openPrintWin(url)
{
	var h,w,t,l;
	h = 600;
	w = 800;
	l = window.screen.availWidth - 1000;
	var hhB = window.open(url,"cc","height=" + h + ", width=" + w + ", top=100, left=" + l + ", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
	hhB.focus();
}
			
function init() 
{ 
	document.onkeydown=keyDown;
	document.Form1.txtCustName.focus();
	
} 

function keyDown(e) 
{  
	if(event.keyCode==13) 
	{ 
		if(!(event.srcElement.name=="btnSave"||event.srcElement.name=="btnMatch"||event.srcElement.name=="btnShop"))
		event.keyCode=9 
	} 
}

function DoCal(elTarget) 
{
	if (showModalDialog) 
	{
		var sRtn;
		var h,w;
		var w = event.clientX + document.body.scrollLeft + 50;
		var h = event.clientY + document.body.scrollTop + 50;
		//h=document.forms[0].sel.clientTop+document.forms[0].sel.offsetTop+140;
		//w=document.forms[0].sel.clientLeft+document.forms[0].sel.offsetLeft+280;
		//sRtn = showModalDialog("include/Calendar.htm","","center=yes;dialogWidth=121pt;dialogHeight=155pt;dialogTop="+h+"pt;dialogLeft="+w+"pt;status=no");
		
		sRtn = showModalDialog("../include/Calendar.htm","","center=yes;dialogWidth=121pt;dialogHeight=155pt;dialogTop="+h+"pt;dialogLeft="+w+"pt;status=no;scrollbars=no");
		if (sRtn!="")
		elTarget.value = sRtn;
	} 
	else
		alert("请安装最新版本的浏览器！")
}

function SelectAll()
{
	var theForm, intCount;

	theForm = document.forms[0];

	for (intCount=0;intCount<theForm.elements.length;intCount++) {
		if ((theForm.elements[intCount].name != "chkSelectAll") && (theForm.elements[intCount].name.substring(0,9) == "chkSelect"))
			theForm.elements[intCount].checked = theForm.chkSelectAll.checked;
	}
//	return true;
}
function OpenFullWindow()
{
    if(window.name.indexOf("NewWindow")==-1)
    {
        var d=new Date(); 
	    var str="NewWindow";
	    window.opener = top;
	    windowprops = "top=0,left=0,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes" + ",width=" + (screen.availWidth-10) + ",height=" + (screen.availHeight-45);
	    winpops = window.open (self.location,str,windowprops);
	    winpops.focus();
	    window.close();
	}
}