  function validar_login(){
   	var Log=loginajax('Li');
   	if (Log=='OK'){
   		document.frmlogin.method="post";
   		 document.frmlogin.action = 'index.php';
		   //document.frmComprar.action = 'https://www.paypal.com/cgi-bin/webscr';
         document.frmlogin.submit();
   	}
   	else{
   		 document.frmlogin.method="post";
   		 document.frmlogin.action = 'index.php?Pagina=Login';
         document.frmlogin.submit();
   	}
   }
   
   function loginajax(accion){
   	if (accion=='Li'){
	 User = document.frmlogin.username.value;
	 Pass=document.frmlogin.password.value;
	 sEnv="accion="+accion+"&user="+User+"&pass="+Pass;
	 }else if (accion=='Lo'){
	 	sEnv="accion="+accion;
	 }
	 
     
     var oResponse=null;
     ajax=PAjax();
   
     ajax.open("POST", "login.php",false);   
          
     ajax.onreadystatechange=function() {  
	     if (ajax.readyState==4) {    
           	 oResponse = ajax.responseText;	              	
       	}
   
	}
                    	
    ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");     
    //enviando los valores     
    ajax.send(sEnv);  
    return oResponse;
} 

function Cerrar_sesion(){

   var Log=loginajax('Lo');
  /* //setTimeout ("redireccionar()", 20000);
   document.location.href='index.php?Pagina=""';
   //document.location.href="index.php";
   */
   	
    document.frmlogout.method="post";
   	document.frmlogout.action = 'index.php';
	document.frmlogout.submit();
   }
   
   function redireccionar(){
   	 location.href="index.php";
   }