function Previsor(E,url,J)
{
	var str;	
	var div;
	var oDivC;
	var R = new NewHttpReq();
	var odPreVisor=document.getElementById('SICPrevisor');
	var capaTexto;
	if(odPreVisor == null)
	{
		odPreVisor=document.createElement("DIV")
		odPreVisor.id='SICPrevisor';
		odPreVisor.oditop=document.createElement("DIV");
		odPreVisor.oditop.id='SICiTop';
		odPreVisor.oditop.className="iTop"
		odPreVisor.odCuerpo=document.createElement("DIV");
		odPreVisor.odCuerpo.id='SICCuerpo'
		odPreVisor.odCuerpo.className="iCentro";
		
		odPreVisor.odibot=document.createElement("DIV");
		odPreVisor.odibot.id='SICiBot';
		odPreVisor.odibot.className="iBottom";
		odPreVisor.appendChild(odPreVisor.oditop);
		odPreVisor.appendChild(odPreVisor.odCuerpo);
		odPreVisor.appendChild(odPreVisor.odibot);
		odPreVisor.className = "PreVisor";
	    
	    //odPreVisor.style.background= "#FFFFFF";
        odPreVisor.style.top=(event.y+11) + document.documentElement.scrollTop;
        //odPreVisor.style.top=(event.y-300) + document.documentElement.scrollTop;
        odPreVisor.style.left=(event.x-275); /*Para el previsor grande de 495 px hay que restar 425*/
        //odPreVisor.style.padding=30;
        
        //alert("left: "+odPreVisor.style.left);
        var posXString=odPreVisor.style.left;
        
        if (parseInt(posXString.replace("px","")) < 3) { //Comparando directamente odPreVisor.style.left < 3 no sale bien porque compara un string
            //alert("dentro");
            odPreVisor.style.left = "3px";
        }
        
        document.body.appendChild(odPreVisor);
        
        oDivC=document.getElementById('SICCuerpo');
        
        oDivC.odTexto=document.createElement("DIV");
        oDivC.odTexto.className="iTexto";
        oDivC.odTexto.id='SICiTexto';
        oDivC.appendChild(oDivC.odTexto);
        
        capaTexto=document.getElementById('SICiTexto');
        
        
        if (oDivC!=null)
            capaTexto.innerHTML = '<img src="images/cargando.gif" border="0" /> Cargando..'; 
            //oDivC.innerHTML = '<img src="images/cargando.gif" border="0" /> Cargando..';
            
        if (E!="13")
            str="P="+J;
        else
            str="F="+J;
        str=str+"&PV=1";
        R.open("POST",url, true);       
        R.setRequestHeader('Content-Type','application/x-www-form-urlencoded');//necesario para el metodo POST
        R.setRequestHeader("Charset", "utf-8");               
        R.send(str); 

        R.onreadystatechange = function()
        {    
            if (R.readyState != 4)
            {
            if (oDivC!=null)
                capaTexto.innerHTML ='Fallo en la conexión con el servidor.';
                //oDivC.innerHTML ='Fallo en la conexión con el servidor.';
                return; // Si hay algún error
            }                
            div=R.responseXML.xml;
            if(div==null || div=="")
                div=R.responseText;
            if (oDivC!=null)
                capaTexto.innerHTML = div;
                //oDivC.innerHTML =div;
        }
   }
}
function PrevisorClose()
{
    var odPreVisor=document.getElementById('SICPrevisor');
    if (odPreVisor!=null)
    {           
	    document.body.removeChild(odPreVisor); 	    
	}	    
}	

