var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"
var tiempo = null;

var bouncelimit=24 //(OJO debe ser divisible entre 8)

function initbox(){
if (!dom&&!ie&&!ns4)
return

//Vemos cual es la posición en el ancho en que debemos sacar la capa
if (document.all)
{anchoPantalla=document.body.clientWidth;}
else
{anchoPantalla=window.innerWidth;}
var posX = Math.round(anchoPantalla/2);
//alert(posX+"jeje");

crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.left=posX+140
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("entrar()",50)
tiempo=setTimeout("salida()", 30000)
}

function entrar(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<200+scroll_top)
crossobj.top=parseInt(crossobj.top)+35+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("temblar()",50)
}
}

function salir(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)>-250+scroll_top)
	crossobj.top=parseInt(crossobj.top)-25+calunits
else{
	clearInterval(dropstart)
}
}

function temblar(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function entrada(){
bouncelimit=24
initbox()
}

function salida(){
	bouncelimit=8
	dropstart=setInterval("salir()",50)
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

window.onresize=initbox
//window.onload=initbox
