/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/



function getposOffset(overlay, offsettype)
{
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

 

function overlay(curobj, subobjstr, opt_position, x_posi){
    if(idUsuario != "" && idUsuario != null) // estoy autenticado
       return true;
    if(x_posi=="")x_posi = 0;
    if (document.getElementById){
        var subobj=document.getElementById(subobjstr)
        subobj.style.display=(subobj.style.display!="block")? "block" : "none"
        if (curobj.offsetParent) {
		curleft = curobj.offsetLeft
		curtop = curobj.offsetTop
		while (curobj = curobj.offsetParent) {
			curleft += curobj.offsetLeft
			curtop += curobj.offsetTop
		    }
      	}
        subobj.style.left = curleft+"px"
        subobj.style.top = curtop+"px"
        return false;
    }else
        return true
}

function overlayclose(subobj){
 document.getElementById(subobj).style.display="none"
 document.getElementById("malAutenticado").innerHTML="";
 document.getElementById("vLoginForma").innerHTML="";
 document.getElementById("vClaveForma").innerHTML="";
 document.getElementById("password").value="";
 document.getElementById("login").value="";
}


function validarFormaLogin() 
{
   var divErrores = document.getElementById("malAutenticado");
   
   divErrores.innerHTML = "<p>Estamos validando su información...</p>";
   
   document.getElementById("vLoginForma").innerHTML = document.getElementById("vClaveForma").innerHTML = "";
   a = true;
   with(document.formaCajitaLoginFlotante) 
   {
     if (document.formaCajitaLoginFlotante.login.value == "")
     {
        document.getElementById("vLoginForma").innerHTML = "<p>Por favor, ingrese su nombre de usuario</p>";
        a = false;
     }
     if (password.value == "") 
     {
        document.getElementById("vClaveForma").innerHTML = "<p>Por favor, ingrese su clave</p>";
        a = false;
     }
     if (a)
     {
        var persi="";
        if (cookieCajiPersis.checked)
        { 
           persi = cookieCajiPersis.checked; 
        }
        incluirObjeto("AUTENTICAR_USUARIO",login.value,password.value , persi,'malAutenticado');
     }
     else
	 {
		divErrores.innerHTML = "";
		divErrores.style.background = "none";
	 }
   }
}



function validarFormaLoginBarra() 
{
   var divErrores = document.getElementById("malAutenticadoBarra");
   
   divErrores.innerHTML = "<p>Estamos validando tu información...</p>";
   divErrores.className="verificacionVisible";
   document.getElementById("vLoginFormaBarra").innerHTML = document.getElementById("vClaveFormaBarra").innerHTML = "";
   a = true;
   with(document.formaCajitaLoginBarra) 
   {
     if (document.formaCajitaLoginBarra.login.value == "")
     {
        document.getElementById("vLoginFormaBarra").innerHTML = "<p>Por favor, ingrese su nombre de usuario</p>";
        document.getElementById("vLoginFormaBarra").className="verificacionVisible";
        a = false;
     }
     if (password.value == "") 
     {
        document.getElementById("vClaveFormaBarra").innerHTML = "<p>Por favor, ingrese su clave</p>";
        document.getElementById("vClaveFormaBarra").className="verificacionVisible";
        a = false;
     }
     if (a)
     {
        var persi="";
        if (cookieCajiPersisBarra.checked)
        { 
           persi = cookieCajiPersisBarra.checked; 
        }
        incluirObjeto("AUTENTICAR_USUARIO",loginBarra.value, passwordBarra.value , persi,'malAutenticadoBarra');
     }
     else
	 {
		divErrores.innerHTML = "";
		divErrores.style.background = "none";
	 }
   }
}

