function MovePage(nPg)
{
	objForm			=document.forms[0];
	objForm.action	=strPg+".php";
	objForm.Pg.value=nPg;
	objForm.submit();
}
//---------------------------------------------------------------------------------

function Back(objForm)
{
	objForm.action=strPg+".php";
	objForm.submit();
}

function Reply(objForm)
{
	objForm.action=strPg+"_reply.php";
	objForm.submit();
}

function Edit(objForm, pID)
{
	objForm.action=strPg+"_edit.php";
	objForm.pID.value=pID;
	objForm.submit();
}

function Add(objForm)
{
	objForm.action=strPg+"_add.php";
	objForm.submit();
}

function Order(objForm)
{
	objForm.action=strPg+"_order.php";
	objForm.submit();
}

function Sort(objForm)
{
	objForm.action=strPg+"_sort.php";
	objForm.submit();
}

function activar( objForm, caso )
{
	var chkItems="";
	
	chkItems=buildChkItems(objForm);

	if ( chkItems!="" )
	{
		if( confirm( "¿Confirma cambiar el estado de estos registros?" ) )
		{
			objForm.chkItems.value	=chkItems;
			objForm.accion.value	="updateEstado";
			objForm.updatecaso.value=caso;
			objForm.submit();
		}
	}
}

function ExportExcel(objForm)
{
	objForm.action=strPg+"_xls.php";
	objForm.submit();
}

function ExportTXT(objForm)
{
	objForm.action=strPg+"_txt.php";
	objForm.submit();
}

function SelectAll(objForm)
{
	var xSel=objForm.chkAll.checked;
	if(typeof(objForm.chkID)!="object")
       	return;
	else
       	for (i=0;i<(objForm.chkID).length;i++)
			objForm.chkID[i].checked=xSel;
	if(i==0)
       	objForm.chkID.checked=xSel;
}

function Delete(objForm)
{
	var chkItems="";
	
	chkItems=buildChkItems(objForm);

	if (chkItems!="")
		if(confirm("¿Está seguro de eliminar el registro?"))
		{
			objForm.accion.value="delete";
			objForm.chkItems.value=chkItems;
			objForm.action=strPg+".php";
			objForm.submit();
		}
}

function buildChkItems(objForm)
{
	var chkItems="";

	if(typeof(objForm.chkID)!="object")
       	return;
	if(objForm.chkID.checked)
       	chkItems=objForm.chkID.value;
	else
		for(i=0;i<(objForm.chkID).length;i++)
			if(objForm.chkID[i].checked)
			{
				if (chkItems=="")
					chkItems=objForm.chkID[i].value;
				else
					chkItems+=","+objForm.chkID[i].value;
			}
	return chkItems;
}

function OnOrder(pField, pAsc)
{
	document.forms[0].action="";
	document.forms[0].Field.value=pField;
	document.forms[0].Asc.value=pAsc;
	document.forms[0].submit();
//	document.location.href=strPg+".php?Field="+pField+"&Asc="+pAsc;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  var aNewWindow=window.open(theURL,winName,features);
  aNewWindow.focus();
}
