<?php
//ACTIVAR DESDE OTRA PAGINA
	if(strlen($StrId)==0){
		$StrId=V($_GET['Id']);
		if(is_numeric($StrId)==false){
			$StrId="";
		}else{
			$StrCmd="AR";
			$LStrPag=V($_GET['Pag']);
			if(!is_numeric($LStrPag)){
				$LStrPag="";
			}
		}
	}	
	//FUNCION PARA ACTIVAR UN REGISTRO
	if(strlen($StrId)>0 && $StrCmd=="AR"){
		$Id=$StrId;
		$StrNom=gs("aux_des","auxiliares","id_aux=$Id");		
		$LStrFoc="document.getElementById('TxtNom').focus();";	
		$StrGT="S";	
	}	
	//FUNCIONES DE ACTUALIZACION
	if($StrCmd=="G"){
		if(GetC("auxiliares","aux_tip='SIM'")>0){
			$s="DELETE FROM auxiliares WHERE aux_tip='SIM'";
			ejt($s);
		}
		if(strlen($StrGT)==0){
			$Id=GenId("id_aux","auxiliares");
			$s="INSERT INTO auxiliares VALUES ($Id,'$StrNom','SIM')";
			ejt($s);
			if($LStrMM=="S")	$LStrMsg="Datos registrados";
			$LStrFoc="document.getElementById('TxtNom').focus();";
			$StrGT="S";
			$StrId="";
			$StrNom="";
			$StrGT="S";	
		}
	}

	//////////////////////////////////
	if($StrGT=="S"){
		if(strlen($LStrMsg)>0){
			if(strlen($LStrFoc)==0){
				$LStrMsg="onload=\"alert('$LStrMsg');\"";
			}else{
				$LStrMsg="onload=\"alert('$LStrMsg');$LStrFoc;\"";
			}
		}else{
			if(strlen($LStrFoc)>0){
				$LStrMsg="onload=\"$LStrFoc;\"";
			}
		}
	}else{
		$LStrFoc="document.getElementById('TxtNom').focus();";
		$LStrMsg="onload=\"$LStrFoc;\"";
	}
?>

