var cnn;

//********************************* SEARCH *************************************

var _SEARCH=new Array();

//expresion
//swExacto
//swNombre
//swLogin
//swHabilidad

var searchPag=1;

function start_ajax_SEARCH()
{  startDIV("process");

   //---------------------------------------------------------------------------
   var datos="&expresion="+encodeURIComponent(expresion);
   datos=datos+"&swExacto="+encodeURIComponent(swExacto);
   datos=datos+"&swNombre="+encodeURIComponent(swNombre);
   datos=datos+"&swLogin="+encodeURIComponent(swLogin);
   datos=datos+"&swHabilidad="+encodeURIComponent(swHabilidad);

   datos=datos+"&pag="+encodeURIComponent(searchPag);

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

   cnn.onreadystatechange=function()
   {  if(cnn.readyState==4 && cnn.status==200)
	  {  document.getElementById("search").innerHTML=cnn.responseText;
         startDIV("list");
      }
   }
}

//*************************** METODOS SEARCH ***********************************

function viewSEARCH(i)
{  searchPag=i;

   start_ajax_SEARCH();
}

//************************** FORM DATOS SEARCH *********************************

function validateFrmDatosSEARCH()
{  var exp=document.getElementById("frmDatosSEARCH").varniv3.value;

   //---------------------------------------------------------------------------
   var sw=1;
   var msg="";

   if(exp=="")
   {  msg=msg+_SEARCH["msg_expresion"]+"<br /><br />";
      sw=0;
   }

   if(sw==1)
   {  //var url=strReplace("&amp;","&",URL+RUTAyLANG+RUTA_OPCION+URL_SEARCH+RUTA_NIV3+friendlyURL(expresion));
      var url=strReplace("&amp;","&",URL+RUTAyLANG+RUTA_OPCION+URL_SEARCH);

      document.getElementById("frmDatosSEARCH").action=url;
      document.getElementById("frmDatosSEARCH").submit();
   }
   else
   {  document.getElementById("msgAlertSEARCH").innerHTML=msg;
	  displayAlert("alertSEARCH",1);
	  //document.getElementById("frmDatosSEARCH").scrollIntoView(true);
   }
}

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

function startDIV(opcion)
{  document.getElementById("list").style.display="none";
   document.getElementById("process").style.display="none";

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