var edit=0;
function postear(enlace,num){
	$('formulario').action=enlace.href;
	$('remitente').value=window.location.pathname;
	$('numero').value=num;
	$('formulario').submit();
	return false;
}



function TamVentana() {
     var Tamanyo = [0, 0];
     if (typeof window.innerWidth != 'undefined'){
         Tamanyo = [
         window.innerWidth,
         window.innerHeight
         ];
     }else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0){
     Tamanyo = [
         document.documentElement.clientWidth,
         document.documentElement.clientHeight
         ];
     }else{
         Tamanyo = [
             document.getElementsByTagName('body')[0].clientWidth,
             document.getElementsByTagName('body')[0].clientHeight
         ];
     }
     return Tamanyo;
 }
 
 function actualizar(url,metodo,opciones){
 	if (opciones!=""){
 		opciones='&'+opciones;
 	}
 	new Ajax.Request(url,{
 		method: 'post',
 		parameters:'metodo='+metodo+opciones,
 		onSuccess:actualizador
 	});
 }
 
 function actualizador(respuesta){
 	xml=respuesta.responseXML;
 	for(i=0;i<xml.getElementsByTagName('bloque').length;i++){
 		bloque=xml.getElementsByTagName('bloque')[i];
 		$(bloque.getElementsByTagName('id')[0]).innerHTML=bloque.getElementsByTagName('html')[0];
 	}
 }
 
  function enviar_msj(formulario){
 	ocultar_mensaje();
 	new Ajax.Request(window.location.pathname, {
  		method: 'post',
  		parameters: 'metodo=enviar_mensaje&'+Form.serialize(formulario),
  		onSuccess: function(resp){
  			if(resp.responseText.charAt(0)!=1)
  				alert(resp.responseText);
  		}
  	});
 }

 
 function ayudar_usuario(){
 	new Ajax.Request(window.location.pathname, {
  		method: 'post',
  		parameters: 'metodo=ayuda_general',
  		onSuccess: function(resp){
  			$('cabecera_ayuda').innerHTML=resp.responseText;
  			new Effect.toggle('cabecera_ayuda','slide');
  		}
  	});
 }
 
 
 function nuevo_mensaje(destino,asunto){
 	$('para_input_mensaje').value=destino;
 	$('asunto_input_mensaje').value=asunto;
 	new Effect.toggle('cuadro_nuevo_mensaje','slide');
 }
 
 function ocultar_mensaje(){
 	new Effect.toggle('cuadro_nuevo_mensaje','slide');
 }
 
 function aviso(msj){
 	$('texto_aviso').innerHTML=msj;
 	new Effect.toggle('aviso','appear');
 }
