function ocultar( id ) {
	document.getElementById(id).style.display = 'none';
}


$(document).ready(inicializarDialogo);

function display( id ) {
    var descripcion = "#news" + id + "Descripcion";
    $("#central").html($(descripcion).html());
    
}

function verAnteriores() {
	cargarContenido('index/noticiasanteriores', '#central', 'Noticias Anteriores', 1, false, false);
}

function displayEvento(id) {
    var descripcion = "#evento" + id + "Descripcion";
    $("#central").html($(descripcion).html());
}

function displayPreguntaFrecuente( id ) {
    var elemnts = document.getElementsByTagName("dd");
    for (var i = 0; i < elemnts.length; i++) {
    	elemnts[i].style.display = "none";
    }
	if (document.getElementById(id).style.display == "") {
		document.getElementById(id).style.display = "none";
	} else {
		document.getElementById(id).style.display = "";
	}
}

function inicializarDialogo() {
      
	$('#dialog').dialog({
        autoOpen: false,
        modal: true,
        width: 600,
        buttons: {
            "ENVIAR": function() {
					$.post("consulta/consultar",{"txDireccion": document.getElementById('txDireccion').value, "txTema": document.getElementById('txTema').value, "txName": document.getElementById('txName').value}, function(){
						document.getElementById('txTema').value = "";
						document.getElementById('txDireccion').value = "";
						document.getElementById('txName').value = "";
						document.getElementById('txMsg').style.display = "";
				  });
            }
        }
    });  
                
                $('#sugerencia').dialog({
                    autoOpen: false,
                    modal: true,
                    width: 600,
                    buttons: {
                        "ENVIAR": function() {
      						$.post("sugerencia/sugerencia",{"txTitulo": document.getElementById('txTitulo').value, "txComentario": document.getElementById('txComentario').value}, function(){
      							document.getElementById('txTitulo').value = "";
      							document.getElementById('txComentario').value = "";
      							document.getElementById('txMsg2').style.display = "";
      					  });
                        } 
                    }
                });
                
                $('#enlacesPopup').dialog({
                    autoOpen: false,
                    modal: true,
                    width: 600
                });
             
                $('#registro').dialog({
                    autoOpen: false,
                    modal: true,
                    width: 600,
                    buttons: {
                        "ENVIAR": function() {
      						$.post("member/registrar",{
      								"txNombre": document.getElementById('txNombre').value,
      								"txTelefono": document.getElementById('txTelefono').value, 
      								"txEmpresa": document.getElementById('txEmpresa').value,
      								"txRamo_actividad": document.getElementById('txRamo_actividad').value, 
      								"txCargo": document.getElementById('txCargo').value,
      								"txEmail": document.getElementById('txEmail').value, 
      								"txEnviar_boletin": document.getElementById('txEnviar_boletin').value}, 
      								function(){   
		      							document.getElementById('txNombre').value = "";
		      							document.getElementById('txTelefono').value = "";
		      							document.getElementById('txEmpresa').value = "";
		      							document.getElementById('txRamo_actividad').value = "";
		      							document.getElementById('txCargo').value = "";
		      							document.getElementById('txEmail').value = "";
		      							document.getElementById('txEnviar_boletin').value = "";
		      							document.getElementById('txMsg3').style.display = "";
      								}
      						);
                        }
                    }
                });
                
    $('#dialog_link').click(function(){
        $('#dialog').dialog('open');
        return false;
        });
      
      $('#enlaces_link').click(function(){
          $('#enlacesPopup').dialog('open');
          return false;
      });
      
      $('#presentacion_link').click(function(){
      	window.open(this.href);
        return false;
   	 	});      
      
      	$('#sugerencia_link').click(function(){
                $('#sugerencia').dialog('open');
                return false;
            });
            
        $('#registro_link').click(function(){
            $('#registro').dialog('open');
            return false;
        });
      
}

