// Handlers Globales
onCompleteFunction = function(t) {
	if (MostrarEtiquetaProcesando != undefined) {
	    OcultarEtiquetaProcesando();
	}
}
onCompleteFunctionBlock = function(t) {
        document.getElementById('divDeshabilitadorForm').style.display = 'none';
}

// Funciones
function AjaxRequest(sParametros,sUrlPagina,sIdForm,sIdsLabels,bBloquearForm) {
    if (sIdsLabels != '') {
	    var oArrIdsLabels = sIdsLabels.split(';');
	    for (var i = 0; i < oArrIdsLabels.length; i++){
            $("#" + oArrIdsLabels[i]).hide();
        }
    }
	if (sUrlPagina == '') {
		sUrlPagina = window.location.pathname + window.location.search;
	}
	if (bBloquearForm){
    document.getElementById('divDeshabilitadorForm').style.display = 'block';
    onCompleteFunctionHandler = onCompleteFunctionBlock;
	}else{
		if (MostrarEtiquetaProcesando != undefined) {
		    MostrarEtiquetaProcesando();
	  }
	  onCompleteFunctionHandler = onCompleteFunction;
	}
	if(sIdForm!="")
		sIdForm = "#" + sIdForm;
	else
		sIdForm = "form";
			
	$("#EsAjax").val('true');
	$("#showPage").load(sUrlPagina, $(sIdForm).serializeArray(), onCompleteFunctionHandler);
}
// Funciones
function AjaxEjecutarScript(sParametros,sUrlPagina,sIdForm,sIdsLabels,bBloquearForm) {
    if (sIdsLabels != '') {
	    var oArrIdsLabels = sIdsLabels.split(';');
	    for (var i = 0; i < oArrIdsLabels.length; i++){
            $("#" + oArrIdsLabels[i]).hide();
        }
    }
	if (sUrlPagina == '') {
		sUrlPagina = window.location.pathname + window.location.search;
	}
	if (bBloquearForm){
    document.getElementById('divDeshabilitadorForm').style.display = 'block';
    onCompleteFunctionHandler = onCompleteFunctionBlock;
	}else{
		if (MostrarEtiquetaProcesando != undefined) {
		    MostrarEtiquetaProcesando();
	  }
	  onCompleteFunctionHandler = onCompleteFunction;
	}
	if(sIdForm!="")
		sIdForm = "#" + sIdForm;
	else
		sIdForm = "form";
			
	$("#EsAjax").val('true');
	$.post(sUrlPagina, $(sIdForm).serializeArray(),
	  function(data){
			if (MostrarEtiquetaProcesando != undefined) {
			    OcultarEtiquetaProcesando();
			}	  	
	    eval(data);
	   
	  });		
}
