var popUpWin=0;

function DeleteItem(lsTableName,liRecordID,lsPage,lsMsg){
	if (confirm(lsMsg)){
		window.location = "../../sys/cfg/delete.asp?TableName=" + lsTableName + "&RecordID=" + liRecordID + "&RedirectPage=" + lsPage;
	}
}

function popUpWindow(lsURLStr, liWidth, liHeight, lsWindowName, lbToolbar, lbLocation, lbDirectories, lbStatus, lbMenubar, lbScrollbars, lbResizable, lbCopyHistory, lsOtherAttributes){
	var liLeftPos = 0;
	var liTopPos = 0;
	var lsToolbar = "no";
	var lsLocation = "no";
	var lsDirectories = "no";
	var lsStatus = "yes";
	var lsMenubar = "no";
	var lsScrollbars = "yes";
	var lsResizable = "yes";
	var lsCopyHistory = "no";
	if (lbToolbar)
		lsToolbar = "yes";
	if (lbLocation)
		lsLocation = "yes";
	if (lbDirectories)
		lsDirectories = "yes";
	if (lbStatus == false)
		lsStatus = "no";
	if (lbMenubar)
		lsMenubar = "yes";
	if (lbScrollbars == false)
		lsScrollbars = "no";
	if (lbResizable == false)
		lsResizable = "no";
	if (lbCopyHistory)
		lsCopyHistory = "yes";
	if (lsOtherAttributes != null)
		lsOtherAttributes = lsOtherAttributes + ",";
	else
		lsOtherAttributes = "";
	if (window.name == lsWindowName){
		window.location = lsURLStr;
	}
	else{
		if(screen){
			liLeftPos = (screen.width/2) - (liWidth/2);
			liTopPos = (screen.height/2) - (liHeight/2);
		}
  		popUpWin = open(lsURLStr,lsWindowName, "toolbar="+lsToolbar+",location="+lsLocation+",directories="+lsDirectories+",status="+lsStatus+",menubar="+lsMenubar+",scrollbars="+lsScrollbars+",resizable="+lsResizable+",copyhistory="+lsCopyHistory+","+lsOtherAttributes+"width="+liWidth+",height="+liHeight+",left="+liLeftPos+", top="+liTopPos+"");
	}
}

function openNewWindow(myForm,liWidth,liHeight,lsWindowName){
	if (myForm.elements[0].options[myForm.elements[0].selectedIndex].value.length != 0){
		var lsURL = myForm.elements[0].options[myForm.elements[0].selectedIndex].value;
		popUpWindow(lsURL,liWidth,liHeight,lsWindowName);
	}
}

function transferLocation(myForm){
	if (myForm.elements[0].options[myForm.elements[0].selectedIndex].value.length != 0){
		var lsURL = myForm.elements[0].options[myForm.elements[0].selectedIndex].value;
		window.location = lsURL;
	}
}

function checkAll(){
	for (var i=0;i<document.forms[0].elements.length;i++)
	{
		var loformControl=document.forms[0].elements[i];
		if ((loformControl.name != 'allbox') && (loformControl.type=='checkbox'))
		{
			loformControl.checked=document.forms[0].allbox.checked;
		}
	}
}

function submitPageNavigation(lsDirection,lsPage){
	if (lsDirection == 'FORWARD')
	{
		document.forms[0].PageNo.value = (document.forms[0].PageNo.value - 0) + 1;
	}
	else
	{
		document.forms[0].PageNo.value = (document.forms[0].PageNo.value - 0) - 1;
	}
	document.forms[0].action = lsPage;
	document.forms[0].submit();
}

function submitPageSort(lsOrder,lsDirection,lsPage){
	document.forms[0].PageNo.value = 1;
	document.forms[0].Order.value = lsOrder;
	document.forms[0].Direction.value = lsDirection;
	document.forms[0].action = lsPage;
	document.forms[0].submit();
}