//****************************** USUARIOMURO ***********************************

//var swUsrmuroPager;
//var usrmuroPag;

var _USUARIO_MURO=new Array();

function start_ajax_USUARIOMURO(opcion,id_usuario_muro,i)
{  switch(opcion)
   {  case "INS":startDIVUSUARIOMURO("processUSUARIOMURO");
                 break;

      case "DEL":document.getElementById("deleteUSUARIOMURO"+i).style.display="none";
                 document.getElementById("processDeleteUSUARIOMURO"+i).style.display="inline";
	             break;

      case "LIS":break;
   }

   //---------------------------------------------------------------------------
   var datos="";

   switch(opcion)
   {  case "INS":datos="&usuario="+encodeURIComponent(USUARIO);
				 datos=datos+"&mensaje="+encodeURIComponent(document.getElementById("frmDatosUSUARIOMURO").txtMensaje.value);

				 datos=datos+"&swUsrmuroPager="+encodeURIComponent(swUsrmuroPager);
				 datos=datos+"&pag="+encodeURIComponent(usrmuroPag);
                 break;

      case "DEL":datos="&usuario="+encodeURIComponent(USUARIO);
                 datos=datos+"&id_usuario_muro="+encodeURIComponent(id_usuario_muro);

				 datos=datos+"&swUsrmuroPager="+encodeURIComponent(swUsrmuroPager);
				 datos=datos+"&pag="+encodeURIComponent(usrmuroPag);
				 break;

      case "LIS":datos="&usuario="+encodeURIComponent(USUARIO);

				 datos=datos+"&swUsrmuroPager="+encodeURIComponent(swUsrmuroPager);
				 datos=datos+"&pag="+encodeURIComponent(usrmuroPag);
	             break;
   }

   //---------------------------------------------------------------------------
   cnn=createXMLHttpRequest();
   cnn.open("POST",CD+"UsrMuroUsuarioMuro.ajax.php",true);
   cnn.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
   cnn.send("opcion="+opcion+datos);

   cnn.onreadystatechange=function()
   {  if(cnn.readyState==4 && cnn.status==200)
	  {  var respuesta=cnn.responseText.split(SEPARADOR);

		 document.getElementById("numMSGUSUARIOMURO").innerHTML=respuesta[0]; //numREGUSRMURO
		 usrmuroPag=parseInt(respuesta[1]); //pag
		 document.getElementById("muro").innerHTML=respuesta[2]; //resultado

		 switch(opcion)
         {  case "INS":resetFrmDatosUSUARIOMURO();
		               startDIVUSUARIOMURO("dataFormUSUARIOMURO");
		               break;
			case "DEL":break;
            case "LIS":break;
         }
      }
   }
}

//*************************** METODOS USUARIOMURO ******************************

function viewUSUARIOMURO(i)
{  usrmuroPag=i;

   start_ajax_USUARIOMURO("LIS",0,0);
}

//************************* FORM DATOS USUARIOMURO *****************************

function resetFrmDatosUSUARIOMURO()
{  document.getElementById("frmDatosUSUARIOMURO").reset();
   document.getElementById("contCarUSUARIOMURO").innerHTML=MURO_NUM_CAR;
}

function validateFrmDatosUSUARIOMURO()
{  var mensaje=document.getElementById("frmDatosUSUARIOMURO").txtMensaje.value;

   if(mensaje!="")
   {  start_ajax_USUARIOMURO("INS",0,0);

      displayAlert("alertUSUARIOMURO",0);
   }
   else
   {  document.getElementById("msgAlertUSUARIOMURO").innerHTML=_USUARIO_MURO["msg_inf_mensaje"]+"<br /><br />";

	  displayAlert("alertUSUARIOMURO",1);
	  //document.getElementById("frmDatosUSUARIOMURO").scrollIntoView(true);
   }
}

//************************** START DIV USUARIOMURO *****************************

function startDIVUSUARIOMURO(opcion)
{  document.getElementById("dataFormUSUARIOMURO").style.display="none";
   document.getElementById("processUSUARIOMURO").style.display="none";

   switch(opcion)
   {  case "dataFormUSUARIOMURO":document.getElementById("dataFormUSUARIOMURO").style.display="inline";break;
      case "processUSUARIOMURO": document.getElementById("processUSUARIOMURO").style.display="inline";break;
   }
}
