function inscribirse(){
    var email = $('input_newsletter').value;
	 new Ajax.Request(rootsite+'/comp/insc_newsletter.asp',
      {
        method:'post',
        parameters: { email: email },
        onSuccess: function(transport){
          var response = transport.responseText;
          $('input_newsletter').value = '';
          $('msg_newsletter').update(response);
        },
        onFailure: function(transport){ alert('Algo funciono mal') }
      });
}
function resultados(){
    var idencuesta = $('idencuesta').value;
	 new Ajax.Request(rootsite+'/comp/encuesta.asp',
      {
        method:'post',
        parameters: { id: idencuesta },
        onSuccess: function(transport){
          var response = transport.responseText;
          $('encuesta').update(response);
        },
        onFailure: function(transport){ alert('Algo funciono mal') }
      });
}
function votar(){
	var opcion = 0;
	for(i=1;i<=3;i++)
		if($('op'+i).checked)
			opcion = $('op'+i).value;
	if(opcion==0){
		alert('Debe seleccionar una opcion');
		return;
	}
    var idencuesta = $('idencuesta').value;
	 new Ajax.Request(rootsite+'/comp/encuesta.asp?op=votar',
      {
        method:'post',
        parameters: { id: idencuesta, opcion: opcion },
        onSuccess: function(transport){
          var response = transport.responseText;
          $('encuesta').update(response);
        },
        onFailure: function(){ alert('Algo funciono mal') }
      });
}
function borrar(){
	for(i=1;i<=3;i++)
		$('op'+i).checked = false;
}
function imprimir(id){
	var ventana = window.open("", "","");
	var content = document.getElementById(id).innerHTML;
	var contenido = "<html><head><link href='css/style.css' rel='stylesheet' type='text/css' /></head><body onload='window.print();window.close();'>";
	contenido = contenido + content + "</body></html>";
	ventana.document.open();
	ventana.document.write(contenido);
	ventana.document.close();
}
function login(){
    var user = $('user').value;
    var pass = $('password').value;
    new Ajax.Request(rootsite+'/comp/login.asp',
      {
        method:'post',
        parameters: {usuario: user, clave: pass},
        onSuccess: function(transport){
          var response = transport.responseText;
          if(response=='OK'){
            goTo('./pressroom.asp');
          }
          $('user').value = response;
        },
        onFailure: function(){ alert('Algo funciono mal') }
      });
}
function logoff(){
    new Ajax.Request(rootsite+'/comp/login.asp',
      {
        method:'post',
        onSuccess: function(transport){
            goTo();
        },
        onFailure: function(){ alert('Algo funciono mal') }
      });
}
function goTo(url){
    if(url==null)
        window.location.reload(true);
    else
        window.location.href = url;
}
function popup(url, w, h, title){
    w = (w==null?500:w);
    h = (h==null?400:h);
    title = (title==null?'':title);
    Lightview.show({ href: rootsite+url, title: title, rel: 'iframe', options: { width: w, height: h}});
}